Skip to content

Incorrect behavior of RenameClassNonPhpRector #7743

@grandmaster44

Description

@grandmaster44

Bug Report

Subject Details
Rector version v0.15.0+

Rector is trying to rename class in yaml file to an interface:

obraz

Minimal PHP Code Causing Issue

( I'm changing yaml file, so I can't prepare a demo )

#services.yml

services:
    custom_logger:
        class: Symfony\Bridge\Monolog\Logger
        arguments: [ custom_logger ]

#rector.php

<?php

use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;

return static function (RectorConfig $rectorConfig): void {
  $rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
       'Symfony\\Bridge\\Monolog\\Logger' => 'Psr\\Log\\LoggerInterface', // taken from rector/rector-symfony/config/sets/symfony/symfony30.php
  ]);
};

command
php bin/rector process services.yml

Expected Behaviour

Rector should skip rename class to an interface in yaml.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions