code samples for rector.php don't match the auto-generated file

Created on 13 May 2024, about 1 year ago

I installed Rector and it auto-generated a rector.php file which starts like this:

return RectorConfig::configure()
    ->withPaths([

That's not compatible with this example in the README:

$rectorConfig->sets([

Or this in the docs on the attribute conversion:

return static function(RectorConfig $rectorConfig): void {
  $rectorConfig->ruleWithConfiguration(\DrupalRector\Drupal10\Rector\Deprecation\AnnotationToAttributeRector::class, [
πŸ› Bug report
Status

Active

Component

Documentation

Created by

πŸ‡¬πŸ‡§United Kingdom joachim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @joachim
  • πŸ‡ΊπŸ‡ΈUnited States afinnarn

    Also to note, "DrupalFinder" is saying the current rector.php file uses deprecated methods.

      $drupalFinder = new DrupalFinder();
      $drupalFinder->locateRoot(__DIR__);
      $drupalRoot = $drupalFinder->getDrupalRoot();
    

    From the website https://github.com/webflo/drupal-finder, they recommend this code now:

    $drupalFinder = new \DrupalFinder\DrupalFinderComposerRuntime();
    $drupalRoot = $drupalFinder->getDrupalRoot();
    
Production build 0.71.5 2024