Skip to content

Conversation

@samsonasik
Copy link
Member

@samsonasik samsonasik commented Apr 22, 2025

Fixes rectorphp/rector#9071

πŸ‘ If current class has __construct, it already correct: https://getrector.com/demo/9663303c-6e55-40aa-a8f4-0c31790e2ae7

❌ If current class doesn't have __construct, and parent has, it should follow parent __construct, it currently not yet followed https://getrector.com/demo/2136fc0d-2973-409e-89c1-0a7ba83ad24f


This PR try to follow parent construct if no construct in current class.

@samsonasik
Copy link
Member Author

implemented /cc @parth391

Tested in both php 7.4 (with assign) and php 8.0 (with property promotion) πŸ‘

@samsonasik
Copy link
Member Author

All checks have passed πŸŽ‰ @TomasVotruba I am merging it ;)

@samsonasik samsonasik merged commit d50c1f3 into main Apr 22, 2025
45 checks passed
@samsonasik samsonasik deleted the follow-prent branch April 22, 2025 08:14
@TomasVotruba
Copy link
Member

πŸ‘

@samsonasik
Copy link
Member Author

samsonasik commented Apr 22, 2025

I tested locally on 2 files extends single class, It only add __construct on first file, while second file somehow cached so not inject to __construct on 2nd file, I will look into it

Screenshot 2025-04-22 at 17 59 45

@samsonasik
Copy link
Member Author

#6858

@github-actions
Copy link
Contributor

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StaticCallToMethodCallRector dont consider parent class constructor

4 participants