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

Improve type resolution of class constants. #5591

Merged
merged 1 commit into from Apr 8, 2021

Conversation

AndrolGenhald
Copy link
Collaborator

Handle array plus operator (fixes #5588).
Handle array spread operator.
Improve string concatenation to resolve to literal instead of unknown string.

I feel like it should be possible to let ConstantTypeResolver take advantage of the better type analysis in ArrayAnalyzer, ConcatAnalyzer, etc, but it would require a restructuring that's beyond me for the time being.

Handle array plus operator (fixes vimeo#5588).
Handle array spread operator.
Improve string concatenation to resolve to literal instead of unknown string.

I feel like it should be possible to let ConstantTypeResolver take advantage of
the better type analysis in ArrayAnalyzer, ConcatAnalyzer, etc, but it would
require a restructuring that's beyond me for the time being.
Comment on lines -1167 to +1182
ClassLikeAnalyzer::VISIBILITY_PUBLIC,
$stmt->isProtected()
? ClassLikeAnalyzer::VISIBILITY_PROTECTED
: ($stmt->isPrivate()
? ClassLikeAnalyzer::VISIBILITY_PRIVATE
: ClassLikeAnalyzer::VISIBILITY_PUBLIC),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite sure if I'm fixing a mistake or introducing a bug here. I think it fixes a mistake, since it looks like these are existing constants for the current class, but none of the tests are affected either way, so I'm not sure exactly what affect this has.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unnecessary — these constants are not actually used, but it's a harmless change so it's fine to keep.

@muglug muglug merged commit 9a03598 into vimeo:master Apr 8, 2021
@muglug
Copy link
Collaborator

muglug commented Apr 8, 2021

Thanks!

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 this pull request may close these issues.

Plus operator in class const not resolving type when referencing parent const
2 participants