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

feat: php cs fix config #32

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

/** @var $fixerConfig \PhpCsFixer\Config */
return $fixerConfig = require __DIR__. '/vendor/whatwedo/php-coding-standard/config/phpcsfixer-symfony.php';



17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,23 @@ For other configuration options, check out [Simplify/EasyCodingStandard](https:/
* [slevomat/coding-standard](https://github.com/slevomat/coding-standard)


## PHP CS Fixer integration (experimental)

copy the the file [.php-cs-fixer.dist.php](.php-cs-fixer.dist.php) to your project root.

use `vendor/bin/php-cs-fixer check`y


```php
<?php

/** @var $fixerConfig \PhpCsFixer\Config */
return $fixerConfig = require __DIR__. '/vendor/whatwedo/php-coding-standard/config/phpcsfixer-symfony.php';

```



## License

This bundle is under the MIT license. See the complete license in the bundle: [LICENSE](LICENSE)
30 changes: 30 additions & 0 deletions config/phpcsfixer-symfony.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

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

$fixers = [
];

$fixers = array_merge(
iterator_to_array(new whatwedo\PhpCodingStandard\Fixers()),
iterator_to_array(new PhpCsFixerCustomFixers\Fixers()),
);

return (new PhpCsFixer\Config())
->registerCustomFixers($fixers)
->setRules([
'@Symfony' => true,
whatwedo\PhpCodingStandard\Fixer\DumpFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\NoDoctrineMigrationsGeneratedCommentFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\NoImportFromGlobalNamespaceFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\NoNullableBooleanTypeFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\NoPhpStormGeneratedCommentFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\PhpdocSelfAccessorFixer::name() => true,
])
->setRiskyAllowed(true)
->setFinder($finder)

;