-
-
Notifications
You must be signed in to change notification settings - Fork 351
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
[PHP83] Implements a rule to add types to class constants #5290
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
samsonasik
reviewed
Nov 27, 2023
samsonasik
reviewed
Nov 27, 2023
...or/ClassConst/AddTypeToConstRector/Fixture/skip_when_parent_class_const_defines_type.php.inc
Outdated
Show resolved
Hide resolved
samsonasik
reviewed
Nov 28, 2023
peterfox
force-pushed
the
feature/typed-consts
branch
from
November 28, 2023 23:07
c7f03ee
to
a6f3a3d
Compare
TomasVotruba
approved these changes
Dec 3, 2023
Hi, thanks for kicking of this PHP 8.3 rule. I look foward to it for many years. Let's ship it so we can test and iterate improvements 👍 |
This rule is broken when you have private and then public const:
will be changed to
And when first variable is public, then it applied to private only.
|
Will take a look into this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With PHP 8.3 being released I thought I'd add another rule. This time for Types Class Constants.
The rule will change classes, traits and interfaces that contain constants.
The behavior of this rule is limited to mostly the type being obvious.
Some of these scenarios could be added over time but it makes sense to at least have a start that picks up the basics.