Skip to content
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

Flag accessing static properties with -> #6117

Closed
weirdan opened this issue Jul 16, 2021 · 3 comments · Fixed by #6130
Closed

Flag accessing static properties with -> #6117

weirdan opened this issue Jul 16, 2021 · 3 comments · Fixed by #6130

Comments

@weirdan
Copy link
Collaborator

weirdan commented Jul 16, 2021

https://psalm.dev/r/8df7ccd811
https://3v4l.org/iRj67

Expected: UndefinedProperty

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/8df7ccd811
<?php

class A {
    private static int $b = 1;
    public function method(): int {
        return $this->b;
    }
}
Psalm output (using commit f015c30):

No issues!

@weirdan
Copy link
Collaborator Author

weirdan commented Jul 17, 2021

The opposite should also be checked: https://psalm.dev/r/d79f2332b6

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/d79f2332b6
<?php

class A {
    private int $b = 1;
    public static function method(): int {
        return self::$b;
    }
}
Psalm output (using commit 2127da3):

No issues!

weirdan added a commit to weirdan/psalm that referenced this issue Jul 17, 2021
This handles two new cases:
1. Accessing static property with `->` (produces notices and warnings: https://3v4l.org/TiGan)
2. Accessing non-static property with `::` (causes fatal error: https://3v4l.org/IdYSh)

Fixes vimeo#6117
weirdan added a commit to weirdan/psalm that referenced this issue Jul 17, 2021
This handles two new cases:
1. Accessing static property with `->` (produces notices and warnings: https://3v4l.org/TiGan)
2. Accessing non-static property with `::` (causes fatal error: https://3v4l.org/IdYSh)

Fixes vimeo#6117
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant