-
-
Notifications
You must be signed in to change notification settings - Fork 863
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
Add support for asserting the type of $this #8904
Labels
Comments
12 tasks
Another example where this would be useful: https://phpstan.org/r/bc8a92a6-c5a4-4252-94bf-456d943d0bb8 |
@greg0ire After the latest push in 1.11.x, PHPStan now reports different result with your code snippet: @@ @@
-13: PHPDoc tag @phpstan-assert-if-true has invalid value (OwningSide $this): Unexpected token "\n\t ", expected '->' at offset 48
+13: PHPDoc tag @phpstan-assert-if-true has invalid value (OwningSide $this): Unexpected token "\n\t ", expected '->' at offset 48 on line 2
22: Call to an undefined method Association::foo(). Full report
|
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Feature request
I'm currently trying to refactor a part of Doctrine ORM to use DTOs: doctrine/orm#10405
I have build a complex hierarchy of classes, and at some point, I've grown tired of doing
if ($assoc instanceof ToOneAssociationMapping && $assoc AssociationOwningSideMapping) {
I thought I'd just introduce a method to answer that particular question, and use
psalm-assert
to make PHPStan and Psalm understand what I'm doing.This does not seem to be supported by PHPStan currently: https://phpstan.org/r/6416296d-9c38-4510-a45c-251f96e61fcd
Psalm seems to support it: https://psalm.dev/r/452fefed38
Did PHPStan help you today? Did it make you happy in any way?
I was happy to see the Algolia integration on the website. Searchable docs are great!
The text was updated successfully, but these errors were encountered: