Skip to content

Not fixing statics within a class properly #9613

@clickedu-jbergada

Description

@clickedu-jbergada

Bug Report

StaticCallOnNonStaticToInstanceCallRector Does not get applied within same class
Rector version 2.3.2

I tried to upgrade my PHP version to 8.0 from 7.3 using Rector but there is a certain code that gives a fatal error on 8.0 and it does not get corrected. Upon further debugging apparently the code gets corrected if it happens between classes but not within the same class (see demos for simple example).

Minimal PHP Code Causing Issue

working : https://getrector.com/demo/d774b2d0-f38d-420c-98e7-a28185f7c863 (different classes)
not working: https://getrector.com/demo/3d0dea93-ce36-4f8f-8200-f13920623cff (same class)

Expected Behaviour

I would expect to change self::a(); for (new test())->a() since it avoids the fatal error and it is how it works with different classes.

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