Reported automatically by a code-commandments agent.
|
|
| Prophet |
SuggestCompareSelfTraitProphet |
| Location |
src/Support/Enums/CompareSelf.php |
What's wrong
Prophet/PHPStan conflict: the rule now MANDATES the case-anchored instance form Enum::Case->equals($x) (static Enum::equals($x, Case) against a literal case is a sin). But that instance call does NOT type-check at PHPStan max level: PHPStan resolves NodeType::Control->equals($x) against the trait's STATIC @method static bool equals(mixed $value, self $case) (2 required) rather than the instance @method bool equals(mixed $value), producing 'Method NodeType::equals() invoked with 1 parameter, 2 required' (arguments.count) + argument.type errors on EVERY case-anchored call repo-wide (~69). The two same-named @method declarations (instance + static) on CompareSelf are ambiguous to PHPStan when the receiver is an enum case. Either the generated CompareSelf trait needs PHPStan-resolvable annotations (or real methods) for the dual instance/static API, or the prophet should not mandate a form that fails the type checker.
For the fixer
Decide whether this is a false positive (tighten/guard the prophet), a wrong rule (adjust the rule or its config), or correct-but-unclear (improve the message/scripture). Add a fixture from the flagged code above.
Reported automatically by a code-commandments agent.
SuggestCompareSelfTraitProphetsrc/Support/Enums/CompareSelf.phpWhat's wrong
Prophet/PHPStan conflict: the rule now MANDATES the case-anchored instance form
Enum::Case->equals($x)(staticEnum::equals($x, Case)against a literal case is a sin). But that instance call does NOT type-check at PHPStan max level: PHPStan resolvesNodeType::Control->equals($x)against the trait's STATIC@method static bool equals(mixed $value, self $case)(2 required) rather than the instance@method bool equals(mixed $value), producing 'Method NodeType::equals() invoked with 1 parameter, 2 required' (arguments.count) + argument.type errors on EVERY case-anchored call repo-wide (~69). The two same-named @method declarations (instance + static) on CompareSelf are ambiguous to PHPStan when the receiver is an enum case. Either the generated CompareSelf trait needs PHPStan-resolvable annotations (or real methods) for the dual instance/static API, or the prophet should not mandate a form that fails the type checker.For the fixer
Decide whether this is a false positive (tighten/guard the prophet), a wrong rule (adjust the rule or its config), or correct-but-unclear (improve the message/scripture). Add a fixture from the flagged code above.