Skip to content

Commit b0786e1

Browse files
committedJan 13, 2021
Fixed bug squizlabs#3145 : Autoloading of sniff fails when multiple classes declared in same file
1 parent d6c224d commit b0786e1

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed
 

‎autoload.php

+3
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ public static function determineLoadedClass($classesBeforeLoad, $classesAfterLoa
196196
$className = null;
197197

198198
$newClasses = array_diff($classesAfterLoad['classes'], $classesBeforeLoad['classes']);
199+
if (PHP_VERSION_ID < 70400) {
200+
$newClasses = array_reverse($newClasses);
201+
}
199202

200203
// Since PHP 7.4 get_declared_classes() does not guarantee any order, making
201204
// it impossible to use order to determine which is the parent an which is the child.

‎package.xml

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
6565
-- Thanks to Michael S for the patch
6666
- Fixed bug #2913 : Generic.WhiteSpace.ScopeIndent false positive when opening and closing tag on same line inside conditional
6767
- Fixed bug #2992 : Enabling caching using a ruleset produces invalid cache files when using --sniffs and --exclude CLI args
68+
- Fixed bug #3145 : Autoloading of sniff fails when multiple classes declared in same file
6869
- Fixed bug #3157 : PSR2.ControlStructures.SwitchDeclaration.BreakIndent false positive when case keyword is not indented
6970
- Fixed bug #3165 : Squiz.PHP.DisallowComparisonAssignment false positive when comparison inside closure
7071
- Fixed bug #3167 : Generic.WhiteSpace.ScopeIndent false positive when using PHP 8.0 constructor property promotion

0 commit comments

Comments
 (0)
Please sign in to comment.