Reported automatically by a code-commandments agent.
|
|
| Prophet |
NoRawLiteralProphet |
| Location |
src/Workflow/Graph/GraphValidator.php:633 |
What's wrong
repent autofix produces a RUNTIME BUG on array-index access. It rewrote $adjacency[$current] ?? T_Array::empty() into T_Array::coalesce($adjacency[$current]). coalesce has signature (?array $value): array, so PHP evaluates $adjacency[$current] and passes it BY VALUE before coalesce runs — for a missing key that throws 'Undefined array key', which the original ?? (isset semantics) suppressed. This silently broke 111 tests. The autofix must NOT apply the coalesce rewrite to array/index access ($x[$k] ?? ...); either skip those targets, or rewrite to T_Array::coalesce($x[$k] ?? null). As-is the fix changes behavior, which an autofix must never do.
Flagged code
if (! isset($adjacency[$current]))
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.
NoRawLiteralProphetsrc/Workflow/Graph/GraphValidator.php:633What's wrong
repent autofix produces a RUNTIME BUG on array-index access. It rewrote
$adjacency[$current] ?? T_Array::empty()intoT_Array::coalesce($adjacency[$current]). coalesce has signature (?array $value): array, so PHP evaluates $adjacency[$current] and passes it BY VALUE before coalesce runs — for a missing key that throws 'Undefined array key', which the original ?? (isset semantics) suppressed. This silently broke 111 tests. The autofix must NOT apply the coalesce rewrite to array/index access ($x[$k] ?? ...); either skip those targets, or rewrite toT_Array::coalesce($x[$k] ?? null). As-is the fix changes behavior, which an autofix must never do.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.