Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Removing] Add RemoveNamespaceRector #2013

Merged
merged 15 commits into from
Apr 6, 2022
Merged

Conversation

samsonasik
Copy link
Member

No description provided.

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba it is ready for review.

@TomasVotruba
Copy link
Member

Thanks 👍

@TomasVotruba TomasVotruba merged commit be530c5 into main Apr 6, 2022
@TomasVotruba TomasVotruba deleted the ad-remove-namespace-rector branch April 6, 2022 12:32
@TomasVotruba
Copy link
Member

TomasVotruba commented Apr 22, 2022

Hi @samsonasik , I'm getting to this rule now related with removing complex stmt attributes. I'm curious, what is the upgrade use case for this rule? Where is used? Maybe it should be part of PhpStorm refactoring scope.

@samsonasik
Copy link
Member Author

Remove namespace can be used to simplify application which only for 1 purpose (1 module) which no need namespace, eg, a bin/console directory which a collection of console apps, which if previously has namespace, which no need as it only run once and not to be re-used.

@samsonasik
Copy link
Member Author

The issue is with find and replace will cause issue on non-compount use statement after namespace removed, so this rule is used for it to handle it.

@TomasVotruba
Copy link
Member

which if previously has namespace, which no need as it only run once and not to be re-used.

Such namespace is optional and it can be anything. It's not part of a framework upgrade.

The issue is with find and replace will cause issue on non-compount use statement after namespace removed, so this rule is used for it to handle it.

I'm not sure I understand. Could you share an example? What framework/project is it related to?

@samsonasik
Copy link
Member Author

I don't have example, just add it as there is RenameNamespaceRector rule, so I though it should be a remove namespace or clear namespace.

I am fine if it is going to be removed.

@TomasVotruba
Copy link
Member

I accepted this to quickly without proppery jugdment, my appology. Rector should help with automated and repeated tasks, this should be handled with PhpStorm or manually.

I am fine if it is going to be removed.

👍

Instead we should add configuration validation in RenameNamespaceRector to avoid empty namespaces.

@TomasVotruba
Copy link
Member

Ref #2133

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.

3 participants