Skip to content

Commit

Permalink
Update PHP CS Fixer and custom fixers (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos authored Apr 3, 2023
1 parent 41bf723 commit 4f7118a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 16 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
],
"require": {
"php": "^8.0",
"kubawerlos/php-cs-fixer-custom-fixers": "^3.11",
"php-cs-fixer/shim": "^3.12"
"kubawerlos/php-cs-fixer-custom-fixers": "^3.14",
"php-cs-fixer/shim": "^3.16"
},
"require-dev": {
"phpunit/phpunit": "^9.5.19"
Expand Down
3 changes: 1 addition & 2 deletions dev/Builder/Modifier/NonDefaultConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Dev\Builder\Modifier;

use PhpCsFixer\Fixer\Whitespace\NoExtraBlankLinesFixer;
use PhpCsFixerCustomFixers\Fixer\DataProviderStaticFixer;

/**
* @internal
Expand All @@ -37,12 +36,12 @@ public function __invoke(array $rules): array
$rules['native_function_invocation'] = ['include' => ['@all'], 'scope' => 'namespaced', 'strict' => true];
$rules['no_extra_blank_lines'] = ['tokens' => \array_diff((new \ReflectionClass(NoExtraBlankLinesFixer::class))->getStaticPropertyValue('availableTokens'), ['use_trait'])];
$rules['no_superfluous_phpdoc_tags'] = ['remove_inheritdoc' => true];
$rules['php_unit_data_provider_static'] = ['force' => true];
$rules['php_unit_test_case_static_method_calls'] = ['call_type' => 'self'];
$rules['phpdoc_line_span'] = ['property' => 'single'];
$rules['trailing_comma_in_multiline'] = ['after_heredoc' => true, 'elements' => ['arguments', 'arrays', 'parameters']];
$rules['whitespace_after_comma_in_array'] = ['ensure_single_space' => true];
$rules['yoda_style'] = ['equal' => false, 'identical' => false, 'less_and_greater' => false];
$rules[DataProviderStaticFixer::name()] = ['force' => true];

return $rules;
}
Expand Down
1 change: 0 additions & 1 deletion dev/Builder/Modifier/UnwantedRulesFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ final class UnwantedRulesFilter
{
private const UNWANTED_RULES = [
'blank_line_between_import_groups',
'braces',
'combine_consecutive_issets',
'combine_consecutive_unsets',
'general_phpdoc_annotation_remove',
Expand Down
2 changes: 1 addition & 1 deletion dev/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* the LICENSE file that was distributed with this source code.
*/

$phar = __DIR__ . '/../vendor/php-cs-fixer/shim/php-cs-fixer';
$phar = __DIR__ . '/../vendor/php-cs-fixer/shim/php-cs-fixer.phar';

$pharLoaded = Phar::loadPhar($phar, 'php-cs-fixer.phar');
if (!$pharLoaded) {
Expand Down
10 changes: 5 additions & 5 deletions src/Rules/LibraryRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public function getRules(): array
],
],
'blank_line_between_import_groups' => false,
'braces' => false,
'cast_spaces' => true,
'class_attributes_separation' => [
'elements' => [
Expand Down Expand Up @@ -247,6 +246,9 @@ public function getRules(): array
'ordered_interfaces' => true,
'ordered_traits' => true,
'php_unit_construct' => true,
'php_unit_data_provider_static' => [
'force' => true,
],
'php_unit_dedicate_assert' => true,
'php_unit_dedicate_assert_internal_type' => true,
'php_unit_expectation' => true,
Expand Down Expand Up @@ -321,7 +323,7 @@ public function getRules(): array
'single_line_comment_style' => true,
'single_line_throw' => true,
'single_quote' => true,
'single_space_after_construct' => true,
'single_space_around_construct' => true,
'single_trait_insert_per_statement' => true,
'space_after_semicolon' => true,
'standardize_increment' => true,
Expand Down Expand Up @@ -365,10 +367,8 @@ public function getRules(): array
Fixer\ConstructorEmptyBracesFixer::name() => true,
Fixer\DataProviderNameFixer::name() => true,
Fixer\DataProviderReturnTypeFixer::name() => true,
Fixer\DataProviderStaticFixer::name() => [
'force' => true,
],
Fixer\DeclareAfterOpeningTagFixer::name() => true,
Fixer\EmptyFunctionBodyFixer::name() => true,
Fixer\IssetToArrayKeyExistsFixer::name() => true,
Fixer\MultilineCommentOpeningClosingAloneFixer::name() => true,
Fixer\MultilinePromotedPropertiesFixer::name() => true,
Expand Down
10 changes: 5 additions & 5 deletions src/Rules/ProjectRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public function getRules(): array
],
],
'blank_line_between_import_groups' => false,
'braces' => false,
'cast_spaces' => true,
'class_attributes_separation' => [
'elements' => [
Expand Down Expand Up @@ -225,6 +224,9 @@ public function getRules(): array
'ordered_interfaces' => true,
'ordered_traits' => true,
'php_unit_construct' => true,
'php_unit_data_provider_static' => [
'force' => true,
],
'php_unit_dedicate_assert' => true,
'php_unit_dedicate_assert_internal_type' => true,
'php_unit_expectation' => true,
Expand Down Expand Up @@ -299,7 +301,7 @@ public function getRules(): array
'single_line_comment_style' => true,
'single_line_throw' => true,
'single_quote' => true,
'single_space_after_construct' => true,
'single_space_around_construct' => true,
'single_trait_insert_per_statement' => true,
'space_after_semicolon' => true,
'standardize_increment' => true,
Expand Down Expand Up @@ -343,10 +345,8 @@ public function getRules(): array
Fixer\ConstructorEmptyBracesFixer::name() => true,
Fixer\DataProviderNameFixer::name() => true,
Fixer\DataProviderReturnTypeFixer::name() => true,
Fixer\DataProviderStaticFixer::name() => [
'force' => true,
],
Fixer\DeclareAfterOpeningTagFixer::name() => true,
Fixer\EmptyFunctionBodyFixer::name() => true,
Fixer\IssetToArrayKeyExistsFixer::name() => true,
Fixer\MultilineCommentOpeningClosingAloneFixer::name() => true,
Fixer\MultilinePromotedPropertiesFixer::name() => true,
Expand Down

0 comments on commit 4f7118a

Please sign in to comment.