Skip to content

Php4ConstructorRector rule not applied #8100

@akash-grexit

Description

@akash-grexit

Bug Report

Subject Details
Rector version 0.17.7

Minimal PHP Code Causing Issue

foo.php

<?php

class Foo {
    function Foo() { 
        echo 'Constructed!';
    }
}

rector.php

<?php

use Rector\Config\RectorConfig;
use Rector\Php70\Rector\ClassMethod\Php4ConstructorRector;

return static function (RectorConfig $rectorConfig): void {
    $rectorConfig->paths([__DIR__ . '/public/src/foo.php']);
    // register single rule
    $rectorConfig->rule(Php4ConstructorRector::class);
};

Expected Behaviour

 <?php
 
 class Foo {
    function __construct() { 
         echo 'Constructed!';
     }
 }

Demo: https://getrector.com/demo/8e684b99-3c59-48a1-8730-d9cddc88aaac

I tested the rule in this demo environment, and it's working there. However, it's not working on my machine.

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