Commit 43b42f2
authored
fix(admin-edit-ban): resolve PHPStan false positive on BanType::Ip check (#1541)
Gate the IP-length/validity check on `$postBanType === BanType::Ip` alone,
then nest the `$_POST['ip']`-dependent conditions inside, instead of
re-checking the enum inside a compound `&&` alongside a mixed-typed
operand.
PHPStan was flagging the previous compound condition as always-false dead
code. Confirmed false positive via isolated repro: combining a re-check of
$postBanType with a mixed-typed $_POST value in the same && expression,
right after an earlier if/elseif/elseif/else chain that discriminates on
$postBanType only in its first branch, causes PHPStan to mis-merge the
type. Renaming the variable or precomputing a boolean flag did not resolve
it; removing the compound && combination does.
Also regenerates the PHPStan baseline to realign the two pre-existing
entries (ternary.alwaysTrue, booleanNot.alwaysFalse) whose line numbers
shifted after this change.
No behavior change — pure equivalence transform.1 parent b7384aa commit 43b42f2
1 file changed
Lines changed: 14 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
200 | 202 | | |
201 | 203 | | |
202 | 204 | | |
| |||
209 | 211 | | |
210 | 212 | | |
211 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
212 | 219 | | |
213 | 220 | | |
214 | 221 | | |
| |||
0 commit comments