|
| 1 | +<?php |
| 2 | + |
| 3 | +$header = <<<'EOF' |
| 4 | +@package PHP Prefixer REST API CLI |
| 5 | +
|
| 6 | +@author Desarrollos Inteligentes Virtuales, SL. <team@div.com.es> |
| 7 | +@copyright Copyright (c)2019-2021 Desarrollos Inteligentes Virtuales, SL. All rights reserved. |
| 8 | +@license MIT |
| 9 | +
|
| 10 | +@see https://php-prefixer.com |
| 11 | +EOF; |
| 12 | + |
| 13 | +// Symfony PHP framework 5.4/.php-cs-fixer.dist.php |
| 14 | +// https://github.com/symfony/symfony/blob/5.4/.php-cs-fixer.dist.php |
| 15 | + |
| 16 | +// PHP CS Fixer 3.0.0 config. working with Laravel 8 / PHP8 |
| 17 | +// https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200#gistcomment-3749314 |
| 18 | + |
| 19 | +return (new PhpCsFixer\Config()) |
| 20 | + ->setRules([ |
| 21 | + '@PHP71Migration' => true, |
| 22 | + '@PHPUnit75Migration:risky' => true, |
| 23 | + '@Symfony' => true, |
| 24 | + '@Symfony:risky' => true, |
| 25 | + 'protected_to_private' => false, |
| 26 | + 'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => false], |
| 27 | + |
| 28 | + 'header_comment' => ['header' => $header], |
| 29 | + ]) |
| 30 | + ->setRiskyAllowed(true) |
| 31 | + ->setFinder( |
| 32 | + (new PhpCsFixer\Finder()) |
| 33 | + ->in(__DIR__.'/app') |
| 34 | + ->in(__DIR__.'/tests') |
| 35 | + ->append([__FILE__]) |
| 36 | + ->notPath('#/Fixtures/#') |
| 37 | + ->exclude([ |
| 38 | + // directories containing files with content that is autogenerated by `var_export`, which breaks CS in output code |
| 39 | + // fixture templates |
| 40 | + 'Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom', |
| 41 | + // resource templates |
| 42 | + 'Symfony/Bundle/FrameworkBundle/Resources/views/Form', |
| 43 | + // explicit trigger_error tests |
| 44 | + 'Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/', |
| 45 | + 'Symfony/Component/Intl/Resources/data/', |
| 46 | + ]) |
| 47 | + // Support for older PHPunit version |
| 48 | + ->notPath('Symfony/Bridge/PhpUnit/SymfonyTestsListener.php') |
| 49 | + ->notPath('#Symfony/Bridge/PhpUnit/.*Mock\.php#') |
| 50 | + ->notPath('#Symfony/Bridge/PhpUnit/.*Legacy#') |
| 51 | + // file content autogenerated by `var_export` |
| 52 | + ->notPath('Symfony/Component/Translation/Tests/fixtures/resources.php') |
| 53 | + // file content autogenerated by `VarExporter::export` |
| 54 | + ->notPath('Symfony/Component/Serializer/Tests/Fixtures/serializer.class.metadata.php') |
| 55 | + // test template |
| 56 | + ->notPath('Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php') |
| 57 | + // explicit trigger_error tests |
| 58 | + ->notPath('Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php') |
| 59 | + ) |
| 60 | + ->setCacheFile('.php-cs-fixer.cache') |
| 61 | +; |
0 commit comments