Skip to content

[CodeQuality] Skip fluent call from FuncCall crash on OptionalParametersAfterRequiredRector#4533

Closed
samsonasik wants to merge 8 commits intomainfrom
skip-fluent
Closed

[CodeQuality] Skip fluent call from FuncCall crash on OptionalParametersAfterRequiredRector#4533
samsonasik wants to merge 8 commits intomainfrom
skip-fluent

Conversation

@samsonasik
Copy link
Copy Markdown
Member

@samsonasik samsonasik commented Jul 18, 2023

@samsonasik samsonasik requested a review from TomasVotruba as a code owner July 18, 2023 00:58
@samsonasik
Copy link
Copy Markdown
Member Author

@Kauto this should fix rectorphp/rector#8063, I tried in getrector.org server :)

@samsonasik
Copy link
Copy Markdown
Member Author

@TomasVotruba the following use case need to be covered 8009b39

final class UpdateMethodCallByFluent
{
    public function run($optional = 1, $required)
    {
        return $this;
    }

    public function execute()
    {
    }

    public function process()
    {
        $this->run(1, 5)
             ->execute();
    }
}

The original functionality actually not working yet for above case even the hack reverted.

@samsonasik samsonasik changed the title [CodeQuality] Skip fluent call on OptionalParametersAfterRequiredRector [CodeQuality] Skip fluent call from FuncCall on OptionalParametersAfterRequiredRector Jul 18, 2023
@samsonasik
Copy link
Copy Markdown
Member Author

@TomasVotruba it seems actually working on proper fluent call return $this

af5c351

👍

@samsonasik
Copy link
Copy Markdown
Member Author

The buggy part will be on second part as fluent:

final class UpdateMethodCallByFluent2
{
    public function execute()
    {
        return $this;
    }

    public function run($optional = 1, $required)
    {
        return $this;
    }

    public function process()
    {
        $this->execute()
             ->run(1, 5);
    }
}

@samsonasik
Copy link
Copy Markdown
Member Author

Really unsure how to cover this, some process probably overlapped when tested in server

https://getrector.com/demo/576513b9-85eb-48d8-88db-1e3507857c19

@TomasVotruba probably the best way is to extends PHPStan printer ?

@samsonasik samsonasik changed the title [CodeQuality] Skip fluent call from FuncCall on OptionalParametersAfterRequiredRector [CodeQuality] Skip fluent call from FuncCall crash on OptionalParametersAfterRequiredRector Jul 18, 2023
@TomasVotruba
Copy link
Copy Markdown
Member

TomasVotruba commented Jul 18, 2023

Really unsure how to cover this, some process probably overlapped when tested in server

It might need some cache clearing, e.g. /tmp/rector and /tmp/phpstan

@samsonasik
Copy link
Copy Markdown
Member Author

@TomasVotruba I tried that, not working, the issue is happen only on fluent call:

@samsonasik
Copy link
Copy Markdown
Member Author

@samsonasik samsonasik closed this Aug 5, 2023
@samsonasik samsonasik deleted the skip-fluent branch August 5, 2023 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Call to undefined method BetterStandardPrinter::pPHPStan_Node_AlwaysRememberedExpr()

3 participants