phpstan
phpstan copied to clipboard
Function returning reference not allowed as referenced parameter
Bug report
Hello, I have a function that returns a reference and I want to pass that reference as a parameter to another function. PHPStan says: "Parameter #1 is passed by reference, so it expects variables only"
Code snippet that reproduces the problem
https://phpstan.org/r/8b4e178a-8175-40b6-a55a-eb6c60bc97fe
Expected output
Expected no issue to be reported.
Did PHPStan help you today? Did it make you happy in any way?
I know this is a nieche issue, obviously if noone has reported it yet.
I have the easy fix to just temporarily store the reference in a variable using = &.
If anyone finds it reasonable, feel free to implement it, but it is not that big of a problem.
Have a nice day everyone.