Skip to content
Open
16 changes: 11 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
],
"require": {
"squizlabs/php_codesniffer": "3.*",
"friendsofphp/php-cs-fixer": "^2.16.0",
"phpmd/phpmd": "^2.8.1",
"magento/magento-coding-standard": "5",
"friendsofphp/php-cs-fixer": "~3.4.0",
"phpmd/phpmd": "^2.9.1",
"magento/magento-coding-standard": "dev-v2.4-magento-compatibitity",
"php-parallel-lint/php-parallel-lint": "^1.0.0",
"phpro/grumphp": "~1.3.0",
"phpstan/phpstan": ">=0.12.3 <=0.12.23"
"phpro/grumphp": "~1.5.0",
"phpstan/phpstan": "~1.2.0"
},
"autoload": {
"psr-4": {
Expand All @@ -26,5 +26,11 @@
"Mygento\\CS\\Config\\": "config",
"Mygento\\CS\\Stan\\": "stan"
}
},
"repositories": {
"magento/magento-coding-standard": {
"type": "git",
"url": "https://github.com/Daseraf/magento-coding-standard.git"
}
}
}
27 changes: 12 additions & 15 deletions config/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Mygento\CS\Config;

use PhpCsFixer\ConfigInterface;

class Base extends \PhpCsFixer\Config
{
/**
Expand All @@ -27,7 +29,7 @@ public function __construct($header = null, array $customRules = [])
/**
* {@inheritdoc}
*/
public function setFinder($finder)
public function setFinder(iterable $finder): ConfigInterface
{
$finder->exclude('dev/tests/functional/generated')
->exclude('dev/tests/functional/var')
Expand All @@ -42,10 +44,14 @@ public function setFinder($finder)
->exclude('pub/static')
->exclude('setup/vendor')
->exclude('var');
parent::setFinder($finder);

return parent::setFinder($finder);
}

public function getRules()
/**
* {@inheritdoc}
*/
public function getRules(): array
{
$rules = [
'@PSR12' => true,
Expand All @@ -54,11 +60,10 @@ public function getRules()
'include' => true,
'new_with_braces' => true,
'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'no_multiline_whitespace_before_semicolons' => true,
'multiline_whitespace_before_semicolons' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unused_imports' => true,
Expand All @@ -72,21 +77,18 @@ public function getRules()
'phpdoc_types' => true,
'phpdoc_add_missing_param_annotation' => true,
'single_quote' => true,
'standardize_not_equals' => true,
'ternary_to_null_coalescing' => true,
'lowercase_cast' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'return_type_declaration' => true,
'no_useless_return' => true,
// mygento 2
'align_multiline_comment' => true,
'array_indentation' => true,
'binary_operator_spaces' => true,
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => ['statements' => ["return", "throw", "try"]],
'cast_spaces' => true,
'class_attributes_separation' => ['elements' => ['method', 'property']],
'class_attributes_separation' => ['elements' => ['method' => 'one', 'property' => 'one', 'trait_import' => 'none']],
'explicit_indirect_variable' => true,
'explicit_string_variable' => true,
'function_typehint_space' => true,
Expand All @@ -101,13 +103,10 @@ public function getRules()
'tokens' => ["break", "continue", "curly_brace_block", "extra", "parenthesis_brace_block", "return", "square_brace_block", "throw", "use"]
],
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_around_offset' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_list_call' => true,
'no_useless_else' => true,
'no_whitespace_in_blank_line' => true,
'object_operator_without_whitespace' => true,
'ordered_class_elements' => [
'order' => ["use_trait", "constant_public", "constant_protected", "constant_private", "property_public", "property_protected", "property_private", "construct", "destruct", "magic", "phpunit", "method_public", "method_protected", "method_private"]
],
Expand All @@ -120,10 +119,8 @@ public function getRules()
'phpdoc_types_order' => [
'null_adjustment' => 'always_last'
],
//'phpdoc_var_without_name' => false,
'return_assignment' => true,
//'single_line_comment_style' => false,
'trailing_comma_in_multiline_array' => true,
'trailing_comma_in_multiline' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'whitespace_after_comma_in_array' => true,
Expand Down
5 changes: 4 additions & 1 deletion stan/extension.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
parameters:
bootstrapFiles:
- autoload.php
services:
- class: Mygento\CS\Stan\DataObject
tags:
- phpstan.broker.methodsClassReflectionExtension
- phpstan.broker.methodsClassReflectionExtension