@@ -21,23 +21,23 @@ class FormatRules
2121 /**
2222 * Alpha
2323 *
24- * @param string $str
24+ * @param string|null $str
2525 *
2626 * @return boolean
2727 */
28- public function alpha (string $ str = null ): bool
28+ public function alpha (? string $ str = null ): bool
2929 {
3030 return ctype_alpha ($ str );
3131 }
3232
3333 /**
3434 * Alpha with spaces.
3535 *
36- * @param string $value Value.
36+ * @param string|null $value Value.
3737 *
3838 * @return boolean True if alpha with spaces, else false.
3939 */
40- public function alpha_space (string $ value = null ): bool
40+ public function alpha_space (? string $ value = null ): bool
4141 {
4242 if ($ value === null )
4343 {
@@ -50,11 +50,11 @@ public function alpha_space(string $value = null): bool
5050 /**
5151 * Alphanumeric with underscores and dashes
5252 *
53- * @param string $str
53+ * @param string|null $str
5454 *
5555 * @return boolean
5656 */
57- public function alpha_dash (string $ str = null ): bool
57+ public function alpha_dash (? string $ str = null ): bool
5858 {
5959 return (bool ) preg_match ('/^[a-z0-9_-]+$/i ' , $ str );
6060 }
@@ -78,23 +78,23 @@ public function alpha_numeric_punct($str)
7878 /**
7979 * Alphanumeric
8080 *
81- * @param string $str
81+ * @param string|null $str
8282 *
8383 * @return boolean
8484 */
85- public function alpha_numeric (string $ str = null ): bool
85+ public function alpha_numeric (? string $ str = null ): bool
8686 {
8787 return ctype_alnum ($ str );
8888 }
8989
9090 /**
9191 * Alphanumeric w/ spaces
9292 *
93- * @param string $str
93+ * @param string|null $str
9494 *
9595 * @return boolean
9696 */
97- public function alpha_numeric_space (string $ str = null ): bool
97+ public function alpha_numeric_space (? string $ str = null ): bool
9898 {
9999 return (bool ) preg_match ('/^[A-Z0-9 ]+$/i ' , $ str );
100100 }
@@ -117,82 +117,82 @@ public function string($str = null): bool
117117 /**
118118 * Decimal number
119119 *
120- * @param string $str
120+ * @param string|null $str
121121 *
122122 * @return boolean
123123 */
124- public function decimal (string $ str = null ): bool
124+ public function decimal (? string $ str = null ): bool
125125 {
126126 return (bool ) preg_match ('/^[-+]?[0-9]{0,}\.?[0-9]+$/ ' , $ str );
127127 }
128128
129129 /**
130130 * String of hexidecimal characters
131131 *
132- * @param string $str
132+ * @param string|null $str
133133 *
134134 * @return boolean
135135 */
136- public function hex (string $ str = null ): bool
136+ public function hex (? string $ str = null ): bool
137137 {
138138 return ctype_xdigit ($ str );
139139 }
140140
141141 /**
142142 * Integer
143143 *
144- * @param string $str
144+ * @param string|null $str
145145 *
146146 * @return boolean
147147 */
148- public function integer (string $ str = null ): bool
148+ public function integer (? string $ str = null ): bool
149149 {
150150 return (bool ) preg_match ('/^[\-+]?[0-9]+$/ ' , $ str );
151151 }
152152
153153 /**
154154 * Is a Natural number (0,1,2,3, etc.)
155155 *
156- * @param string $str
156+ * @param string|null $str
157157 * @return boolean
158158 */
159- public function is_natural (string $ str = null ): bool
159+ public function is_natural (? string $ str = null ): bool
160160 {
161161 return ctype_digit ($ str );
162162 }
163163
164164 /**
165165 * Is a Natural number, but not a zero (1,2,3, etc.)
166166 *
167- * @param string $str
167+ * @param string|null $str
168168 * @return boolean
169169 */
170- public function is_natural_no_zero (string $ str = null ): bool
170+ public function is_natural_no_zero (? string $ str = null ): bool
171171 {
172172 return ($ str !== '0 ' && ctype_digit ($ str ));
173173 }
174174
175175 /**
176176 * Numeric
177177 *
178- * @param string $str
178+ * @param string|null $str
179179 *
180180 * @return boolean
181181 */
182- public function numeric (string $ str = null ): bool
182+ public function numeric (? string $ str = null ): bool
183183 {
184184 return (bool ) preg_match ('/^[\-+]?[0-9]*\.?[0-9]+$/ ' , $ str );
185185 }
186186
187187 /**
188188 * Compares value against a regular expression pattern.
189189 *
190- * @param string $str
191- * @param string $pattern
190+ * @param string|null $str
191+ * @param string $pattern
192192 *
193193 * @return boolean
194194 */
195- public function regex_match (string $ str = null , string $ pattern ): bool
195+ public function regex_match (? string $ str , string $ pattern ): bool
196196 {
197197 if (strpos ($ pattern , '/ ' ) !== 0 )
198198 {
0 commit comments