psalm: UnusedVariable false positive on if-elseif-else with exception
See https://psalm.dev/r/5b6314611b
The throw line seems to be the culprit. If you comment out the line, the warning goes away.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 18
I appreciate you comment. The above makes sense and help me to understand how the tool works. To me this issue can be closed.
True you are using foo on line 17 in your elseif example, and on line 12 in the other example.
However the variable definition of line 4 is overrwitten with an value or there is an exception thrown so execution stops.
So following the
if elseexample.line 4 assign
nulltofooSo the assignment of line 4 is not needed and can safely be removed