mirror of
https://github.com/elyby/php-code-style.git
synced 2024-12-22 04:59:57 +05:30
Upgrade ruleset up to PHP-CS-Fixer v3.48
This commit is contained in:
parent
259b5cc89c
commit
30b1946616
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -48,4 +48,4 @@ jobs:
|
|||||||
|
|
||||||
- name: PHP-CS-Fixer
|
- name: PHP-CS-Fixer
|
||||||
if: matrix.php-versions == '8.1'
|
if: matrix.php-versions == '8.1'
|
||||||
run: vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr
|
run: vendor/bin/php-cs-fixer check --format=checkstyle | cs2pr
|
||||||
|
13
CHANGELOG.md
13
CHANGELOG.md
@ -5,6 +5,19 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|||||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Added
|
||||||
|
- `align_multiline_comment` fixer.
|
||||||
|
- `nullable_type_declaration` fixer.
|
||||||
|
- `php_unit_data_provider_return_type` fixer.
|
||||||
|
- `attribute_empty_parentheses` fixer.
|
||||||
|
- `numeric_literal_separator` fixer.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Replace `compact_nullable_typehint` with `compact_nullable_type_declaration` (deprecated).
|
||||||
|
- Replace `curly_braces_position` with `braces_position` (deprecated).
|
||||||
|
- Replace `function_typehint_space` with `type_declaration_spaces` (deprecated).
|
||||||
|
- Replace `native_function_type_declaration_casing` with `native_type_declaration_casing` (deprecated).
|
||||||
|
- Replace `new_with_braces` with `new_with_parentheses` (deprecated).
|
||||||
|
|
||||||
## [1.0.1] - 2023-07-21
|
## [1.0.1] - 2023-07-21
|
||||||
### Changed
|
### Changed
|
||||||
|
@ -21,9 +21,8 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php": "^7.4 || ^8.0",
|
"php": "^7.4 || ^8.0",
|
||||||
"erickskrauch/php-cs-fixer-custom-fixers": "^1.0.1",
|
"erickskrauch/php-cs-fixer-custom-fixers": "^1.0.1",
|
||||||
"friendsofphp/php-cs-fixer": "^3.16",
|
"friendsofphp/php-cs-fixer": "^3.47",
|
||||||
"kubawerlos/php-cs-fixer-custom-fixers": "^3.13",
|
"kubawerlos/php-cs-fixer-custom-fixers": "^3.13"
|
||||||
"symfony/polyfill-php80": "^1.15"
|
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"ergebnis/composer-normalize": "^2.28"
|
"ergebnis/composer-normalize": "^2.28"
|
||||||
|
822
composer.lock
generated
822
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,7 @@ namespace Ely\CS;
|
|||||||
|
|
||||||
final class Rules {
|
final class Rules {
|
||||||
|
|
||||||
|
// Last fixers review has been done on PHP-CS-Fixer v3.48
|
||||||
public static function create(array $overwrittenRules = []): array {
|
public static function create(array $overwrittenRules = []): array {
|
||||||
return array_merge([
|
return array_merge([
|
||||||
'@PSR2' => true,
|
'@PSR2' => true,
|
||||||
@ -33,8 +34,11 @@ final class Rules {
|
|||||||
'trim_array_spaces' => true,
|
'trim_array_spaces' => true,
|
||||||
'whitespace_after_comma_in_array' => true,
|
'whitespace_after_comma_in_array' => true,
|
||||||
|
|
||||||
|
// Attribute notation
|
||||||
|
'attribute_empty_parentheses' => true,
|
||||||
|
|
||||||
// Basic
|
// Basic
|
||||||
'curly_braces_position' => [
|
'braces_position' => [
|
||||||
'functions_opening_brace' => 'same_line',
|
'functions_opening_brace' => 'same_line',
|
||||||
'classes_opening_brace' => 'same_line',
|
'classes_opening_brace' => 'same_line',
|
||||||
],
|
],
|
||||||
@ -42,6 +46,7 @@ final class Rules {
|
|||||||
'non_printable_character' => [
|
'non_printable_character' => [
|
||||||
'use_escape_sequences_in_strings' => true,
|
'use_escape_sequences_in_strings' => true,
|
||||||
],
|
],
|
||||||
|
'numeric_literal_separator' => true,
|
||||||
'octal_notation' => PHP_MAJOR_VERSION >= 8 && PHP_MINOR_VERSION >= 1,
|
'octal_notation' => PHP_MAJOR_VERSION >= 8 && PHP_MINOR_VERSION >= 1,
|
||||||
'psr_autoloading' => true,
|
'psr_autoloading' => true,
|
||||||
|
|
||||||
@ -52,7 +57,7 @@ final class Rules {
|
|||||||
'magic_constant_casing' => true,
|
'magic_constant_casing' => true,
|
||||||
'magic_method_casing' => true,
|
'magic_method_casing' => true,
|
||||||
'native_function_casing' => true,
|
'native_function_casing' => true,
|
||||||
'native_function_type_declaration_casing' => true,
|
'native_type_declaration_casing' => true,
|
||||||
|
|
||||||
// Cast Notation
|
// Cast Notation
|
||||||
'cast_spaces' => [
|
'cast_spaces' => [
|
||||||
@ -123,7 +128,6 @@ final class Rules {
|
|||||||
'closure_function_spacing' => 'none',
|
'closure_function_spacing' => 'none',
|
||||||
'closure_fn_spacing' => 'none',
|
'closure_fn_spacing' => 'none',
|
||||||
],
|
],
|
||||||
'function_typehint_space' => true,
|
|
||||||
'implode_call' => true,
|
'implode_call' => true,
|
||||||
'lambda_not_used_import' => true,
|
'lambda_not_used_import' => true,
|
||||||
'return_type_declaration' => true,
|
'return_type_declaration' => true,
|
||||||
@ -144,6 +148,7 @@ final class Rules {
|
|||||||
'dir_constant' => true,
|
'dir_constant' => true,
|
||||||
'function_to_constant' => true,
|
'function_to_constant' => true,
|
||||||
'is_null' => true,
|
'is_null' => true,
|
||||||
|
'nullable_type_declaration' => true,
|
||||||
'single_space_around_construct' => true,
|
'single_space_around_construct' => true,
|
||||||
|
|
||||||
// List Notation
|
// List Notation
|
||||||
@ -163,7 +168,7 @@ final class Rules {
|
|||||||
'spacing' => 'one',
|
'spacing' => 'one',
|
||||||
],
|
],
|
||||||
'logical_operators' => true,
|
'logical_operators' => true,
|
||||||
'new_with_braces' => [
|
'new_with_parentheses' => [
|
||||||
'anonymous_class' => false,
|
'anonymous_class' => false,
|
||||||
],
|
],
|
||||||
'no_useless_concat_operator' => true,
|
'no_useless_concat_operator' => true,
|
||||||
@ -181,6 +186,7 @@ final class Rules {
|
|||||||
|
|
||||||
// PHPUnit
|
// PHPUnit
|
||||||
'php_unit_construct' => true,
|
'php_unit_construct' => true,
|
||||||
|
'php_unit_data_provider_return_type' => true,
|
||||||
'php_unit_dedicate_assert_internal_type' => true,
|
'php_unit_dedicate_assert_internal_type' => true,
|
||||||
'php_unit_expectation' => true,
|
'php_unit_expectation' => true,
|
||||||
'php_unit_fqcn_annotation' => true,
|
'php_unit_fqcn_annotation' => true,
|
||||||
@ -195,6 +201,9 @@ final class Rules {
|
|||||||
'call_type' => 'this',
|
'call_type' => 'this',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
// PHPDoc
|
||||||
|
'align_multiline_comment' => true,
|
||||||
|
|
||||||
// Return Notation
|
// Return Notation
|
||||||
'no_useless_return' => true,
|
'no_useless_return' => true,
|
||||||
'return_assignment' => true,
|
'return_assignment' => true,
|
||||||
@ -217,7 +226,7 @@ final class Rules {
|
|||||||
|
|
||||||
// Whitespace
|
// Whitespace
|
||||||
'array_indentation' => true,
|
'array_indentation' => true,
|
||||||
'compact_nullable_typehint' => true,
|
'compact_nullable_type_declaration' => true,
|
||||||
'method_chaining_indentation' => true,
|
'method_chaining_indentation' => true,
|
||||||
'no_extra_blank_lines' => [
|
'no_extra_blank_lines' => [
|
||||||
'tokens' => [
|
'tokens' => [
|
||||||
@ -238,6 +247,7 @@ final class Rules {
|
|||||||
],
|
],
|
||||||
'no_spaces_around_offset' => true,
|
'no_spaces_around_offset' => true,
|
||||||
'no_whitespace_in_blank_line' => true,
|
'no_whitespace_in_blank_line' => true,
|
||||||
|
'type_declaration_spaces' => true,
|
||||||
'types_spaces' => [
|
'types_spaces' => [
|
||||||
'space_multiple_catch' => 'none',
|
'space_multiple_catch' => 'none',
|
||||||
],
|
],
|
||||||
@ -249,7 +259,7 @@ final class Rules {
|
|||||||
|
|
||||||
// Our custom or extended fixers
|
// Our custom or extended fixers
|
||||||
'ErickSkrauch/align_multiline_parameters' => [
|
'ErickSkrauch/align_multiline_parameters' => [
|
||||||
'variables' => false,
|
'variables' => null,
|
||||||
'defaults' => false,
|
'defaults' => false,
|
||||||
],
|
],
|
||||||
'ErickSkrauch/blank_line_around_class_body' => [
|
'ErickSkrauch/blank_line_around_class_body' => [
|
||||||
|
Loading…
Reference in New Issue
Block a user