Skip to content

Commit

Permalink
Fixed bug #3145 : Autoloading of sniff fails when multiple classes de…
Browse files Browse the repository at this point in the history
…clared in same file
  • Loading branch information
gsherwood committed Jan 13, 2021
1 parent d6c224d commit b0786e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ public static function determineLoadedClass($classesBeforeLoad, $classesAfterLoa
$className = null;

$newClasses = array_diff($classesAfterLoad['classes'], $classesBeforeLoad['classes']);
if (PHP_VERSION_ID < 70400) {
$newClasses = array_reverse($newClasses);
}

// Since PHP 7.4 get_declared_classes() does not guarantee any order, making
// it impossible to use order to determine which is the parent an which is the child.
Expand Down
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
-- Thanks to Michael S for the patch
- Fixed bug #2913 : Generic.WhiteSpace.ScopeIndent false positive when opening and closing tag on same line inside conditional
- Fixed bug #2992 : Enabling caching using a ruleset produces invalid cache files when using --sniffs and --exclude CLI args
- Fixed bug #3145 : Autoloading of sniff fails when multiple classes declared in same file
- Fixed bug #3157 : PSR2.ControlStructures.SwitchDeclaration.BreakIndent false positive when case keyword is not indented
- Fixed bug #3165 : Squiz.PHP.DisallowComparisonAssignment false positive when comparison inside closure
- Fixed bug #3167 : Generic.WhiteSpace.ScopeIndent false positive when using PHP 8.0 constructor property promotion
Expand Down

0 comments on commit b0786e1

Please sign in to comment.