@@ -53,7 +53,7 @@ class Assert
5353 /**
5454 * Asserts that two values are equal and have the same type and identity of objects.
5555 */
56- public static function same ($ expected , $ actual , string $ description = null ): void
56+ public static function same ($ expected , $ actual , ? string $ description = null ): void
5757 {
5858 self ::$ counter ++;
5959 if ($ actual !== $ expected ) {
@@ -65,7 +65,7 @@ public static function same($expected, $actual, string $description = null): voi
6565 /**
6666 * Asserts that two values are not equal or do not have the same type and identity of objects.
6767 */
68- public static function notSame ($ expected , $ actual , string $ description = null ): void
68+ public static function notSame ($ expected , $ actual , ? string $ description = null ): void
6969 {
7070 self ::$ counter ++;
7171 if ($ actual === $ expected ) {
@@ -78,7 +78,7 @@ public static function notSame($expected, $actual, string $description = null):
7878 * Asserts that two values are equal and checks expectations. The identity of objects,
7979 * the order of keys in the arrays and marginally different floats are ignored.
8080 */
81- public static function equal ($ expected , $ actual , string $ description = null ): void
81+ public static function equal ($ expected , $ actual , ? string $ description = null ): void
8282 {
8383 self ::$ counter ++;
8484 if (!self ::isEqual ($ expected , $ actual )) {
@@ -91,7 +91,7 @@ public static function equal($expected, $actual, string $description = null): vo
9191 * Asserts that two values are not equal and checks expectations. The identity of objects,
9292 * the order of keys in the arrays and marginally different floats are ignored.
9393 */
94- public static function notEqual ($ expected , $ actual , string $ description = null ): void
94+ public static function notEqual ($ expected , $ actual , ? string $ description = null ): void
9595 {
9696 self ::$ counter ++;
9797 try {
@@ -110,7 +110,7 @@ public static function notEqual($expected, $actual, string $description = null):
110110 * @param mixed $needle
111111 * @param array|string $actual
112112 */
113- public static function contains ($ needle , $ actual , string $ description = null ): void
113+ public static function contains ($ needle , $ actual , ? string $ description = null ): void
114114 {
115115 self ::$ counter ++;
116116 if (is_array ($ actual )) {
@@ -135,7 +135,7 @@ public static function contains($needle, $actual, string $description = null): v
135135 * @param mixed $needle
136136 * @param array|string $actual
137137 */
138- public static function notContains ($ needle , $ actual , string $ description = null ): void
138+ public static function notContains ($ needle , $ actual , ? string $ description = null ): void
139139 {
140140 self ::$ counter ++;
141141 if (is_array ($ actual )) {
@@ -159,7 +159,7 @@ public static function notContains($needle, $actual, string $description = null)
159159 * Asserts that a haystack has an expected key.
160160 * @param string|int $key
161161 */
162- public static function hasKey ($ key , array $ actual , string $ description = null ): void
162+ public static function hasKey ($ key , array $ actual , ? string $ description = null ): void
163163 {
164164 self ::$ counter ++;
165165 if (!is_int ($ key ) && !is_string ($ key )) {
@@ -175,7 +175,7 @@ public static function hasKey($key, array $actual, string $description = null):
175175 * Asserts that a haystack doesn't have an expected key.
176176 * @param string|int $key
177177 */
178- public static function hasNotKey ($ key , array $ actual , string $ description = null ): void
178+ public static function hasNotKey ($ key , array $ actual , ? string $ description = null ): void
179179 {
180180 self ::$ counter ++;
181181 if (!is_int ($ key ) && !is_string ($ key )) {
@@ -191,7 +191,7 @@ public static function hasNotKey($key, array $actual, string $description = null
191191 * Asserts that a value is true.
192192 * @param mixed $actual
193193 */
194- public static function true ($ actual , string $ description = null ): void
194+ public static function true ($ actual , ? string $ description = null ): void
195195 {
196196 self ::$ counter ++;
197197 if ($ actual !== true ) {
@@ -204,7 +204,7 @@ public static function true($actual, string $description = null): void
204204 * Asserts that a value is false.
205205 * @param mixed $actual
206206 */
207- public static function false ($ actual , string $ description = null ): void
207+ public static function false ($ actual , ? string $ description = null ): void
208208 {
209209 self ::$ counter ++;
210210 if ($ actual !== false ) {
@@ -217,7 +217,7 @@ public static function false($actual, string $description = null): void
217217 * Asserts that a value is null.
218218 * @param mixed $actual
219219 */
220- public static function null ($ actual , string $ description = null ): void
220+ public static function null ($ actual , ? string $ description = null ): void
221221 {
222222 self ::$ counter ++;
223223 if ($ actual !== null ) {
@@ -230,7 +230,7 @@ public static function null($actual, string $description = null): void
230230 * Asserts that a value is not null.
231231 * @param mixed $actual
232232 */
233- public static function notNull ($ actual , string $ description = null ): void
233+ public static function notNull ($ actual , ? string $ description = null ): void
234234 {
235235 self ::$ counter ++;
236236 if ($ actual === null ) {
@@ -243,7 +243,7 @@ public static function notNull($actual, string $description = null): void
243243 * Asserts that a value is Not a Number.
244244 * @param mixed $actual
245245 */
246- public static function nan ($ actual , string $ description = null ): void
246+ public static function nan ($ actual , ? string $ description = null ): void
247247 {
248248 self ::$ counter ++;
249249 if (!is_float ($ actual ) || !is_nan ($ actual )) {
@@ -256,7 +256,7 @@ public static function nan($actual, string $description = null): void
256256 * Asserts that a value is truthy.
257257 * @param mixed $actual
258258 */
259- public static function truthy ($ actual , string $ description = null ): void
259+ public static function truthy ($ actual , ? string $ description = null ): void
260260 {
261261 self ::$ counter ++;
262262 if (!$ actual ) {
@@ -269,7 +269,7 @@ public static function truthy($actual, string $description = null): void
269269 * Asserts that a value is falsey.
270270 * @param mixed $actual
271271 */
272- public static function falsey ($ actual , string $ description = null ): void
272+ public static function falsey ($ actual , ? string $ description = null ): void
273273 {
274274 self ::$ counter ++;
275275 if ($ actual ) {
@@ -282,7 +282,7 @@ public static function falsey($actual, string $description = null): void
282282 * Asserts the number of items in an array or Countable.
283283 * @param array|\Countable $value
284284 */
285- public static function count (int $ count , $ value , string $ description = null ): void
285+ public static function count (int $ count , $ value , ? string $ description = null ): void
286286 {
287287 self ::$ counter ++;
288288 if (!$ value instanceof \Countable && !is_array ($ value )) {
@@ -299,7 +299,7 @@ public static function count(int $count, $value, string $description = null): vo
299299 * @param string|object $type
300300 * @param mixed $value
301301 */
302- public static function type ($ type , $ value , string $ description = null ): void
302+ public static function type ($ type , $ value , ? string $ description = null ): void
303303 {
304304 self ::$ counter ++;
305305 if (!is_object ($ type ) && !is_string ($ type )) {
@@ -329,7 +329,7 @@ public static function type($type, $value, string $description = null): void
329329 public static function exception (
330330 callable $ function ,
331331 string $ class ,
332- string $ message = null ,
332+ ? string $ message = null ,
333333 $ code = null
334334 ): ?\Throwable {
335335 self ::$ counter ++;
@@ -359,7 +359,7 @@ public static function exception(
359359 /**
360360 * Asserts that a function throws exception of given type and its message matches given pattern. Alias for exception().
361361 */
362- public static function throws (callable $ function , string $ class , string $ message = null , $ code = null ): ?\Throwable
362+ public static function throws (callable $ function , string $ class , ? string $ message = null , $ code = null ): ?\Throwable
363363 {
364364 return self ::exception ($ function , $ class , $ message , $ code );
365365 }
@@ -372,7 +372,7 @@ public static function throws(callable $function, string $class, string $message
372372 * @throws \Exception
373373 * @throws \Exception
374374 */
375- public static function error (callable $ function , $ expectedType , string $ expectedMessage = null ): ?\Throwable
375+ public static function error (callable $ function , $ expectedType , ? string $ expectedMessage = null ): ?\Throwable
376376 {
377377 if (is_string ($ expectedType ) && !preg_match ('#^E_[A-Z_]+$#D ' , $ expectedType )) {
378378 return static ::exception ($ function , $ expectedType , $ expectedMessage );
@@ -458,7 +458,7 @@ public static function noError(callable $function): void
458458 * %h% one or more HEX digits
459459 * @param string $pattern mask|regexp; only delimiters ~ and # are supported for regexp
460460 */
461- public static function match (string $ pattern , $ actual , string $ description = null ): void
461+ public static function match (string $ pattern , $ actual , ? string $ description = null ): void
462462 {
463463 self ::$ counter ++;
464464 if (!is_scalar ($ actual )) {
@@ -477,7 +477,7 @@ public static function match(string $pattern, $actual, string $description = nul
477477 /**
478478 * Asserts that a string matches a given pattern stored in file.
479479 */
480- public static function matchFile (string $ file , $ actual , string $ description = null ): void
480+ public static function matchFile (string $ file , $ actual , ? string $ description = null ): void
481481 {
482482 self ::$ counter ++;
483483 $ pattern = @file_get_contents ($ file ); // @ is escalated to exception
@@ -504,8 +504,8 @@ public static function fail(
504504 string $ message ,
505505 $ actual = null ,
506506 $ expected = null ,
507- \Throwable $ previous = null ,
508- string $ outputName = null
507+ ? \Throwable $ previous = null ,
508+ ? string $ outputName = null
509509 ): void {
510510 $ e = new AssertException ($ message , $ expected , $ actual , $ previous );
511511 $ e ->outputName = $ outputName ;
@@ -517,7 +517,7 @@ public static function fail(
517517 }
518518
519519
520- private static function describe (string $ reason , string $ description = null ): string
520+ private static function describe (string $ reason , ? string $ description = null ): string
521521 {
522522 return ($ description ? $ description . ': ' : '' ) . $ reason ;
523523 }
0 commit comments