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

[FP] Declaration access can be weaker for overridden methods in final classes #1957

Open
jdreesen opened this issue Oct 11, 2024 · 1 comment

Comments

@jdreesen
Copy link
Contributor

Subject Details
Plugin Php Inspections EA Ultimate, 2024.1.1
Language level 8.1

Current behaviour

The “Declaration access can be weaker” inspection reports that the setUp() method in a test extending PHPUnit's PHPUnit\Framework\TestCase can be made private instead of protected, because the class is final:
image

Expected behaviour

The suggestion isn't shown because decreasing the visibility of an overriden method is not allowed in PHP, see: https://3v4l.org/PF8l6

Environment details

PhpStorm 2024.2.3
Build #PS-242.23339.16, built on September 25, 2024
Runtime version: 21.0.4+13-b509.17 amd64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.X11.XToolkit
Linux 5.4.0-196-generic
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 6144M
Cores: 8
Current Desktop: ubuntu:GNOME

@jdreesen
Copy link
Contributor Author

Note: there was already a similar bug a few years ago: #1384

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

No branches or pull requests

1 participant