Bug Report
| Subject |
Details |
| Rector version |
last dev-main |
| Installed as |
composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/a4d71e69-0b0b-498c-b3b1-9e9a0665cc10
<?php
declare(strict_types=1);
namespace Rector\Core\Kernel;
final class RectorKernel
{
/** @var string|null */
private static $defaultFilesHash;
/**
* @param string[] $configFiles
*/
private function createConfigsHash(array $configFiles): string
{
$fileHasher = new FileHasher();
if (self::$defaultFilesHash === null) {
self::$defaultFilesHash = 'test';
}
return self::$defaultFilesHash . 'test 2';
}
}
Responsible rules
-
ChangeReadOnlyVariableWithDefaultValueToConstantRector
-
ChangeReadOnlyPropertyWithDefaultValueToConstantRector
-
TypedPropertyFromAssignsRector
Expected Behavior
It should only change type without changing to constant, as it will cause fatal error, see https://3v4l.org/Hk40Y
Bug Report
Minimal PHP Code Causing Issue
See https://getrector.com/demo/a4d71e69-0b0b-498c-b3b1-9e9a0665cc10
Responsible rules
ChangeReadOnlyVariableWithDefaultValueToConstantRectorChangeReadOnlyPropertyWithDefaultValueToConstantRectorTypedPropertyFromAssignsRectorExpected Behavior
It should only change type without changing to constant, as it will cause fatal error, see https://3v4l.org/Hk40Y