Skip to content

Commit

Permalink
Merge pull request #1705 from PHPCompatibility/feature/classes-remove…
Browse files Browse the repository at this point in the history
…dclasses-bugfix

Classes/RemovedClasses: bug fix - check all parts of a type
  • Loading branch information
wimg committed Apr 21, 2024
2 parents d83177e + 1bca044 commit 192c5a4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions PHPCompatibility/Sniffs/Classes/RemovedClassesSniff.php
Expand Up @@ -423,12 +423,12 @@ private function checkTypeDeclaration($phpcsFile, $stackPtr, $typeString)
$type = \ltrim($type, '\\');

if ($type === '') {
return;
continue;
}

$typeLc = \strtolower($type);
if (isset($this->removedClasses[$typeLc]) === false) {
return;
continue;
}

$itemInfo = [
Expand Down
4 changes: 4 additions & 0 deletions PHPCompatibility/Tests/Classes/RemovedClassesUnitTest.inc
Expand Up @@ -101,3 +101,7 @@ class IntersectionTypes {
public function paramType(SWFSprite&\SWFText $param) {}
public function returnType($param) : HW_API_Object&HW_API_Attribute {}
}

function CheckAllTypeParts(
NotATarget|SWFButton $a
) : NotATarget|SQLiteException {}
4 changes: 2 additions & 2 deletions PHPCompatibility/Tests/Classes/RemovedClassesUnitTest.php
Expand Up @@ -73,7 +73,7 @@ public static function dataRemovedClass()

['SWFAction', '5.3', [32, 33, 34, 35], '5.2'],
['SWFBitmap', '5.3', [37], '5.2'],
['SWFButton', '5.3', [38], '5.2'],
['SWFButton', '5.3', [38, 106], '5.2'],
['SWFDisplayItem', '5.3', [39, 84], '5.2'],
['SWFFill', '5.3', [40, 92], '5.2'],
['SWFFont', '5.3', [41, 92], '5.2'],
Expand All @@ -93,7 +93,7 @@ public static function dataRemovedClass()
['SQLiteDatabase', '5.4', [66, 80], '5.3'],
['SQLiteResult', '5.4', [67, 93], '5.3'],
['SQLiteUnbuffered', '5.4', [68, 93], '5.3'],
['SQLiteException', '5.4', [69], '5.3'],
['SQLiteException', '5.4', [69, 107], '5.3'],

['XmlRpcServer', '8.0', [71, 74], '7.4'],
];
Expand Down

0 comments on commit 192c5a4

Please sign in to comment.