@@ -98,6 +98,7 @@ public static function notEqual($expected, $actual, string $description = null):
9898 $ res = self ::isEqual ($ expected , $ actual );
9999 } catch (AssertException $ e ) {
100100 }
101+
101102 if (empty ($ e ) && $ res ) {
102103 self ::fail (self ::describe ('%1 should not be equal to %2 ' , $ description ), $ actual , $ expected );
103104 }
@@ -308,14 +309,12 @@ public static function type($type, $value, string $description = null): void
308309 if (!is_array ($ value ) || ($ value && array_keys ($ value ) !== range (0 , count ($ value ) - 1 ))) {
309310 self ::fail (self ::describe ("%1 should be $ type " , $ description ), $ value );
310311 }
311-
312312 } elseif (in_array ($ type , ['array ' , 'bool ' , 'callable ' , 'float ' ,
313313 'int ' , 'integer ' , 'null ' , 'object ' , 'resource ' , 'scalar ' , 'string ' , ], true )
314314 ) {
315315 if (!("is_ $ type " )($ value )) {
316316 self ::fail (self ::describe (gettype ($ value ) . " should be $ type " , $ description ));
317317 }
318-
319318 } elseif (!$ value instanceof $ type ) {
320319 $ actual = is_object ($ value ) ? get_class ($ value ) : gettype ($ value );
321320 $ type = is_object ($ type ) ? get_class ($ type ) : $ type ;
@@ -339,6 +338,7 @@ public static function exception(
339338 $ function ();
340339 } catch (\Throwable $ e ) {
341340 }
341+
342342 if ($ e === null ) {
343343 self ::fail ("$ class was expected, but none was thrown " );
344344
@@ -351,6 +351,7 @@ public static function exception(
351351 } elseif ($ code !== null && $ e ->getCode () !== $ code ) {
352352 self ::fail ("$ class with a code %2 was expected but got %1 " , $ e ->getCode (), $ code );
353353 }
354+
354355 return $ e ;
355356 }
356357
@@ -421,6 +422,7 @@ public static function error(callable $function, $expectedType, string $expected
421422 if ($ expected ) {
422423 self ::fail ('Error was expected, but was not generated ' );
423424 }
425+
424426 return null ;
425427 }
426428
@@ -433,6 +435,7 @@ public static function noError(callable $function): void
433435 if (($ count = func_num_args ()) > 1 ) {
434436 throw new \Exception (__METHOD__ . "() expects 1 parameter, $ count given. " );
435437 }
438+
436439 self ::error ($ function , []);
437440 }
438441
@@ -465,6 +468,7 @@ public static function match(string $pattern, $actual, string $description = nul
465468 if (self ::$ expandPatterns ) {
466469 [$ pattern , $ actual ] = self ::expandMatchingPatterns ($ pattern , $ actual );
467470 }
471+
468472 self ::fail (self ::describe ('%1 should match %2 ' , $ description ), $ actual , $ pattern );
469473 }
470474 }
@@ -487,6 +491,7 @@ public static function matchFile(string $file, $actual, string $description = nu
487491 if (self ::$ expandPatterns ) {
488492 [$ pattern , $ actual ] = self ::expandMatchingPatterns ($ pattern , $ actual );
489493 }
494+
490495 self ::fail (self ::describe ('%1 should match %2 ' , $ description ), $ actual , $ pattern , null , basename ($ file ));
491496 }
492497 }
@@ -566,6 +571,7 @@ public static function isMatching(string $pattern, $actual, bool $strict = false
566571 if ($ res === false || preg_last_error ()) {
567572 throw new \Exception ('Error while executing regular expression. (PREG Error Code ' . preg_last_error () . ') ' );
568573 }
574+
569575 return (bool ) $ res ;
570576 }
571577
@@ -655,6 +661,7 @@ private static function isEqual($expected, $actual, int $level = 0, $objects = n
655661 } elseif ($ expected === $ actual ) {
656662 return true ;
657663 }
664+
658665 $ objects [$ expected ] = $ actual ;
659666 $ objects [$ actual ] = $ expected ;
660667 $ expected = (array ) $ expected ;
@@ -672,8 +679,10 @@ private static function isEqual($expected, $actual, int $level = 0, $objects = n
672679 if (!self ::isEqual ($ value , current ($ actual ), $ level + 1 , $ objects )) {
673680 return false ;
674681 }
682+
675683 next ($ actual );
676684 }
685+
677686 return true ;
678687
679688 default :
0 commit comments