Skip to content
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

[Question] Possible to ignore only one speciifc PSR12 rule? #3453

Open
Gabb1995 opened this issue Oct 14, 2021 · 2 comments · May be fixed by PHPCSStandards/PHP_CodeSniffer#35
Open

[Question] Possible to ignore only one speciifc PSR12 rule? #3453

Gabb1995 opened this issue Oct 14, 2021 · 2 comments · May be fixed by PHPCSStandards/PHP_CodeSniffer#35

Comments

@Gabb1995
Copy link

Running phpcbf for PSR12 I get:

<?php

declare(strict_types=1);

namespace App\Services;

use App\Entity\User;
use App\Entity\Car;

use function Service\api;

Which is correct by PSR12 Standard, unfortunately PHP-CS-FIXER do not fully support this yet and when I run both phpcbf and php-cs-fixer, php-cs-fixer is removing the blank line between the imports, and phpcbf is readding causing an issue.

Is it possible to ignore this specific rule (no blank lines between grouped imports)?
I checked from php-cs-fixer side but it would mean removing the no_extra_blank_lines fixer which would affect more than just this. Any help would be appreciated.

Related issue on php-cs-fixer: PHP-CS-Fixer/PHP-CS-Fixer#3582

@jrfnl
Copy link
Contributor

jrfnl commented Oct 14, 2021

@Gabb1995 At this time that's not possible, though there's been a PR open to allow for this for nearly two years already: #2729

Out of curiosity - why are you using both PHPCS as well as CS-Fixer ? PHPCS ships with the phpcbf tool, which allows you to autofix things (but based on the violations flagged by PHPCS, so there would be no conflicts).

@Gabb1995
Copy link
Author

We use php-cs-fixer with the symfony ruleset and some other specific rules.

Great answer here:
PHP-CS-Fixer/PHP-CS-Fixer#3459 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment