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

[cs] added inactive header comment rule #358

Closed

Conversation

connorhu
Copy link
Collaborator

This PR adds a header comment similar to the Symfony project. It is inactive because it generates a lot of noise and tasks when active. When touching a file it generates minimal noise and tasks when activated manually.

@connorhu connorhu force-pushed the feature/cs-header-comment branch from 6d9dae5 to e837bc8 Compare March 27, 2024 07:05
@thePanz thePanz force-pushed the feature/cs-header-comment branch from e837bc8 to c0ee566 Compare March 27, 2024 12:19
@thePanz
Copy link
Member

thePanz commented Mar 27, 2024

Should we enable it soon or later?
Would be cool to have a command to run that only on modified files on a PR

@connorhu
Copy link
Collaborator Author

Should we enable it soon or later?

Later. Sometime it duplicates a header comment so this generates a lot of unwanted noises and codes to fix.

Today I thought of such a solution:

<?php

/** @var PhpCsFixer\Config $config */
$config = require_once __DIR__.'/.php-cs-fixer.dist.php';

$config->setRules($config->getRules() + [
    'header_comment' => [
        'header' => <<<'EOF'
This file is part of the Symfony1 package.

(c) Fabien Potencier <[email protected]>

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF,
    ],
]);

return $config;

It's a solution where risky, task-generating, not-everywhere things can be turned on manually:
~/Applications/phpunit/php-cs-fixer-3.phar fix --config=.php-cs-fixer.header.php

@connorhu
Copy link
Collaborator Author

I close this for now. My other solution is enough for now.

@connorhu connorhu closed this Mar 27, 2024
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