| Subject | Details |
| :------------- | :---------------------------------------------------------------|
| Rector version | Rector 0.8.56 |
| Installed as | composer dependency |
A.php
<?php
class A {
static function b($c) {}
}
test.php
<?php
A::b(C);
die('THIS FILE SHOULD NOT BE EXECUTED');
rector.php
<?php
declare(strict_types=1);
use Rector\Core\Configuration\Option;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Rector\Php72\Rector\ConstFetch\BarewordStringRector;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$services = $containerConfigurator->services();
$services->set(BarewordStringRector::class);
$parameters->set(Option::AUTOLOAD_PATHS, ['A.php']);
};
https://getrector.org/demo/9beb47c6-ecf1-4fda-bb2f-aa93dfacf9cc#demo_result
rector should not stop working and no php code should be executed by a static analyser.
Rector 0.7 is not maintained anymore.
Does the same happen with 0.9?
Rector 0.7 is not maintained anymore.
Does the same happen with 0.9?
I adjusted the example and specified the rector version to latest stable 0.8.56.
Thank you!
The BarewordStringRector must be load the full file, so all the constants are known.
Eval might help, but it would still execute code:
The eval() language construct is very dangerous because it allows execution of arbitrary PHP code.
This could be solve only with static reflection: https://github.com/rectorphp/rector/issues/3490
Closing, as the root of the problem is same.
In the meaintime, you can disable the BarewordStringRector rule in config.