-
-
Notifications
You must be signed in to change notification settings - Fork 687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Downgrade PHP 7.4] Class was not found while trying to analyse it #5252
Comments
I identified the minimal piece of code causing the bug: https://getrector.org/demo/6ddc6db1-d418-4f63-b123-318adfd4137c use Symfony\Contracts\Cache\ItemInterface;
abstract class CacheItemTest implements ItemInterface
{
public function tag($tags): ItemInterface
{
return $this;
}
} |
Here is the minimal Rector config: https://getrector.org/demo/471e8b57-277e-4f47-b429-8fa621cd73d2 use Rector\DowngradePhp74\Rector\ClassMethod\DowngradeCovariantReturnTypeRector;
use Rector\DowngradePhp74\Rector\ClassMethod\DowngradeReturnSelfTypeDeclarationRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(DowngradeCovariantReturnTypeRector::class);
$services->set(DowngradeReturnSelfTypeDeclarationRector::class);
}; The bug happens when both Either removing 1 of them, or changing their order, works well! https://getrector.org/demo/597dacce-4600-4f47-ac0c-66e3b0a9fd1a Solution?To fix the issue right now, we can just change the order these 2 rules are executed in But is that the actual solution? Or is there still some bug, waiting to explode again? To find out, should take the output from executing the first rule, and check why the 2nd rule explodes with that input. |
I got same error reported for a new class const fetch. This is the fix: #5306 The bug was exactly on this line: https://github.com/rectorphp/rector/pull/5306/files#diff-016ad0c3bfe09fb4b758182a0ea0630b905923756ba947940e82c5364d4c2eabL53 |
rectorphp/rector-src@52ef7b8 [Scoped] Remove unused vendor/symfony/service-contracts/Test on downgrade build (#5252)
Bug Report
Starting from Rector
0.9.7
, downgrading Rector to PHP 7.1 fails:Minimal PHP Code Causing Issue
https://getrector.org/demo/2b94998b-4282-4fdf-88a9-d6b8cfb8d3af
Expected Behaviour
Why is it searching for an empty class? Where is that coming from?
Btw, I did an update for
0.9.7
on classDowngradeContravariantArgumentTypeRector
(to avoid applying the rule on__construct
), but that's completely unrelated. Undoing this change, the error still happens, so it must be somewhere else.The text was updated successfully, but these errors were encountered: