Repository navigation
More class usages reported and labelled by what they are, property hook fixes #446
spaze
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
New
disallowedClassesordisallowedNamespacesare reported:instanceof, first-class callables likeFoo::bar(...), DNF types like(A&B)|null, types of class constants, and interfaces extended by interfaces or implemented by enums (Report class usages ininstanceof, first-class callables, DNF types, typed constants, and interface and enum declarations #444)Class,Interface(with the newdisallowed.interfaceidentifier),EnumorTrait, also in static calls,extendsandimplements, which saidNamespacebefore; onlyuseimports keepNamespacebecause they can also import a namespace (Report enum usages once, asEnumwithdisallowed.enum#440, Report interfaces asInterface, traits asTrait, other namespaces asClassorEnumwhen it makes sense #443 - possible BC break)allowInClassWithMethodAttributessees attributes on hooks; matching hooks by name likeFoo::$bar::get()inallowInMethodsis now documented (Use property hook's own attributes forallowInMethodsWithAttributes#441, Treat property hooks like methods in attribute-based allow directives, document hook names forallowInMethods#445)Bugfixes
Suit::Heartswas reported twice, as a class and as an enum, now it's reported once asEnum(Report enum usages once, asEnumwithdisallowed.enum#440)ReflectionExceptionwhen the config hadallowInMethodsWithAttributes,allowExceptInMethodsWithAttributesor their aliases (Use property hook's own attributes forallowInMethodsWithAttributes#441)self::,static::andparent::calls aren't reported asNamespace self is forbidden.anymore when a wildcard pattern happens to match them (Report interfaces asInterface, traits asTrait, other namespaces asClassorEnumwhen it makes sense #443)str_contains()isn't used anymore, it doesn't exist on PHP 7.4 (Usestrpos()instead ofstr_contains(),'Stringable'instead ofStringable::class#436)Internal changes
composer.json(No errors in the newest PHPStan #439)PHPStan1Compatibilityrenamed toPHPStanCompatibility, because it covers older PHPStan 2.x versions too (Use property hook's own attributes forallowInMethodsWithAttributes#441)Possible BC break note: messages and identifiers changed for static calls,
extendsandimplements(Namespace/disallowed.namespaceis nowClass,Interface,EnumorTrait), for interfaces and traits anywhere else (Class/disallowed.classis nowInterface/disallowed.interfaceorTrait/disallowed.trait), and for enums in type declarations (Classis nowEnum). The duplicateClasserror for enum cases and constants is gone. If you match these errors inignoreErrorsor a baseline, they may need updating, and the newly reported usages can add errors.This discussion was created from the release More class usages reported and labelled by what they are, property hook fixes.
All reactions