Mastering automated refactoring with custom Rector rules (Tutorial)


Abstract

Are you working on a legacy project that is in need of upgrading?

Do you need to make changes to your project that require the same repetitive refactor applied to your codebase hundreds of times and no existing tools can to help automate the task?

If either of these scenarios are familiar you've probably had a look at or used Rector. Rector has hundreds of rules that help with automating upgrades and refactors.

However, what happens if you need to do something custom to your project, that is not available with an existing Rector Rule? In this case you can create your own custom Rector rule.

This tutorial will teach you how to create custom Rector rules that can automate tasks specific to your project. By the end of this tutorial you'll know how to create your own rules and have a framework for creating rules for whatever refactor you wish to automate.

You'll need this repo for the tutorial.


See more talks.

Events
Longhorn PHP Oct 2025

[slides] [joind.in] [website]

PHPTek May 2025

[slides] [website]

PHPCon Poland Oct 2024

[website]