Sorry for long title, I wasn't able to come up with a better one; hopefully it describe well what I'm trying to point out.
Basically if I have two nullable class members (let's call them foo and bar) which are two objects, and I check for both to be null (exiting the execution), when I check later for one of the twos (not important, let's say it's foo the candidate) to be null and call for a method on the other, which can't be null otherwise I would have exited from the execution, phpstan complains about the possible null.
If I do the same with method arguments (ie.: not class members) everything works as expected.
You can find below some examples
https://phpstan.org/r/5dc1149f-ccd6-48a8-bb29-b81899deaeb2
https://phpstan.org/r/c7ab95de-d3ff-496f-8f23-a6a6dd231a3c
Is this the expected behaviour?
Thank you in advance and cheers for the great tool!
Sorry for long title, I wasn't able to come up with a better one; hopefully it describe well what I'm trying to point out.
Basically if I have two nullable class members (let's call them
fooandbar) which are two objects, and I check for both to benull(exiting the execution), when I check later for one of the twos (not important, let's say it'sfoothe candidate) to benulland call for a method on the other, which can't benullotherwise I would have exited from the execution, phpstan complains about the possiblenull.If I do the same with method arguments (ie.: not class members) everything works as expected.
You can find below some examples
https://phpstan.org/r/5dc1149f-ccd6-48a8-bb29-b81899deaeb2
https://phpstan.org/r/c7ab95de-d3ff-496f-8f23-a6a6dd231a3c
Is this the expected behaviour?
Thank you in advance and cheers for the great tool!