Skip to content

Incorrect behavior of RemoveUnusedPromotedPropertyRector #9043

@koraga

Description

@koraga

Bug Report

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

Minimal PHP Code Causing Issue

See https://getrector.com/demo/2919d329-78da-4c85-a82e-80f44b1906fa

<?php

final class DemoFile
{
    private int $sum {
        get => $this->a + $this->b;
    }
    
    public function __construct(
       	private readonly int $a,
       	private readonly int $b,
    ) {}

    public function getSum(): int
    {
        return $this->sum;
    }
}

Responsible rules

  • RemoveUnusedPromotedPropertyRector

Expected Behavior

Properties $a and $b used in property hook $sum

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