-
Notifications
You must be signed in to change notification settings - Fork 24.4k
[8.x] Fixing "Line exceeds 120 characters" in TrustProxies to comply with PSR-2 #5677
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
To comply with PSR-2
2ffadae
to
1bf0d05
Compare
👎 PSR-2 only recommends doing that where it makes sense to. In this instance, it doesn't make sense. |
@GrahamCampbell why doesn't it make sense ? this is the only one error that could be avoided in the entire project using phpcsfixer, and you have to admit the line is quite long ? |
I do agree that seeing the values below each other makes it a bit more readable. |
No, it couldn't. Automated fixing tools cannot properly fix overlength lines. StyleCI is already enabled on this repo to keep the CS in check, automatically. |
@GrahamCampbell sorry let me rephrase that : this is the only error that needs a manual fix on the entire project to be clean on phpcsfixer with PSR2 settings in a new project. We are creating new projects every week and everytime we need to fix this line manually, I might not be the only one so instead of juste writing my own phpcs.xml file I tried to fix the issue at the source :) |
I'd of course recommend using using StyleCI on new projects. Laravel apps come with config out of the box, and fixing line length artificially across projects adds little value compared to spending developer time writing new features and fixing bugs. Just let automation fix what it can fix automatically, and forget the rest, especially when it is not a |
I like this PR. More for the fact the line is significantly more readable over the current version. I agree with Graham's explanation that 120 characters is a recommendation and not a requirement, but in the future should any other headers need to be added here by default, this PR would make it easier. Just my $0.02. |
Sure, 👍 on this PR. My comments were general, addressing the use case of the PR author. |
When installing a new project with
laravel new
and installingsquizlabs/php_codesniffer
, the projects has one error that cannot be fixed automatically byphpcbf
because theapp/Http/Middleware/TrustProxies.php
class has a line of more than 120 characters.Laravel is supposed to follow the PSR-2 conventions : https://laravel.com/docs/8.x/contributions#coding-style
To reproduce :
laravel new test-coding-standards cd test-coding-standards composer require squizlabs/php_codesniffer vi phpcs.xml
Small phpcs.xml file :
And run
vendor/bin/phpcs
, here is the output :