Skip to content

Conversation

@TomasVotruba
Copy link
Member

@TomasVotruba TomasVotruba commented Nov 28, 2025

@TomasVotruba TomasVotruba changed the title skip already dim fetch variable on OrdSingleByteRector [fix] skip already dim fetch variable on OrdSingleByteRector Nov 28, 2025
@TomasVotruba TomasVotruba merged commit 0221a95 into main Nov 28, 2025
55 checks passed
@TomasVotruba TomasVotruba deleted the tv-ord-fix branch November 28, 2025 22:34
$args = $node->getArgs();
$firstArg = $args[0];

if (! isset($node->args[0])) {
Copy link
Member

Choose a reason for hiding this comment

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

isset is needed in case someone for whatever doesn't have argument, or have remove argument via custom rule, this will cause error undefined index 0 and error:

Trying to get property 'value' of non-object

in php 7.4, it just warning, but not error

https://3v4l.org/batdI#v7.4.33

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

I see. Didn't know older Php version allow less args. Thanks 👌

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.

Incorrect behavior of OrdSingleByteRector OrdSingleByteRector rule replaces parameter when it shouldn't

3 participants