Skip to content

Conversation

aminin
Copy link

@aminin aminin commented Jun 29, 2016

The command

phpcs --standard=PSR2 --encoding=utf-8 -n -p -s --report=gitblame src/ 

produces warning

PHP Warning: str_repeat(): Second argument has to be greater than or equal to 0 in /home/anton/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Reports/VersionControl.php on line 244 

if the sniffed code contains a Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose error

@gsherwood
Copy link
Member

gsherwood commented Jun 29, 2016

The fix for this issue looks like it is just masking a bigger issue. The width calculations shouldn't make these values go negative at all, but I've been unable to replicate the problem so far so I can't investigate a fix just yet. But I will keep trying and then see if there is a bigger problem with the width calculation.

I can replicate with --report-width=70 on the sample code I'm using, so I'll take a look.

@gsherwood gsherwood changed the title fix str_repeat warning Version control reports can show notices when the report width is very small Jun 29, 2016
gsherwood added a commit that referenced this pull request Jun 29, 2016
…eport width is very small. Also added indication of fixable sources.
@gsherwood
Copy link
Member

There was a bigger problem with report width - the sources were not being truncated like they are in other reports. So I've fixed that, and a minor width issue, and added an indicator for which sources are fixable. Should be good now.

Thanks for reporting the problem.

@gsherwood gsherwood closed this Jun 29, 2016
@aminin aminin deleted the patch-1 branch July 1, 2016 09:01
jrfnl added a commit to jrfnl/PHP_CodeSniffer that referenced this pull request May 4, 2025
…tch-declaration PSR2/SwitchDeclaration: improve XML documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants