Reported automatically by a code-commandments agent.
|
|
| Prophet |
SuggestCompareSelfTraitProphet |
| Location |
src/Pipeline/Execution/WireType.php:80 |
What's wrong
False positive on a non-enum. WireType is a 'final readonly class' with string CONSTANTS (MIXED, STRING, INT, ...), not a backed enum. The CompareSelf trait is enum-only (it wraps enum-case === via an equals() API). Suggesting WireType '[ADOPT] CompareSelf' is invalid — a class can't be a CompareSelf enum, and $token === self::MIXED is a plain string-constant comparison, not enum-case equality. The prophet should only flag actual enums (is_enum), not classes that happen to compare $x === self::CONST.
Flagged code
if ($token === null || $token === self::MIXED)
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/Pipeline/Execution/WireType.php:80What's wrong
False positive on a non-enum. WireType is a 'final readonly class' with string CONSTANTS (MIXED, STRING, INT, ...), not a backed enum. The CompareSelf trait is enum-only (it wraps enum-case === via an equals() API). Suggesting WireType '[ADOPT] CompareSelf' is invalid — a class can't be a CompareSelf enum, and $token === self::MIXED is a plain string-constant comparison, not enum-case equality. The prophet should only flag actual enums (is_enum), not classes that happen to compare $x === self::CONST.
Flagged code
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.