Files
FOSSBilling/.php-cs-fixer.dist.php
T
2025-01-23 15:11:53 -08:00

48 lines
2.1 KiB
PHP

<?php
/**
* Copyright 2022-2025 FOSSBilling
* Copyright 2011-2021 BoxBilling, Inc.
* SPDX-License-Identifier: Apache-2.0
*
* @copyright FOSSBilling (https://www.fossbilling.org)
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache-2.0
*/
if (!file_exists(__DIR__ . '/src')) {
exit(0);
}
return (new PhpCsFixer\Config())
->setRules([
'@PHP84Migration' => true,
'@Symfony' => true,
'concat_space' => ['spacing' => 'one'],
'protected_to_private' => false,
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false], // Enforce non-Yoda style.
'blank_line_before_statement' => ['statements' => ['break', 'continue', 'return', 'throw', 'try']], // Removed 'declare' from the default list.
/* Risky */
'get_class_to_class_keyword' => true, // Risky if the get_class function is overridden. In our case, it's not.
'dir_constant' => true, // Risky when the function dirname is overridden. In our case, it's not.
'array_push' => true, // Risky when the function array_push is overridden. In our case, it's not.
'no_useless_sprintf' => true, // Risky when the function sprintf is overridden. In our case, it's not.
'php_unit_construct' => true, // https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/rules/php_unit/php_unit_construct.rst
'php_unit_mock_short_will_return' => true, // https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/rules/php_unit/php_unit_mock_short_will_return.rst
'no_homoglyph_names' => true, // https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/rules/naming/no_homoglyph_names.rst
])
->setRiskyAllowed(true)
->setFinder(
(new PhpCsFixer\Finder())
->in([__DIR__ . '/src', __DIR__ . '/tests', __DIR__ . '/tests-legacy'])
->exclude([
'data',
'locale',
'themes',
'vendor',
])
->notPath(
'config-sample.php'
)
)
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect());