1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 21:22:40 +00:00

Use a more specific house style

This commit is contained in:
J. King 2020-03-01 15:15:57 -05:00
parent 3aa17ee70f
commit a7f69c845f

View file

@ -3,6 +3,7 @@
* Copyright 2017 J. King, Dustin Wilson et al. * Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */ * See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace JKingWeb\Arsse; namespace JKingWeb\Arsse;
const BASE = __DIR__.DIRECTORY_SEPARATOR; const BASE = __DIR__.DIRECTORY_SEPARATOR;
@ -15,7 +16,56 @@ $paths = [
BASE."tests", BASE."tests",
]; ];
$rules = [ $rules = [
// house rules where PSR series is silent
'align_multiline_comment' => ['comment_type' => "phpdocs_only"],
'array_syntax' => ['syntax' => "short"],
'binary_operator_spaces' => [
'default' => "single_space",
'operators' => ['=>' => "align_single_space"],
],
'cast_spaces' => ['space' => "single"],
'concat_space' => ['spacing' => "none"],
'declare_equal_normalize' => ['space' => "none"],
'function_typehint_space' => true,
'list_syntax' => ['syntax' => "short"],
'lowercase_cast' => true,
'lowercase_static_reference' => true,
'magic_constant_casing' => true,
'magic_method_casing' => true,
'modernize_types_casting' => true,
'native_function_casing' => true,
'native_function_type_declaration_casing' => true,
'new_with_braces' => false, // no option to specify absence of braces
'no_alternative_syntax' => true,
'no_binary_string' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true, // this could probably use more configuration
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => ['use' => "echo"],
'no_short_bool_cast' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_curly_braces' => true,
'no_unused_imports' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'normalize_index_brace' => true,
'object_operator_without_whitespace' => true,
'pow_to_exponentiation' => true,
'return_type_declaration' => ['space_before' => "none"],
'set_type_to_cast' => true,
'short_scalar_cast' => true,
'standardize_not_equals' => true,
'trailing_comma_in_multiline_array' => true,
'unary_operator_spaces' => true,
'yoda_style' => false,
// PSR standard to apply
'@PSR2' => true, '@PSR2' => true,
// house exceptions to PSR rules
'braces' => ['position_after_functions_and_oop_constructs' => "same"], 'braces' => ['position_after_functions_and_oop_constructs' => "same"],
'function_declaration' => ['closure_function_spacing' => "none"], 'function_declaration' => ['closure_function_spacing' => "none"],
]; ];
@ -28,4 +78,4 @@ foreach ($paths as $path) {
$finder = $finder->in($path); $finder = $finder->in($path);
} }
} }
return \PhpCsFixer\Config::create()->setRules($rules)->setFinder($finder); return \PhpCsFixer\Config::create()->setRiskyAllowed(true)->setRules($rules)->setFinder($finder);