Skip to main content

Come hack with me as we get Drupal Rector automation prepared

Published on

Last week I announced that drupal-check and phpstan-drupal became Drupal 9 and PHP 8 ready. These tools help folks keep their Drupal 9 code in top-notch condition and unblocks preparation for Drupal 10. However, phpstan-drupal is only a portion of the Drupal major version upgrade infrastructure. The Upgrade Status module compliments phpstan-drupal to also check stateful components in Drupal. What are stateful components? Things like hooks and asset library usage are hard to interpret with PHPStan. The Upgrade Status module finds deprecated uses of these items and can report them.

The next major component is Drupal Rector, the Drupal extension for Rector. Rector is a tool that automates code fixes. Yeah. It will take deprecated code and fixes it based on defined rules. The Drupal Rector extension contains these rules.

Just like phpstan-drupal, Drupal Rector was built to handle Drupal 8 code in the journey for Drupal 9.

Before the Drupal 9 release, the Drupal Association (and Ted Bowman) created the Project Update Bot. The bot runs Rector and generates patches to all modules with available deprecated code usage fixes. Thousands of modules benefitted from that. Hopefully, the same success will repeat itself ahead of Drupal 10. Didn't know about the Project Update Bot? Read the full announcement: Accelerating Drupal 9 module and theme readiness with automated patches.

Drupal Rector also faces two major maintenance tasks:

  • Add rules to fix deprecations introduced in the Drupal 9 release cycle
  • Upgrade to support Rector 0.10 – currently, the project has a pinned Rector dependency of 0.7.29 (released Jun 5, 2020.)

With phpstan-drupal and drupal-check in a decent space, I will direct my time on Drupal Rector. I still have 13 hours of sponsored time from Florida DrupalCamp, and I'd love it if the entirety of their sponsorship were able to bring our Drupal upgrade tooling infrastructure into a maintained state.

My first goal will be getting Drupal Rector up to date with Rector 0.10. Upgrading the supported Recotr version will ensure folks still working on getting onto Drupal 9 have a stable tool. Then we can get Drupal 9 support.

I'll be hacking on Drupal Rector live on my Twitch channel – https://www.twitch.tv/mglaman.

If you want to tune in, I'll be going live at the following times (follow, and you can get notified when I go live)

  • Wednesday, March 24th – 2:00 PM CDT (7:00 PM UTC)
  • Sunday, March 28th – 10:00 AM CDT (3:00 PM UTC)

Otherwise, the videos will export to my YouTube channel afterward.

Photo by Christopher Burns on Unsplash

I'm available for one-on-one consulting calls – click here to book a meeting with me 🗓️