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

Update recipe for PHP-CS-Fixer 2.19.0 and 3.0.0 #942

Merged
7 commits merged into from May 6, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions friendsofphp/php-cs-fixer/2.19/.php-cs-fixer.dist.php
@@ -0,0 +1,13 @@
<?php

$finder = (new PhpCsFixer\Finder())
->in(__DIR__)
->exclude('var')
;

return (new PhpCsFixer\Config())
->setRules([
'@Symfony' => true,
])
->setFinder($finder)
OskarStark marked this conversation as resolved.
Show resolved Hide resolved
;
10 changes: 10 additions & 0 deletions friendsofphp/php-cs-fixer/2.19/manifest.json
@@ -0,0 +1,10 @@
{
"aliases": ["cs-fixer", "php-cs-fixer"],
"copy-from-recipe": {
".php-cs-fixer.dist.php": ".php-cs-fixer.dist.php"
},
"gitignore": [
"/.php-cs-fixer.php",
"/.php_cs.cache"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nor sure about that @keradus

Copy link
Member

Choose a reason for hiding this comment

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

PHP CS Fixer uses:

  • .php_cs.cache for 2.x
  • .php-cs-fixer.cache for 3.x

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah so we need to keep .php_cs.cache for 2.x and add another recipe for 3.x with .php-cs-fixer.cache ?

Copy link
Member

Choose a reason for hiding this comment

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

yes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok done

Copy link
Member

Choose a reason for hiding this comment

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

The name is configurable though. I'd suggest to configure PHP CS Fixer to use the new cache file name so we don't need different recipes for 2.19 and 3.0.

Copy link
Contributor

Choose a reason for hiding this comment

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

@derrabus good point for maint, but wouldnt it be best to stick with the conventions used in 3.0? thinking in terms of DX and consistency - e.g. maker-bundle will use php-cs-fixer 3.0 but does not depend on recipes. However in our test cases, we do depend on recipes and I can see the potential of the bundle vs tests being out of sync.

Another use case would be for other bundles e.g. symfonycasts || knplabs that try to stick as close as possible Symfony conventions. It would be nice to keep php-cs-fixer's configuration && .gitignore inline with Symfony w/o having to use custom naming conventions.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe sth like this: https://github.com/symfony/recipes/pull/942/files#r625770976

then, 2.x and 3.x will use same name of cache file
(and that line can be removed on 3.x, as .php-cs-fixer.cache is default name on 3.x)

Copy link
Member

Choose a reason for hiding this comment

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

@jrushlow I don't quite get why MakerBundle would have an opinion on how PHP CS Fixer's cache file is named.

What @keradus suggested is exactly what I meant. The 2.19 release prepares the application for the transition to 3.0. If we can configure CS Fixer 2.19 to behave like 3.0, we should do that.

derrabus marked this conversation as resolved.
Show resolved Hide resolved
OskarStark marked this conversation as resolved.
Show resolved Hide resolved
]
}
13 changes: 13 additions & 0 deletions friendsofphp/php-cs-fixer/3.0/.php-cs-fixer.dist.php
@@ -0,0 +1,13 @@
<?php

$finder = (new PhpCsFixer\Finder())
->in(__DIR__)
->exclude('var')
;

return (new PhpCsFixer\Config())
->setRules([
'@Symfony' => true,
])
->setFinder($finder)
;
10 changes: 10 additions & 0 deletions friendsofphp/php-cs-fixer/3.0/manifest.json
@@ -0,0 +1,10 @@
{
"aliases": ["cs-fixer", "php-cs-fixer"],
"copy-from-recipe": {
".php-cs-fixer.dist.php": ".php-cs-fixer.dist.php"
},
"gitignore": [
"/.php-cs-fixer.php",
"/.php-cs-fixer.cache"
]
}