Skip to content

[fix] skip already dim fetch variable on OrdSingleByteRector#7681

Merged
TomasVotruba merged 1 commit into
mainfrom
tv-ord-fix
Nov 28, 2025
Merged

[fix] skip already dim fetch variable on OrdSingleByteRector#7681
TomasVotruba merged 1 commit into
mainfrom
tv-ord-fix

Conversation

@TomasVotruba
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
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 👌

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 3, 2026

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants