Skip to content

PEAR/FunctionDeclaration: fix undefined offset error #1713

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 15, 2017

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

For a JS function declared at the very top of the file, there may not be a token on a previous line.

Always moving the pointer one forward at the end of the loop prevents an undefined offset -1 error.

To reproduce the issue, run:
phpcbf -p -s --standard=Squiz ./src/Standards/Squiz/Tests/Functions/MultiLineFunctionDeclarationUnitTest.js -vv

For a JS function declared at the very top of the file, there may not be a token on a previous line.

Always moving the pointer one forward at the end of the loop prevents an `undefined offset -1` error.
@gsherwood gsherwood modified the milestones: 3.3.0, 3.2.0 Nov 28, 2017
@gsherwood gsherwood merged commit cbd2cf6 into squizlabs:master Nov 28, 2017
@jrfnl jrfnl deleted the feature/fix-pear-function-declaration-1 branch November 28, 2017 23:16
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