Skip to content

Conversation

@samsonasik
Copy link
Member

see https://phpstan.org/r/7fe0ce63-8d29-4f53-b1c6-5a05c3d31b74

The @readonly flag will warn user when user want to change property of promotion.

@samsonasik
Copy link
Member Author

I updated to use ClassMethod for downgrade the readonly property promotion, to fix printing on combine with DowngradeReadonlyClassRector, see https://github.com/rectorphp/rector-downgrade-php/actions/runs/17527116646/job/49779086917#step:5:45

Before

-    public function __construct(public array $property)
+    public function __construct(/**
+     * @readonly
+     */
+    public array $property)

After

-    public function __construct(public array $property)
+    public function __construct(
+        /**
+         * @readonly
+         */
+        public array $property
+    )
     {
     }

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba I am merging it to have faster feedback to test ;)

@samsonasik samsonasik merged commit 8ab1dce into main Sep 7, 2025
6 checks passed
@samsonasik samsonasik deleted the add-readonly-doc branch September 7, 2025 10:27

$this->visibilityManipulator->removeReadonly($node);
if ($hasChangedDoc) {
$node->setAttribute(AttributeKey::ORIGINAL_NODE, null);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will check if this can be tweaked without re-print the whole ClassMethod.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking reprint should not happen on whole class, less pretty, but should be safer. I will create PR for it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Successfully merging this pull request may close these issues.

2 participants