Skip to content

StrictArrayParamDimFetchRector: Skip objects#4907

Merged
samsonasik merged 3 commits intorectorphp:mainfrom
staabm:skip-obj
Sep 4, 2023
Merged

StrictArrayParamDimFetchRector: Skip objects#4907
samsonasik merged 3 commits intorectorphp:mainfrom
staabm:skip-obj

Conversation

@staabm
Copy link
Copy Markdown
Contributor

@staabm staabm commented Sep 4, 2023

No description provided.

@staabm staabm requested a review from TomasVotruba as a code owner September 4, 2023 10:06
{
$item->doSomething();

return $item['name'];
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might be a object which implements ArrayAccess and therefore has a array-dim-fetch

}

if ($nodeToCheck instanceof Node\Expr\MethodCall && $this->isName($nodeToCheck->var, $paramName)) {
return true;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$nodeToCheck->var can be not variable, so better to check $nodeToCheck->var instanceof Node\Expr\Variable too

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@staabm staabm marked this pull request as draft September 4, 2023 10:28
@staabm staabm marked this pull request as ready for review September 4, 2023 10:29
Copy link
Copy Markdown
Member

@samsonasik samsonasik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets give it a try, thank you @staabm

@samsonasik samsonasik merged commit 5919201 into rectorphp:main Sep 4, 2023
@staabm staabm deleted the skip-obj branch September 4, 2023 10:42
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.

2 participants