Bump minimal php-cs-fixer version to 2.13.0. Add additional rules.

This commit is contained in:
ErickSkrauch 2019-02-23 02:05:20 +03:00
parent 08483a26e2
commit 714a38d53e
4 changed files with 62 additions and 4 deletions

View File

@ -17,7 +17,7 @@
"type": "library", "type": "library",
"require": { "require": {
"php": "^7.0", "php": "^7.0",
"friendsofphp/php-cs-fixer": "^2.12.2" "friendsofphp/php-cs-fixer": "^2.13.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^6.5.1" "phpunit/phpunit": "^6.5.1"

2
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "80849b188628ffdf06b4ffc4be3edb84", "content-hash": "0d399f36e24f93c2b3ce717b19cfa1ac",
"packages": [ "packages": [
{ {
"name": "composer/semver", "name": "composer/semver",

View File

@ -7,6 +7,7 @@ class Rules {
private static $rules = [ private static $rules = [
'@PSR2' => true, '@PSR2' => true,
'array_indentation' => true,
'array_syntax' => [ 'array_syntax' => [
'syntax' => 'short', 'syntax' => 'short',
], ],
@ -20,41 +21,98 @@ class Rules {
'class_attributes_separation' => [ 'class_attributes_separation' => [
'elements' => ['method', 'property'], 'elements' => ['method', 'property'],
], ],
'combine_consecutive_issets' => true,
'combine_nested_dirname' => true,
'compact_nullable_typehint' => true, 'compact_nullable_typehint' => true,
'concat_space' => [ 'concat_space' => [
'spacing' => 'one', 'spacing' => 'one',
], ],
'declare_equal_normalize' => true, 'declare_equal_normalize' => true,
'dir_constant' => true,
'ereg_to_preg' => true,
'explicit_indirect_variable' => true,
'explicit_string_variable' => true, // Should be configurable to choose between ${var} and {$var}
'function_declaration' => [ 'function_declaration' => [
'closure_function_spacing' => 'none', 'closure_function_spacing' => 'none',
], ],
'function_to_constant' => true, 'function_to_constant' => true,
'implode_call' => true,
'include' => true, 'include' => true,
'is_null' => true,
'linebreak_after_opening_tag' => true, 'linebreak_after_opening_tag' => true,
'list_syntax' => [
'syntax' => 'short',
],
'logical_operators' => true,
'lowercase_cast' => true,
'lowercase_static_reference' => true,
'magic_constant_casing' => true,
'magic_method_casing' => true,
'method_chaining_indentation' => true, 'method_chaining_indentation' => true,
'modernize_types_casting' => true, 'modernize_types_casting' => true,
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'native_function_casing' => true,
'no_alternative_syntax' => true,
'no_homoglyph_names' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'no_php4_constructor' => true,
'no_short_bool_cast' => true, 'no_short_bool_cast' => true,
'no_spaces_around_offset' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_singleline_array' => true, 'no_trailing_comma_in_singleline_array' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_final_method' => true, 'no_unneeded_final_method' => true,
'no_unused_imports' => true, 'no_unused_imports' => true,
'no_useless_else' => true, 'no_useless_else' => true,
'no_useless_return' => true,
'no_whitespace_before_comma_in_array' => true, 'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true, 'no_whitespace_in_blank_line' => true,
'non_printable_character' => [ 'non_printable_character' => [
'use_escape_sequences_in_strings' => true, 'use_escape_sequences_in_strings' => true,
], ],
'normalize_index_brace' => true,
'object_operator_without_whitespace' => true, 'object_operator_without_whitespace' => true,
'ordered_class_elements' => true, 'ordered_class_elements' => true,
'ordered_imports' => true, 'ordered_imports' => true,
'random_api_migration' => true, 'php_unit_construct' => true,
'php_unit_expectation' => true,
'php_unit_method_casing' => true,
'php_unit_mock' => true,
'php_unit_namespaced' => true,
'php_unit_set_up_tear_down_visibility' => true,
'php_unit_strict' => true,
'pow_to_exponentiation' => true,
'psr4' => true,
'return_assignment' => true,
'random_api_migration' => [
'replacements' => [
'getrandmax' => 'mt_getrandmax',
'rand' => 'random_int',
'srand' => 'mt_srand',
],
],
'return_type_declaration' => [ 'return_type_declaration' => [
'space_before' => 'none', 'space_before' => 'none',
], ],
'self_accessor' => true,
'semicolon_after_instruction' => true,
'set_type_to_cast' => true,
'short_scalar_cast' => true,
'single_quote' => true, 'single_quote' => true,
'space_after_semicolon' => true,
'standardize_increment' => true,
'standardize_not_equals' => true,
'strict_comparison' => true, 'strict_comparison' => true,
'ternary_operator_spaces' => true, 'ternary_operator_spaces' => true,
'ternary_to_null_coalescing' => true, 'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline_array' => true, 'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => [ 'visibility_required' => [
'elements' => ['property', 'method', 'const'], 'elements' => ['property', 'method', 'const'],
], ],

View File

@ -36,7 +36,7 @@ final class BlankLineBeforeReturnFixerTest extends AbstractFixerTestCase {
public function provideFixCases() { public function provideFixCases() {
$cases = []; $cases = [];
$cases[] = [ $cases[] = [
'$a = $a; '$a = $a;
return $a; return $a;
', ',
]; ];