Skip to content

Generic/MultipleStatementAlignment: fix fatal error #1716

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

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) )
Eighth fix in a series to fix the issues found.

In certain cases, it was possible for the $expected padding to become less than zero, leading to the following fatal error during fixing:
str_repeat(): Second argument has to be greater than or equal to 0 in phpcs/src/Standards/Generic/Sniffs/Formatting/MultipleStatementAlignmentSniff.php on line 293

This PR fixes that.

Includes unit tests.

@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-multistatementalign-fixer-fatal branch from c87c3c2 to fb90c4f Compare November 22, 2017 06:22
In certain cases, it was possible for the `$expected` padding to become less than zero, leading to the following fatal error during fixing:
`str_repeat(): Second argument has to be greater than or equal to 0 in phpcs/src/Standards/Generic/Sniffs/Formatting/MultipleStatementAlignmentSniff.php on line 293`

This PR fixes that.

Includes unit tests.
@jrfnl jrfnl force-pushed the feature/fix-generic-multistatementalign-fixer-fatal branch from fb90c4f to a69c478 Compare November 26, 2017 03:18
@gsherwood gsherwood added this to the 3.2.0 milestone Nov 28, 2017
@gsherwood gsherwood merged commit a69c478 into squizlabs:master Nov 28, 2017
@jrfnl jrfnl deleted the feature/fix-generic-multistatementalign-fixer-fatal branch November 28, 2017 23:18
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