Skip to content

Version control reports can show notices when the report width is very small #1049

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

Closed
wants to merge 1 commit into from

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants