2015-03-24 16:36:00 +00:00
|
|
|
<?php
|
|
|
|
|
2017-09-08 14:50:13 +01:00
|
|
|
if (!file_exists(__DIR__.'/src')) {
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
2016-12-03 09:46:32 +00:00
|
|
|
return PhpCsFixer\Config::create()
|
2019-01-16 20:35:37 +00:00
|
|
|
->setRules([
|
2016-12-03 09:46:32 +00:00
|
|
|
'@Symfony' => true,
|
|
|
|
'@Symfony:risky' => true,
|
2019-08-02 14:23:07 +01:00
|
|
|
'@PHPUnit75Migration:risky' => true,
|
2019-08-04 17:55:16 +01:00
|
|
|
'php_unit_dedicate_assert' => ['target' => '5.6'],
|
2019-08-02 14:23:07 +01:00
|
|
|
'phpdoc_no_empty_return' => false, // triggers almost always false positive
|
2019-01-16 20:35:37 +00:00
|
|
|
'array_syntax' => ['syntax' => 'short'],
|
2018-10-02 12:58:25 +01:00
|
|
|
'fopen_flags' => false,
|
2018-07-26 10:03:18 +01:00
|
|
|
'ordered_imports' => true,
|
2019-08-13 21:27:05 +01:00
|
|
|
'phpdoc_trim_consecutive_blank_line_separation' => true,
|
|
|
|
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
|
2017-09-07 10:04:22 +01:00
|
|
|
'protected_to_private' => false,
|
2018-07-05 12:24:53 +01:00
|
|
|
// Part of @Symfony:risky in PHP-CS-Fixer 2.13.0. To be removed from the config file once upgrading
|
2019-06-13 11:34:15 +01:00
|
|
|
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced', 'strict' => true],
|
2018-10-09 00:34:45 +01:00
|
|
|
// Part of future @Symfony ruleset in PHP-CS-Fixer To be removed from the config file once upgrading
|
2019-01-16 20:35:37 +00:00
|
|
|
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
|
2019-09-10 10:15:55 +01:00
|
|
|
'combine_nested_dirname' => true,
|
2019-01-16 20:35:37 +00:00
|
|
|
])
|
2016-12-03 09:46:32 +00:00
|
|
|
->setRiskyAllowed(true)
|
|
|
|
->setFinder(
|
|
|
|
PhpCsFixer\Finder::create()
|
2017-01-20 15:16:44 +00:00
|
|
|
->in(__DIR__.'/src')
|
2019-01-16 20:35:37 +00:00
|
|
|
->append([__FILE__])
|
2019-08-13 21:27:05 +01:00
|
|
|
->notPath('#/Fixtures/#')
|
2019-01-16 20:35:37 +00:00
|
|
|
->exclude([
|
2015-03-24 21:20:39 +00:00
|
|
|
// directories containing files with content that is autogenerated by `var_export`, which breaks CS in output code
|
|
|
|
// fixture templates
|
2017-01-21 16:45:58 +00:00
|
|
|
'Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom',
|
2015-03-24 21:20:39 +00:00
|
|
|
// resource templates
|
2017-01-21 16:45:58 +00:00
|
|
|
'Symfony/Bundle/FrameworkBundle/Resources/views/Form',
|
2018-07-05 11:52:40 +01:00
|
|
|
// explicit trigger_error tests
|
|
|
|
'Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/',
|
2019-01-16 20:35:37 +00:00
|
|
|
])
|
2018-07-05 11:52:40 +01:00
|
|
|
// Support for older PHPunit version
|
|
|
|
->notPath('Symfony/Bridge/PhpUnit/SymfonyTestsListener.php')
|
2019-08-13 21:27:05 +01:00
|
|
|
->notPath('#Symfony/Bridge/PhpUnit/.*Mock\.php#')
|
|
|
|
->notPath('#Symfony/Bridge/PhpUnit/.*Legacy#')
|
2015-03-24 21:20:39 +00:00
|
|
|
// file content autogenerated by `var_export`
|
2017-01-21 16:45:58 +00:00
|
|
|
->notPath('Symfony/Component/Translation/Tests/fixtures/resources.php')
|
2015-03-24 21:20:39 +00:00
|
|
|
// test template
|
2017-01-21 16:45:58 +00:00
|
|
|
->notPath('Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php')
|
2018-01-01 22:05:14 +00:00
|
|
|
// explicit trigger_error tests
|
|
|
|
->notPath('Symfony/Component/Debug/Tests/DebugClassLoaderTest.php')
|
2019-08-06 11:43:51 +01:00
|
|
|
->notPath('Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php')
|
2015-03-24 21:20:39 +00:00
|
|
|
)
|
2015-03-24 16:36:00 +00:00
|
|
|
;
|