Skip to content

Generic/DisallowLongArray: fix undefined index when running fixer #1708

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

Merged

Conversation

jrfnl
Copy link
Contributor

@jrfnl jrfnl commented Oct 14, 2017

Came across this error when running fixer conflict checks for the various standards. (See #1645 (comment) )
Third fix in a series to fix the issues found.

Error encountered: Undefined index: in phpcs/src/Fixer.php on line 524

Error occurred when due to, for instance, a git merge conflict artifact, the array closer has not been determined.

Includes unit tests.

One of the already existing unit tests results has been adjusted. a found array keyword without parentheses was previously being fixed to short array syntax.
However, as this is "unfinished" code, it could just as easily have been the start of an array function call like array_merge(), making this a risky fix.

For this case as well as the new case, the error will still be reported, but the fixer will no longer run for these.

To reproduce/test: take the updated unit test file and just run the original sniff over it.

Came across this error when running fixer conflict checks for the various standards.

Error encountered: `Undefined index:  in phpcs/src/Fixer.php on line 524`

Error occurred when due to, for instance, a git merge conflict artifact, the array closer has not been determined.

Includes unit tests.

To reproduce/test: take the updated unit test file and just run the original sniff over it.
@jrfnl
Copy link
Contributor Author

jrfnl commented Nov 22, 2017

Rebased for merge conflicts & updated code style...

@jrfnl jrfnl force-pushed the feature/fix-generic-disallow-longarray branch from ed2f11f to 8d2a9dd Compare November 22, 2017 05:49
@gsherwood gsherwood modified the milestones: 3.3.0, 3.2.0 Nov 28, 2017
@gsherwood gsherwood merged commit 8d2a9dd into squizlabs:master Nov 28, 2017
@jrfnl jrfnl deleted the feature/fix-generic-disallow-longarray branch November 28, 2017 23:15
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.

2 participants