Bug report
As seen in the example, deadCode.unreachable is found twice, in the context of the using classes.
But if.alwaysTrue is only found in the trait itself.
When generating a baseline, it seems to just "randomly" pick a class to write the ignored error for, leading to inconsistent results in our development vs CI pipeline.
Analysis result:
3/3 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% < 1 sec
------ ------------------------------
Line FooTrait.php
------ ------------------------------
15 If condition is always true.
🪪 if.alwaysTrue
------ ------------------------------
------ -------------------------------------------------------
Line FooTrait.php (in context of class Bar)
------ -------------------------------------------------------
19 Unreachable statement - code above always terminates.
🪪 deadCode.unreachable
------ -------------------------------------------------------
------ -------------------------------------------------------
Line FooTrait.php (in context of class Foo)
------ -------------------------------------------------------
19 Unreachable statement - code above always terminates.
🪪 deadCode.unreachable
------ -------------------------------------------------------
Code snippet that reproduces the problem
https://phpstan.org/r/73efdd9c-0534-4553-9447-2f94e94bbefd
Expected output
if.alwaysTrue in a trait should always be reported in context of a class instead
Did PHPStan help you today? Did it make you happy in any way?
love the tool, it's helped find and prevent so many issues ❤️
Bug report
As seen in the example,
deadCode.unreachableis found twice, in the context of the using classes.But
if.alwaysTrueis only found in the trait itself.When generating a baseline, it seems to just "randomly" pick a class to write the ignored error for, leading to inconsistent results in our development vs CI pipeline.
Analysis result:
Code snippet that reproduces the problem
https://phpstan.org/r/73efdd9c-0534-4553-9447-2f94e94bbefd
Expected output
if.alwaysTruein a trait should always be reported in context of a class insteadDid PHPStan help you today? Did it make you happy in any way?
love the tool, it's helped find and prevent so many issues ❤️