-
Notifications
You must be signed in to change notification settings - Fork 548
Implement UnaryMinusHandler #4598
New issue
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
Conversation
| $type = $mulResult->result; | ||
| $nativeType = $mulResult->nativeType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure why PHPStan reports
------ -----------------------------------------------------------------------------------------
Line src/Analyser/Generator/ExprHandler/UnaryMinusHandler.php
------ -----------------------------------------------------------------------------------------
44 Access to an undefined property PHPStan\Analyser\Generator\ExprAnalysisResult::$result.
🪪 property.notFound
💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
at src/Analyser/Generator/ExprHandler/UnaryMinusHandler.php:44
------ -----------------------------------------------------------------------------------------
here but it does not on line 40.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean. The reported lines are sometimes shifted because code is downgraded on lower PHP versions.
But $mulResult->result is really an error. It's supposed to be $mulResult->type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha, seems it was too early this morning ;).
hopefully we can make improvements so phpstorm autocomplete and type-discovery work better with this fiber code. atm it feels kind of unsupported.
are you aware whether there are already open issues on the phpstorm bugtracker to improve on type stuff with Fibers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the handlers it's not about fibers but about generators. I think it's hard and no syntax was yet developed for this. We'd need something for @return Generator<... that would tell PHPStan + PhpStorm "when this is yielded, this is sent".
Psalm has @psalm-yield annotation but it doesn't make sense to me. Because what is sent depends on context. For the same yielded objects, different things can get sent to it in different generators.
|
This pull request has been marked as ready for review. |
|
Thank you! |
as in
phpstan-src/src/Reflection/InitializerExprTypeResolver.php
Lines 2523 to 2551 in 61b221c
phpstan-src/src/Analyser/NodeScopeResolver.php
Lines 3626 to 3640 in 61b221c