#15324·phpstan

always false substr() comparison with literal strings

Author: staabmCreated Sep 27, 2026Updated Sep 27, 2026
Labelsfeature-request

Feature request

when comparing a substring against a literal-string we should detect cases which are always false, when the substring beeing extracted will always be shorter than the compared literal

https://phpstan.org/r/03fb4bf7-03f0-4fed-a254-dfd161d4b66d https://3v4l.org/lKEen#v

there are likely more string functions this can be applied to