Skip to content

[Scoped] Fix scoped build for casted array_key_last#1475

Merged
samsonasik merged 1 commit intomainfrom
fix-scoped-build-array-key-last
Dec 13, 2021
Merged

[Scoped] Fix scoped build for casted array_key_last#1475
samsonasik merged 1 commit intomainfrom
fix-scoped-build-array-key-last

Conversation

@samsonasik
Copy link
Copy Markdown
Member

@samsonasik samsonasik commented Dec 13, 2021

Fix for error:

Parse error: rector-prefixed-downgraded/rules/Php80/Rector/Class_/StringableForToStringRector.php:114
    112|         $hasReturn = $this->betterNodeFinder->hasInstancesOfInFunctionLikeScoped($toStringClassMethod, \PhpParser\Node\Stmt\Return_::class);
    113|         if (!$hasReturn) {
  > 114|             \end((array) $toStringClassMethod->stmts);
    115|             $lastKey = \key((array) $toStringClassMethod->stmts);

ref https://github.com/rectorphp/rector-src/runs/4505677100?check_suite_focus=true#step:14:80

ref https://github.com/rectorphp/rector-src/pull/1473/files#r767706986

The DowngradeArrayKeyFirstLastRector need to updated next to adapt its condition.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant