false-positive: Value assigned to variable $counter is never read.
Author: staabmCreated Sep 18, 2026Updated Sep 18, 2026
Bug report
as can be seen in https://3v4l.org/fbc2F#v the variable is read later on with value ''
Code snippet that reproduces the problem
https://phpstan.org/r/13983af8-a7e9-4571-b6d3-32ef73c1f0f7
Expected output
no error on line 9
Value assigned to variable $counter is never read.
I also wonder whether we should have the error on line 11
Call to function is_numeric() with numeric-string will always evaluate to true. because the array can be empty
Did PHPStan help you today? Did it make you happy in any way?
No response
Source: phpstan/phpstan