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

Support $foo::BAR where foo is declared as a string or a class-string #44

Closed
spaze opened this issue Feb 6, 2021 · 1 comment · Fixed by #186
Closed

Support $foo::BAR where foo is declared as a string or a class-string #44

spaze opened this issue Feb 6, 2021 · 1 comment · Fixed by #186

Comments

@spaze
Copy link
Owner

spaze commented Feb 6, 2021

These should be supported

/** @var string $monster */
$monster = DateTime::class;
$monster::COOKIE;
/** @var class-string $monster */
$monster = DateTime::class;
$monster::COOKIE;

But currently they aren't:

[
'Cannot access constant COOKIE on string',
10,
],
[
'Cannot access constant COOKIE on class-string',
14,
],

This is a follow-up to #42, which was fixed by #43 to just not crash.

@spaze
Copy link
Owner Author

spaze commented May 30, 2022

Closing this now, eventually it seems that it's not a big deal in real world code, including mine. Can reopen if needed.

@spaze spaze closed this as not planned Won't fix, can't repro, duplicate, stale May 30, 2022
spaze pushed a commit that referenced this issue Apr 25, 2023
Fixes #44 (partly, not the general `class-string` case)
spaze added a commit that referenced this issue Apr 25, 2023
…186)

Update ClassConstantUsages rule to not fail when accessing constant on class-string that can be resolved to appropriate class

Fixes #44 (partly, not the general `class-string` case)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant