diff --git a/PHPCompatibility/Sniffs/Interfaces/NewInterfacesSniff.php b/PHPCompatibility/Sniffs/Interfaces/NewInterfacesSniff.php index 4b17d8874..e6b8b1a75 100644 --- a/PHPCompatibility/Sniffs/Interfaces/NewInterfacesSniff.php +++ b/PHPCompatibility/Sniffs/Interfaces/NewInterfacesSniff.php @@ -452,12 +452,12 @@ private function checkTypeDeclaration($phpcsFile, $stackPtr, $typeHint) $type = \ltrim($type, '\\'); if ($type === '') { - return; + continue; } $typeLc = \strtolower($type); if (isset($this->newInterfaces[$typeLc]) === false) { - return; + continue; } $itemInfo = [ diff --git a/PHPCompatibility/Tests/Interfaces/NewInterfacesUnitTest.inc b/PHPCompatibility/Tests/Interfaces/NewInterfacesUnitTest.inc index ec190526f..30f6a9968 100644 --- a/PHPCompatibility/Tests/Interfaces/NewInterfacesUnitTest.inc +++ b/PHPCompatibility/Tests/Interfaces/NewInterfacesUnitTest.inc @@ -199,6 +199,10 @@ function ExpectsEnumParams(UnitEnum $enum1, BackedEnum $enum2) {} function useRandomExtension( Random\Engine $paramA, Random\CryptoSafeEngine $paramB ) {} +function CheckAllTypeParts( + NotATarget|Stringable $a +) : NotATarget|DOMParentNode {} + // Test parse error/live coding. // This MUST be the last test in the file! try { diff --git a/PHPCompatibility/Tests/Interfaces/NewInterfacesUnitTest.php b/PHPCompatibility/Tests/Interfaces/NewInterfacesUnitTest.php index b61c6de0d..228a04b7c 100644 --- a/PHPCompatibility/Tests/Interfaces/NewInterfacesUnitTest.php +++ b/PHPCompatibility/Tests/Interfaces/NewInterfacesUnitTest.php @@ -79,9 +79,9 @@ public static function dataNewInterface() ['SessionIdInterface', '5.5.0', [89, 117, 146], '5.6', '5.5'], ['Throwable', '5.6', [37, 52, 62, 93, 98, 103, 162, 186], '7.0'], ['SessionUpdateTimestampHandlerInterface', '5.6', [90, 142, 162], '7.0'], - ['Stringable', '7.4', [112, 179], '8.0'], + ['Stringable', '7.4', [112, 179, 203], '8.0'], ['DOMChildNode', '7.4', [196], '8.0'], - ['DOMParentNode', '7.4', [196], '8.0'], + ['DOMParentNode', '7.4', [196, 204], '8.0'], ['UnitEnum', '8.0', [198], '8.1'], ['BackedEnum', '8.0', [198], '8.1'], ['Random\Engine', '8.1', [200], '8.2'], @@ -218,7 +218,7 @@ public static function dataNoFalsePositives() [177], [185], [189], - [205], + [209], ]; }