[PHP83] Implements a rule to add types to class constants#5290
Merged
TomasVotruba merged 8 commits intorectorphp:mainfrom Dec 3, 2023
Merged
[PHP83] Implements a rule to add types to class constants#5290TomasVotruba merged 8 commits intorectorphp:mainfrom
TomasVotruba merged 8 commits intorectorphp:mainfrom
Conversation
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
c7f03ee to
a6f3a3d
Compare
TomasVotruba
approved these changes
Dec 3, 2023
Member
|
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. |
Contributor
Author
|
Will take a look into this. |
This file contains hidden or 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
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.