Note: This is a new extension, if you encounter any bugs or issues please make sure you report them. Report Issues
An extension for helping refactor PHP files when renaming or moving a file between namespaces. It's meant to follow a similar process to PHPStorms File Refactoring. Whilst it might not be as powerful, it does have a safe refactoring option.
Safe Refactoring - When turned on (active by default), all refactoring changes will appear in the activity bar (refactoring icon). This is triggered by either moving a PHP file or renaming a PHP file.
Utilizes a PHP parser to create an AST array for better identification of potential changes.
Replaces both fully qualified names and unqualified names where possible.
If your project has a composer.json file it will attempt to map your autoload PSR-4 namespaces to any changes that have occurred.
When files are moved, it will update that files namespace, along with any occurrences throughout our project.
Clicking on the reviews will take you to the file, line and column of the proposed change.
This extension doesn't have any dependencies or requirements but you should turn on autosave for ease of life.
This extension contributes the following settings:
phpFileRefactoring.excludeFolders: Folders to exclude when refactoring a workspace for changes. Default: **/vendor/**
phpFileRefactoring.excludedFiles: If you already have excluded files set up with VS codes default settings, this will also exclude these files when refactoring.
phpFileRefactoring.excludedSearch: If you already have excluded search options set up with VS codes default settings, this will also exclude these options when refactoring.
phpFileRefactoring.safeRefactoring: All changes (except original file rename or move) need to be reviewed or confirmed.
PHP files that are moved with no namespace won't add additional namespace.
Fix bug with interfaces, traits and enums. Added MIT license file
Initial release of php file refactoring, added Badge to activity icon for review count