Rector is a really powerful tool for making refactoring changes to your codebase. It's easy to use, but it's not obvious, and a lot of the documentation and articles about it are outdated or incomplete. For instance, when you go to the project page (https://www.drupal.org/project/rector) there's no clear indication of how to install it!
Rector
By joachim, Tue, 02/09/2025 - 13:17
Attributes are here and they're great. I hated annotations; they were a necessary evil, but putting working code into comments just felt wrong.
By joachim, Fri, 03/05/2024 - 20:47
Rector is a tool for making changes to PHP code, which powers tools that assist with upgrading deprecated code in Drupal. When I recently made some refactoring changes in Drupal Code Builder, which were too complex to do with search and replace regexes, it seemed like a good opportunity to experiment with Rector, and learn a bit more about it.