FriendsOfSymfony1 / symfony1

[DEPRECATED -- Use Symfony instead] Fork of symfony 1.4 with DIC, form enhancements, latest Swiftmailer, better performance, composer compatible and PHP 8 support
https://symfony.com/legacy
MIT License
337 stars 175 forks source link

[cs] added inactive header comment rule #358

Closed connorhu closed 3 months ago

connorhu commented 3 months ago

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.

thePanz commented 3 months ago

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 commented 3 months ago

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 <fabien@symfony.com>

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 commented 3 months ago

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