Bug report
I have a code as demonstrated here:
https://phpstan.org/r/ef5a04b0-3332-4af4-98e6-006197b92de4
Locally on my PHPStan 2.1.28 setup however this reports errors:
------ -----------------------------------------------------------------
Line core/Classes/some.php
------ -----------------------------------------------------------------
76 Variable $actions in empty() always exists and is always falsy.
🪪 empty.variable
80 Unreachable statement - code above always terminates.
🪪 deadCode.unreachable
------ -----------------------------------------------------------------
Seems as if the playground is not running the 2.1.28 release, but I also did not find a way to see which version is used.
Anyhow - the test has an array with array keys, each array key MAY have a null value assigned as its value. An array_filter method removes all NULL values from the array. That MAY leave an empty array. So from a functionality perspective, the empty() check is important to have as a code fork.
Code snippet that reproduces the problem
https://phpstan.org/r/ef5a04b0-3332-4af4-98e6-006197b92de4
Expected output
Like with PHPStan 2.1.27 I would expect no warnings to occur.
The actual PHP code for this is here: https://github.com/TYPO3/typo3/blob/897adcbe205ada60d9e609a6ec55a8238e001701/typo3/sysext/filelist/Classes/FileList.php
Did PHPStan help you today? Did it make you happy in any way?
Every day, I'm very thankful for your constant work on this. Also thanks to your powerhouse Markus :)
Bug report
I have a code as demonstrated here:
https://phpstan.org/r/ef5a04b0-3332-4af4-98e6-006197b92de4
Locally on my PHPStan 2.1.28 setup however this reports errors:
Seems as if the playground is not running the 2.1.28 release, but I also did not find a way to see which version is used.
Anyhow - the test has an array with array keys, each array key MAY have a null value assigned as its value. An array_filter method removes all NULL values from the array. That MAY leave an empty array. So from a functionality perspective, the empty() check is important to have as a code fork.
Code snippet that reproduces the problem
https://phpstan.org/r/ef5a04b0-3332-4af4-98e6-006197b92de4
Expected output
Like with PHPStan 2.1.27 I would expect no warnings to occur.
The actual PHP code for this is here: https://github.com/TYPO3/typo3/blob/897adcbe205ada60d9e609a6ec55a8238e001701/typo3/sysext/filelist/Classes/FileList.php
Did PHPStan help you today? Did it make you happy in any way?
Every day, I'm very thankful for your constant work on this. Also thanks to your powerhouse Markus :)