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 PHP 8.3 Override attribute #10626

Closed
1 of 2 tasks
edsrzf opened this issue Jan 31, 2024 · 4 comments · Fixed by #10651
Closed
1 of 2 tasks

Support PHP 8.3 Override attribute #10626

edsrzf opened this issue Jan 31, 2024 · 4 comments · Fixed by #10651

Comments

@edsrzf
Copy link
Contributor

edsrzf commented Jan 31, 2024

Psalm should support PHP 8.3's new Override attribute in two ways:

  • When a method has an Override attribute but does not override a parent method, raise an issue. (Any method with an Override attribute that would cause a fatal runtime error should also be detected statically by Psalm.) Call it InvalidOverride. (Implemented in New InvalidOverride issue for Override attribute #10644.)
  • When a method of a child class overrides that of a parent class and there is no Override attribute, raise an issue. Call it MissingOverrideAttribute.

Both of these would apply only when the PHP version is >= 8.3, and the second one should probably have its own configuration option.

I'm happy to work on the implementation and use this issue to track progress, discuss the ideas, and hash out any details, like the error names or configuration.

Copy link

Hey @edsrzf, can you reproduce the issue on https://psalm.dev? These will be used as phpunit tests when implementing the feature or fixing this bug.

@weirdan
Copy link
Collaborator

weirdan commented Jan 31, 2024

Don't we have that already? See #10493

@weirdan
Copy link
Collaborator

weirdan commented Jan 31, 2024

Maybe call it InvalidOverrideAttribute?

Just InvalidOverride would seem more fitting - as there's nothing wrong with the attribute itself.

Maybe call it MissingOverrideAttribute?

Sounds good to me.

@weirdan
Copy link
Collaborator

weirdan commented Jan 31, 2024

Don't we have that already? See #10493

That PR just adds the attribute stub.

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.

2 participants