rector
Rector is a command line tool used for automating and simplifying the process of applying automated code refactoring in PHP projects. It aims to improve the maintainability, readability, and performance of the codebase by automatically transforming and upgrading it to modern PHP standards and coding best practices. Rector supports a wide range of refactoring tasks including changing class, method, and property names, modifying visibility modifiers, and updating deprecated code usage. The tool is highly configurable and allows developers to define custom rules for code refactoring using YAML or PHP configuration files. Rector leverages the PHP-Parser library to parse and analyze the PHP code, making it reliable and accurate in its refactoring tasks. It can be used on both small and large-scale projects, offering flexibility and scalability. Rector can be integrated into CI/CD pipelines and used in combination with popular PHP frameworks like Symfony, Laravel, and Magento. It provides a dry-run mode that allows developers to preview the changes before applying them, avoiding any accidental modifications to the codebase. Rector is actively maintained and supported by a community of PHP developers, ensuring regular updates and bug fixes. It is released under the MIT license, making it open-source and free to use for any PHP project.
List of commands for rector:
-
rector:tldr:39d44 rector: Process a specific directory.$ rector process ${path-to-directory}try on your machineexplain this command
-
rector:tldr:4aa7c rector: Process a directory and apply coding standards.$ rector process ${path-to-directory} --with-styletry on your machineexplain this command
-
rector:tldr:669a5 rector: Process a directory with a specific level.$ rector process ${path-to-directory} --level ${level_name}try on your machineexplain this command
-
rector:tldr:c5fa7 rector: Display a list of available levels.$ rector levelstry on your machineexplain this command
-
rector:tldr:e09b0 rector: Process a directory without applying changes (dry run).$ rector process ${path-to-directory} --dry-runtry on your machineexplain this command