-
-
Notifications
You must be signed in to change notification settings - Fork 737
Closed
rectorphp/rector-src
#3216Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.org/demo/3565a3fa-2ab3-495f-b900-1a9e6ff00990
<?php
final class DemoFile
{
public function run()
{
$foo = 'I like pie';
$bar = <<<EOD
And on this day, it was spoken - "$foo"
EOD;
}
}Responsible rules
ChangeReadOnlyVariableWithDefaultValueToConstantRector
Expected Behavior
This code would remain unaffected, as the current suggestion And on this day, it was spoken - "{self::FOO}" in invalid.
Reasoning:
The variable used in the string interpolation cannot be converted into a constant because you cannot use values of class constants or static class variables in string interpolation, as per https://www.php.net/manual/en/language.types.string.php#language.types.string.parsing .