Skip to content

Commit

Permalink
Merge pull request #5 from taptima/TAP-624-add-new-rules-set
Browse files Browse the repository at this point in the history
TAP-624 "Add new rules set to cs fixer"
  • Loading branch information
koninka authored Sep 29, 2021
2 parents b587c1a + b1db2b3 commit 5898485
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 25 deletions.
27 changes: 23 additions & 4 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@
'@PhpCsFixer' => true,
'@PHP71Migration' => true,

'blank_line_after_namespace' => true,
'single_import_per_statement' => true,
'single_line_after_imports' => true,
'no_unused_imports' => true,
'blank_line_after_namespace' => true,
'single_import_per_statement' => true,
'single_line_after_imports' => true,
'no_unused_imports' => true,
'clean_namespace' => true,
'lambda_not_used_import' => true,
'switch_continue_to_break' => true,
'no_alias_language_construct_call' => true,
'single_space_after_construct' => true,
'operator_linebreak' => true,

'ordered_imports' => true,
'global_namespace_import' => true,
Expand All @@ -38,8 +44,12 @@
'destruct',
'magic',
'phpunit',
'method_public_abstract',
'method_public_abstract_static',
'method_public_static',
'method_public',
'method_protected_abstract',
'method_protected_abstract_static',
'method_protected_static',
'method_protected',
'method_private_static',
Expand Down Expand Up @@ -119,6 +129,15 @@
'sort_algorithm' => 'none',
'null_adjustment' => 'always_last',
],
'phpdoc_order_by_value' => [
'annotations' => [
'method',
'throws',
'author',
'property',
'internal',
],
],
])
->setUsingCache(true)
->setFinder($finder)
Expand Down
20 changes: 10 additions & 10 deletions src/Taptima/CS/AbstractFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@

abstract class AbstractFixer extends PhpCsFixer
{
/**
* @return string
*/
abstract public function getSampleCode();

/**
* @return string
*/
abstract public function getDocumentation();

/**
* {@inheritdoc}
*/
Expand All @@ -38,16 +48,6 @@ public function getSampleConfigurations()
];
}

/**
* @return string
*/
abstract public function getSampleCode();

/**
* @return string
*/
abstract public function getDocumentation();

/**
* {@inheritdoc}
*/
Expand Down
14 changes: 7 additions & 7 deletions src/Taptima/CS/Fixer/AbstractOrderedClassElementsFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@

abstract class AbstractOrderedClassElementsFixer extends AbstractFixer
{
/**
* @param array[] $elements
*
* @return array[]
*/
abstract protected function sortElements(array $elements);

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -40,13 +47,6 @@ protected function applyFix(SplFileInfo $file, Tokens $tokens): void
}
}

/**
* @param array[] $elements
*
* @return array[]
*/
abstract protected function sortElements(array $elements);

/**
* @param int $startIndex
*
Expand Down
27 changes: 23 additions & 4 deletions src/Taptima/CS/RuleSetFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@ final class RuleSetFactory
'@PhpCsFixer' => true,
'@PHP71Migration' => true,

'blank_line_after_namespace' => true,
'single_import_per_statement' => true,
'single_line_after_imports' => true,
'no_unused_imports' => true,
'blank_line_after_namespace' => true,
'single_import_per_statement' => true,
'single_line_after_imports' => true,
'no_unused_imports' => true,
'clean_namespace' => true,
'lambda_not_used_import' => true,
'switch_continue_to_break' => true,
'no_alias_language_construct_call' => true,
'single_space_after_construct' => true,
'operator_linebreak' => true,

'ordered_imports' => true,
'global_namespace_import' => true,
Expand All @@ -42,8 +48,12 @@ final class RuleSetFactory
'destruct',
'magic',
'phpunit',
'method_public_abstract',
'method_public_abstract_static',
'method_public_static',
'method_public',
'method_protected_abstract',
'method_protected_abstract_static',
'method_protected_static',
'method_protected',
'method_private_static',
Expand Down Expand Up @@ -120,6 +130,15 @@ final class RuleSetFactory
'sort_algorithm' => 'none',
'null_adjustment' => 'always_last',
],
'phpdoc_order_by_value' => [
'annotations' => [
'method',
'throws',
'author',
'property',
'internal',
],
],

'nullable_type_declaration_for_default_null_value' => true,

Expand Down

0 comments on commit 5898485

Please sign in to comment.