2022-10-30 12:21:41 +01:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* .php-cs-fixer.php
|
|
|
|
* Copyright (c) 2022 james@firefly-iii.org
|
|
|
|
*
|
|
|
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2022-12-29 19:41:57 +01:00
|
|
|
$current = __DIR__;
|
|
|
|
|
|
|
|
$paths = [
|
2023-06-21 12:34:58 +02:00
|
|
|
$current . '/../../app',
|
2023-12-20 19:39:53 +01:00
|
|
|
$current . '/../../config',
|
2023-12-20 19:41:37 +01:00
|
|
|
$current . '/../../database',
|
2023-12-20 19:45:12 +01:00
|
|
|
$current . '/../../routes',
|
|
|
|
$current . '/../../tests',
|
|
|
|
$current . '/../../resources/lang',
|
2022-12-29 19:41:57 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
$finder = PhpCsFixer\Finder::create()
|
|
|
|
->in($paths);
|
|
|
|
|
2022-10-30 12:21:41 +01:00
|
|
|
|
|
|
|
$config = new PhpCsFixer\Config();
|
|
|
|
return $config->setRules([
|
2023-12-20 19:35:52 +01:00
|
|
|
'no_unused_imports' => true,
|
|
|
|
'@PhpCsFixer' => true,
|
|
|
|
'@PHP83Migration' => true,
|
|
|
|
'@PhpCsFixer:risky' => true,
|
|
|
|
'@PSR12:risky' => true,
|
|
|
|
'declare_strict_types' => true,
|
|
|
|
'strict_param' => true,
|
|
|
|
'comment_to_phpdoc' => false, // breaks phpstan lines in combination with PHPStorm.
|
|
|
|
'array_syntax' => ['syntax' => 'short'],
|
|
|
|
'native_function_invocation' => false, // annoying
|
|
|
|
'php_unit_data_provider_name' => false, // bloody annoying long test names
|
|
|
|
'static_lambda' => false, // breaks the Response macro for API's.
|
|
|
|
'phpdoc_summary' => false, // annoying.
|
|
|
|
'single_space_around_construct' => [
|
|
|
|
'constructs_followed_by_a_single_space' => [
|
|
|
|
'protected',
|
|
|
|
],
|
|
|
|
],
|
|
|
|
'statement_indentation' => true,
|
2023-12-22 07:53:00 +01:00
|
|
|
'type_declaration_spaces' => true,
|
2023-12-20 19:35:52 +01:00
|
|
|
'cast_spaces' => false,
|
2023-12-21 04:42:39 +01:00
|
|
|
'binary_operator_spaces' => false,
|
2023-12-21 04:59:23 +01:00
|
|
|
'void_return' => true,
|
2023-06-21 12:34:58 +02:00
|
|
|
])
|
2023-03-18 14:47:35 +01:00
|
|
|
->setFinder($finder);
|