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

Remove ECS in favor of PHPCSFixer #1176

Open
wants to merge 4 commits into
base: 2.x
Choose a base branch
from
Open

Remove ECS in favor of PHPCSFixer #1176

wants to merge 4 commits into from

Conversation

chalasr
Copy link
Collaborator

@chalasr chalasr commented Dec 3, 2023

No description provided.

.github/workflows/coding-standards.yml Show resolved Hide resolved
.github/workflows/coding-standards.yml Show resolved Hide resolved
composer require rector/rector symplify/easy-coding-standard --dev
mkdir -p tools/php-cs-fixer tools/rector
composer require --working-dir=tools/php-cs-fixer friendsofphp/php-cs-fixer --dev
composer require rector/rector --dev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this use case I would recommend using composer-bin-plugin with ramsey/install:

            -   name: Install PHP-CS-Fixer Composer bin dependencies
                uses: ramsey/composer-install@v2
                with:
                    working-directory: vendor-bin/php-cs-fixer

This would have three advantages:

  • You can easily install the tool locally to run it locally too.
  • The installation of the deps does not require any dependency resolution on Composer's end and the download will be cached.
  • Since those are locked dependencies, you can use dependabot to periodically upgrade them:
    -   package-ecosystem: "composer"
        directory: "vendor-bin/*/"
        schedule:
            interval: "weekly"
        groups:
            dependencies:
                patterns:
                    - "*"

I would say though for rector I put a * as a dependency to upgrade whenever possible.

Erratum as I see you committed tools/php-cs-fixer/composer.json:

.github/workflows/coding-standards.yml Outdated Show resolved Hide resolved

- name: CONDING STANDARDS (RECTOR)
run: |
vendor/bin/rector process --ansi --dry-run --xdebug
tools/rector/vendor/bin/rector process . --ansi --dry-run --xdebug
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it running with Xdebgu?


$finder = PhpCsFixer\Finder::create()->in([__DIR__]);

return (new PhpCsFixer\Config())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you feel like it: https://github.com/theofidry/php-cs-fixer-config

Or alternatively create your own, it's relatively easy.

'array_syntax' => ['syntax' => 'short'],
'phpdoc_scalar' => false,
])
->setUsingCache(false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no cache? Personally I like to use it but I put the output in a dist/ directory

Co-authored-by: Théo FIDRY <[email protected]>
@chalasr chalasr mentioned this pull request Dec 6, 2023
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