Skip to content

Remove ECS in favor of PHPCSFixer#1176

Open
chalasr wants to merge 4 commits intolexik:2.xfrom
chalasr:rm-ecs
Open

Remove ECS in favor of PHPCSFixer#1176
chalasr wants to merge 4 commits intolexik:2.xfrom
chalasr:rm-ecs

Conversation

@chalasr
Copy link
Collaborator

@chalasr chalasr commented Dec 3, 2023

No description provided.

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:

- 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 <5175937+theofidry@users.noreply.github.com>
@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