Repository navigation
Commit 97ed64a
Restore SubstrDynamicReturnTypeExtension behavior and baseline its finding
The previous commit removed the empty-string branch under `is_bool($substr)`
as dead code, reasoning that `$substr` is a bool only where
`substrReturnFalseInsteadOfEmptyString()` is true. That is a real regression:
the branch is live when PHPStan itself runs on a runtime PHP whose native
`substr()` returns `false` (old runtime) while analysing a target version
where substr yields `''`. There the runtime `substr()` call produces a bool,
`substrReturnFalseInsteadOfEmptyString()` is false, and the else branch
simulates the modern result by returning ConstantStringType(''). PHPStan's own
inference models `substr()` per the analysed version and cannot see the old
runtime path, so it reports the guard as always-true - a finding that must be
baselined, not resolved by deleting the branch.
Restore the file to its exact pre-commit content and record the single
`if.alwaysTrue` finding in the baseline instead. The other seven dead-code
removals in the previous commit are genuinely dead and stay removed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CGhnJQpUWRRpg6H5LuWJkA1 parent 05afcd1 commit 97ed64a
2 files changed
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1644 | 1644 | | |
1645 | 1645 | | |
1646 | 1646 | | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
1647 | 1653 | | |
1648 | 1654 | | |
1649 | 1655 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
99 | 104 | | |
100 | 105 | | |
101 | 106 | | |
| |||
0 commit comments