[Php81] Keep nullable param on NewInInitializerRector#7545
Merged
TomasVotruba merged 1 commit intomainfrom Oct 23, 2025
Merged
Conversation
samsonasik
referenced
this pull request
Oct 22, 2025
Member
Author
|
Ready to merge 👍 |
Member
|
Thank you. I'm wondering how this rule could be ever useful. I personally never saw it practice, except nested PHP attributes :) Let's give this another round and collect feedback in real projects. The |
Member
Author
|
@TomasVotruba you can see example on spiral framework that it cause bc break https://github.com/spiral/framework/blob/3d1055a956093bc7a72e531cf55fb5c3e410ab29/rector.php#L96 so skip there, make nullable is the way it has less bc break. |
Member
|
We need exact code structure. |
Member
Author
|
@TomasVotruba see exact example commit that reverted previous apply and skip the new in initializers, because nullable removed |
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.
@TomasVotruba per our discussion on 153fc78#r168615132
since the rule register back to
php81set, this safe belt keep nullable is needed.this to avoid new issue opened again:
This needs to be nullable, or it will not safe, however, the drawback is property itself become nullable, while it originally not, as it always initialized inside constructor before.
This also ensure no bc break