You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Foo {
}
if ( class_exists( Test :: class ) ) {
Test :: callStuff();
}
if ( class_exists( Test2 ::class ) ) {
Test2 :: callStuff();
}
the "class" in line 6 is token T_CLASS, while the "class" in line 9 is T_STRING. php lint is okay with a space there
This results in false positive on line 6 with the code ":: class" for some sniffs. The use of "::class" is okay in line 9.
6 | ERROR | [ ] Only one object structure is allowed in a file
| | (Generic.Files.OneObjectStructurePerFile.MultipleFound)
6 | ERROR | [ ] Class name ")" is not in PascalCase format
| | (Squiz.Classes.ValidClassName.NotCamelCaps)
It seems you have just to use $lastNotEmptyToken instead of -1 in PHP.php (search for classname::class)