In software engineering, the term refactoring code usually refers to modifying the source code without changing the external behavior of the code. Software refactoring needs to be done with tools, and refactoring tools can modify the code while modifying all the places that reference that code. This article has collected five excellent PHP code refactoring tools to help you improve your projects.
1. Rephactor
Rephactor is a command-line refactoring tool, an automated tool that allows developers to modify the source code in a different codebase in a neat way.
Main functions:
- Ensure the reversibility of the refactoring-once the problem is found, the code is reversible and can be traced back to the previous version.
- Find and replace function--normal find Replace, method rename, class rename, regular expression pattern substitution.
- After all operations are completed, the tests are based on simpletest Aperiplus and the coverage of the tests is guaranteed.
- Integrate Phemto to ensure class relevance testing.
2. Scisr
SCISR is a refactoring tool written using PHP. The project is hosted on GitHub. Issued under the GPL license.
How to use:
Rename the class:
$ SCISR rename-class oldname NewName [Files]
Modification Method:
$ SCISR rename-method owningclassname oldmethodname newmethodname [Files]
File Rename:
$ SCISR rename-file old/file_name new/dir/new_file_name [Files]
To rename a class and file:
$ SCISR rename-class-file oldclassname newclassname [Files]
3. PHP Refactoring Browser
This is a refactoring tool for PHP code that describes the steps of refactoring by generating diffs to avoid simple errors during refactoring, which is great. The project is hosted on GitHub.
Using libraries:
- PHP Parser by Nikic
- PHP Token Reflection from Ond?ej nešp
Refactoring browser data mainly includes the following aspects:
- Patches--support for creating patches based on change file operations;
- Refactoring-Contains the actual refactoring domain and the adaptation of third-party libraries;
- Collection--reliable addition of set semantics based on PHP arrays. Currently contains a set of types.
4. Phpstorm
Phpstorm is a PHP IDE rich application developed by JetBrains and supports refactoring. Phpstorm is ready to help users adjust their coding, run unit tests or provide visual debugging capabilities.
Currently, Phpstorm version 7 is released, the new version supports PHP5.5, improved PHP syntax coloring performance, Vagrant, SSH control & Remote Tools, support for Drupal & PHP framework, improved debugging and test performance.
Key features of the Phpstorm:
- Smart PHP Coding editor;
- Code quality analysis;
- Support debugging/testing;
- Support Html/css/javascript Editor;
- Support cross-platform.
5. Zend Studio
Zend Studio is a PHP language integrated development environment developed by Zend Technologies. Supports HTML and JS tags, but only provides debugging support for the PHP language.
Key Features:
- With powerful professional editing tools and debugging tools;
- Support PHP syntax highlighting, grammar auto-fill function, support grammar automatic indentation and code copy function;
- Support Bookmark function;
- Built-in a powerful PHP code debugging tool;
- Supports both local and remote debug modes, and supports a variety of advanced debugging features.
Recommended five excellent PHP code refactoring tools