Bug Report
The code private const PRIVATE_CONST = 1; that should have been kept was removed, and the code public $bar; that should have been deleted was retained.
| Subject |
Details |
| Rector version |
last dev-main |
| Installed as |
composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/70c5b6ad-566a-4a8e-beb8-c213568fca50
<?php
trait TraitA
{
}
trait TraitB
{
}
class TestClass
{
use TraitA, TraitB;
public const PUBLIC_CONST = 2;
private const PRIVATE_CONST = 1;
protected $foo;
public $bar;
public function __construct(int $foo, int $bar)
{
$this->foo = $foo;
$this->bar = $bar;
}
public function getConst(): int
{
return self::PRIVATE_CONST ?? self::PUBLIC_CONST;
}
}
Responsible rules
-
SeparateMultiUseImportsRector
-
ClassPropertyAssignToConstructorPromotionRector
-
FinalizeClassesWithoutChildrenRector
Expected Behavior
Keep the code private const PRIVATE_CONST = 1; and remove the code public $bar;.
Bug Report
The code
private const PRIVATE_CONST = 1;that should have been kept was removed, and the codepublic $bar;that should have been deleted was retained.Minimal PHP Code Causing Issue
See https://getrector.com/demo/70c5b6ad-566a-4a8e-beb8-c213568fca50
Responsible rules
SeparateMultiUseImportsRectorClassPropertyAssignToConstructorPromotionRectorFinalizeClassesWithoutChildrenRectorExpected Behavior
Keep the code
private const PRIVATE_CONST = 1;and remove the codepublic $bar;.