PHP Deprecated when running drupal-rector 0.12.2 process in PHP 8.1.5

Created on 17 May 2022, over 2 years ago
Updated 11 August 2023, over 1 year ago

I run rector against old custom module Upgrade Status says can be fixed. Here are the two fixable items in a custom Form controller:

"Call to deprecated function drupal_set_message(). Deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use Drupal\Core\Messenger\MessengerInterface::addMessage() instead."

"Call to deprecated function entity_create(). Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use The method overriding Entity::create() for the entity type, e.g. \Drupal\node\Entity\Node::create() if the entity type is known. If the entity type is variable, use the entity storage's create() method to construct a new entity:"

So, I run rector against module containing the file in question:

% vendor/bin/rector process web/modules/custom/my_custom_module

I get a file counter and a green box with no specifics:

 9/9 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

                                                                                                                        
 [OK] Rector is done!                                                                                                   
                                                                                                                        

Go to the files ... nothing has been updated or changed in the files.

I run this on other modules and things work, but not all of them.

Any ideas? Thanks.

🐛 Bug report
Status

Postponed: needs info

Component

Code

Created by

🇺🇸United States ccshannon

Live updates comments and jobs are added and updated live.
  • PHP 8.1

    The issue particularly affects sites running on PHP version 8.1.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States j2 Utah, USA

    I'm seeing this issue too.

    @mglaman, it looks like `drupal-rector` has newer releases since version `0.12.2`, but composer installs `0.12.2` by default for some reason. I'm not sure how to install the newer version with a composer-based site.

Production build 0.71.5 2024