We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.12.82
0.12.83
Assert::notNull($object->getEvent())
This code used to work fine, until I upgraded from 0.12.82 to 0.12.83
class Draft { public function getEvent(): ?Event {} } class Listing { public function setEvent(Event $event): void {} } private function createListing(Draft $draft) : Listing { Assert::notNull($draft->getEvent()); $listing = new Listing(); // Parameter #1 $event of method Listing::setEvent() expects Event, Event|null given. $listing->setEvent($draft->getEvent()); return $listing; }
Tried to reproduce it but I cannot: https://phpstan.org/r/c0ef8412-208b-441d-95c5-e3a9df165e55
The text was updated successfully, but these errors were encountered:
Hi, this is definitely happening because you're using bleedingEdge, this is a preview how 1.0 is going to behave.
There's an article about this: https://phpstan.org/blog/remembering-and-forgetting-returned-values
Your solution is to store event into a variable right after the assert.
Sorry, something went wrong.
This is what's probably going on in your original code: https://phpstan.org/r/22970d69-43e2-4607-9d82-cbaf6e5c884c
Got it, makes sense! Thanks.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
No branches or pull requests
This code used to work fine, until I upgraded from
0.12.82
to0.12.83
Tried to reproduce it but I cannot: https://phpstan.org/r/c0ef8412-208b-441d-95c5-e3a9df165e55
The text was updated successfully, but these errors were encountered: