map/.php-cs-fixer.php

78 lines
2.4 KiB
PHP
Raw Normal View History

<?php declare(strict_types=1);
/*
* Copyright (c) 2020 https://rewiv.com sikofitt@gmail.com
*
* This file is a part of Olive BBS
*
* This Source Code Form is subject to the
* terms of the Mozilla Public License, v. 2.0.
*
* If a copy of the MPL was not distributed with this file,
* You can obtain one at https://mozilla.org/MPL/2.0/.
*
* ___ ___ ___
* ( ).-. ( ) ( )
* .--. | |( __)___ ___ .--. | |.-. | |.-. .--.
* / \| |(''"( )( / \| / \| / \ / _ \
* | .-. | | | | | | | | .-. | .-. | .-. |. .' `. ;
* | | | | | | | | | | | | | | | | | | | || ' | |
* | | | | | | | | | | | |/ | | | | | | |_\_`.(___)
* | | | | | | | | | | | ' _.| | | | | | ( ). '.
* | ' | | | | | ' ' ; | .'.-| ' | | ' | || | `\ |
* ' `-' | | | | \ `' /' `-' ' `-' ;' `-' ; ; '._,' '
* `.__.(___(___) '_.' `.__.' `.__. `.__. '.___.'
*
*/
$header = '';
if (file_exists(__DIR__.'/header.txt')) {
$header = file_get_contents('header.txt');
}
return (new \PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'@PHP80Migration' => true,
'@PHP80Migration:risky' => true,
'@PHP81Migration' => true,
'header_comment' => ['header' => $header],
'ordered_class_elements' => true,
'ordered_imports' => true,
'no_mixed_echo_print' => ['use' => 'print'],
'strict_param' => true,
'strict_comparison' => true,
'single_import_per_statement' => false,
'phpdoc_order' => true,
'array_syntax' => ['syntax' => 'short'],
'phpdoc_add_missing_param_annotation' => true,
'psr_autoloading' => true,
'phpdoc_var_without_name' => false,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'no_extra_blank_lines' => [
'tokens' => [
'break',
'continue',
'extra',
'return',
'throw',
'parenthesis_brace_block',
'square_brace_block',
'curly_brace_block',
],
],
])->setFinder(
(new \PhpCsFixer\Finder())
->ignoreDotFiles(true)
->ignoreVCS(true)
->name('*.php')
->in([
'src',
'tests',
__DIR__,
])
);