Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractArrayDeclarationSniff: extra defensive coding for live coding/parse errors #476

Merged
merged 1 commit into from
May 27, 2023

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented May 27, 2023

In case of live coding/an unfinished array, the PassedParameters::getParameters() will return an empty array (no items), while in reality, it couldn't be determined.

To prevent incorrect sniff results, it is better for the sniff to bow out early in those situations.
This prevents a "Trying to access array offset on value of type bool" PHP notice.

Fixed now.

Includes additional test.

…/parse errors

In case of live coding/an unfinished array, the `PassedParameters::getParameters()` will return an empty array (no items), while in reality, it couldn't be determined.

To prevent incorrect sniff results, it is better for the sniff to bow out early in those situations.
This prevents a "Trying to access array offset on value of type bool" PHP notice.

Fixed now.

Includes additional test.
@jrfnl jrfnl added this to the 1.0.6 milestone May 27, 2023
@jrfnl jrfnl merged commit bb9d361 into develop May 27, 2023
@jrfnl jrfnl deleted the feature/abstractarraydeclaration-bugfix branch May 27, 2023 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant