Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Incorrect behavior of DowngradeParameterTypeWideningRector + DowngradeReflectionGetAttributesRector  #7546

@leoloso

Description

@leoloso

Bug Report

Subject Details
Rector version last dev-main
Installed as composer dependency

Minimal PHP Code Causing Issue

See https://getrector.org/demo/1fcc02fc-52f3-4ca2-bc4a-6117e00362b7

<?php

class SomeClass
{
    public function run(ReflectionClass $reflectionClass)
    {
        if ($reflectionClass->getAttributes()) {
            return true;
        }
        return false;
    }
}

Responsible rules

  • DowngradeParameterTypeWideningRector

Expected Behavior

When applying set DowngradeLevelSetList::DOWN_TO_PHP_71, rule DowngradeReflectionGetAttributesRector should also be applied (in addition to DowngradeParameterTypeWideningRector), but it is not.

Check the same code but running the rule instead of the set, then that rule is applied:

https://getrector.org/demo/417e38a1-b75f-42e3-8998-b178bc5bf55f

Similarly, running DowngradeLevelSetList::DOWN_TO_PHP_71 twice, the second time on the output from the first run, then DowngradeReflectionGetAttributesRector is applied:

https://getrector.org/demo/d849d04d-e35c-448d-aa49-c23a7423ceef

This may be the same issue as here? #7452

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions