Skip to content

Conversation

TomasVotruba
Copy link
Member

@TomasVotruba TomasVotruba commented Feb 27, 2021

Cherry picks from static reflection PRs: #5665

@TomasVotruba TomasVotruba enabled auto-merge (squash) February 27, 2021 00:40
@TomasVotruba TomasVotruba changed the title cleanup changes [DX] Narrow wobly strings to strict ObjectType() Feb 27, 2021
@TomasVotruba TomasVotruba merged commit 0e7b845 into master Feb 27, 2021
@TomasVotruba TomasVotruba deleted the cleanup-changes branch February 27, 2021 00:58
@ruudk
Copy link
Contributor

ruudk commented Feb 27, 2021

@TomasVotruba I see that this PR removes the support for wildcard renames. Does that mean it's not possible anymore or is there a different way to do this?

I find the wildcard support super useful as it allows me to rename methods that are part of objects that are in specific namespaces (like CommandHandler ) and don't implement an interface (to target them by).

Does it mean we need to close #5652?

@TomasVotruba
Copy link
Member Author

TomasVotruba commented Feb 27, 2021

Indeed. The reason is to have more consistent type system. We basically inherit the robust one from PHPStan.

Now I see it was a mistake to go with wildcards on class type resolution. Your use case should be solved with PHPStorm refactoring or custom Rector rule instead.

This change to ObjectType also prevents prefixed class bugs like these: deprecated-packages/rector-prefixed@26b740a#diff-986b232e60ade0f6607d242741abdfc3d7de1cb51beb1f2078d322783f7cdc56

Yes, the #5652 should be closed.

@ruudk
Copy link
Contributor

ruudk commented Feb 27, 2021

It could still be possible if there was another thing in place that would search for all classes that match wildcard and then feed them in as strings to the rename method config. Would that make sense?

@TomasVotruba
Copy link
Member Author

TomasVotruba commented Feb 27, 2021

It would have to be special kind of ObjectType, e.g. WildcardObjectType, implemented across whole code base.

I can't imagine practical use case for this though. Rector should not replace one-time PHPStorm custom refactoring, but handle repeated pattern refactoring.

TomasVotruba added a commit that referenced this pull request Mar 5, 2024
rectorphp/rector-src@10c7bc6 [Performance][Php81] Ensure check readonly on param only on __construct() method (#5693)
TomasVotruba added a commit that referenced this pull request Mar 5, 2024
rectorphp/rector-src@10c7bc6 [Performance][Php81] Ensure check readonly on param only on __construct() method (#5693)
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