Skip to content
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

Incorrect behavior of DowngradeTrailingCommasInFunctionCallsRector, DowngradeTypedPropertyRector, DowngradeTrailingCommasInParamUseRector, DowngradePropertyPromotionRector, DowngradeReadonlyPropertyRector #8333

Closed
samsonasik opened this issue Nov 30, 2023 · 1 comment · Fixed by rectorphp/rector-src#5304
Labels

Comments

@samsonasik
Copy link
Member

Bug Report

Subject Details
Rector version last dev-main
Installed as composer dependency

Minimal PHP Code Causing Issue

@TomasVotruba this is based on https://github.com/rectorphp/rector-src/actions/runs/7044121745/job/19171186107

for downgrade issue on latest symfony-console 6.4 downgrade.

See https://getrector.com/demo/09593833-1eeb-4341-a1bd-558cb89af5f2

<?php

final class CliRequest extends Request
{
    public function __construct(
        public readonly TraceableCommand $command,
    ) {
        parent::__construct(
            attributes: ['_controller' => \get_class($command->command), '_virtual_type' => 'command'],
            server: $_SERVER,
        );
    }
}

which I currently set to symfony/console ~6.3.9 to temporary to resolve it

Responsible rules

  • DowngradeTrailingCommasInFunctionCallsRector

  • DowngradeTypedPropertyRector

  • DowngradeTrailingCommasInParamUseRector

  • DowngradePropertyPromotionRector

  • DowngradeReadonlyPropertyRector

Expected Behavior

named argument should be downgraded.

@samsonasik
Copy link
Member Author

@TomasVotruba it seems due to CliRequest extends Symfony\Component\HttpFoundation\Request which we don't require symfony/http-foundation in composer.json.

https://github.com/symfony/console/blob/64e06788686633deb8d9a7c75ab31bcf4b233a26/Debug/CliRequest.php#L21C13-L21C23

so it missing parent, so named arg downgrade can't be applied as we don't know the position key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment