Conversation
ondrejmirtes
left a comment
There was a problem hiding this comment.
Again, the rule isn't added to any level. Should be level 1.
27fa410 to
918c470
Compare
5702089 to
dbcbfd9
Compare
|
@ondrejmirtes, @BackEndTea I think I've addressed your comments on this PR, let me know if there's anything else you'd like me to improve. Thanks for your reviews so far! |
|
How does this behave when the left side is a function call? e.g. $a = rand(0,1) ?? 10;I'd expect an error here, as rand cant return null. Also, how does this behave with 'always null'? e.g. function (?string $a) : void
{
if(!is_string($a) {
$a ?? = 'foo';
}
}This always triggers are |
|
@BackEndTea Good points. I've added support for |
BackEndTea
left a comment
There was a problem hiding this comment.
👍 Looks pretty good to me, it even found a fault in the phpstan source code
04e2926 to
9b7b1e1
Compare
0786c63 to
9395d76
Compare
|
Hi, I just merged it as: 3608ded I made some mostly cosmetic changes to the error messages, and cover more cases. The core logic is really solid and I appreciate it, it couldn't be easy to come up with it! :) I have more work to be done I will cover myself over this weekend:
|
|
@ondrejmirtes Thanks a bunch for your help on this one! |
In a similar vein to #25, this adds a rule checking that the left side of a coalesce statement is actually valid.