Skip to content

Commit

Permalink
[Feat] Fix Coding standards to get approval from Prestashop Validator
Browse files Browse the repository at this point in the history
  • Loading branch information
ElvisHeredia committed Mar 16, 2023
1 parent cbebb22 commit 98291d2
Show file tree
Hide file tree
Showing 118 changed files with 4,126 additions and 3,938 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/composer.lock
/.vendor
1 change: 0 additions & 1 deletion .php-cs-fixer.cache

This file was deleted.

252 changes: 227 additions & 25 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -1,34 +1,236 @@
<?php

$finder = PhpCsFixer\Finder::create()
->exclude(['storage', 'bootstrap/cache'])
->in(__DIR__);
$config = new PhpCsFixer\Config();
return $config->setRules([
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short'],
'concat_space' => ['spacing' => 'one'],
'binary_operator_spaces' => true,
'not_operator_with_successor_space' => true,
'no_superfluous_elseif' => true,
'single_quote' => true,
'operator_linebreak' => true,
'no_unneeded_control_parentheses' => true,
'braces' => true,
'phpdoc_annotation_without_dot' => true,
'increment_style' => true,
'phpdoc_scalar' => true,
'phpdoc_no_alias_tag' => true,
'phpdoc_no_package' => true,
'no_spaces_inside_parenthesis' => true,
'single_line_comment_spacing' => true,
'no_alias_language_construct_call' => true,
'trailing_comma_in_multiline' => true,
'unary_operator_spaces' => true,
'short_scalar_cast' => true,
'phpdoc_separation' => true,
'cast_spaces' => true,
'no_extra_blank_lines' => true,
'blank_line_before_statement' => true
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short'],
'concat_space' => ['spacing' => 'one'],
'braces' => [
'allow_single_line_anonymous_class_with_empty_body' => false,
'allow_single_line_closure' => true,
'position_after_functions_and_oop_constructs' => 'next',
'position_after_control_structures' => 'same',
'position_after_anonymous_constructs' => 'same'
],
'no_unneeded_control_parentheses' => [
'statements' => [
'break',
'clone',
'continue',
'echo_print',
'negative_instanceof',
'others',
'return',
'switch_case',
'yield',
'yield_from',
]
],
'phpdoc_annotation_without_dot' => true,
'increment_style' => ['style' => 'pre'],
'phpdoc_scalar' => [
'types' => [
'boolean',
'callback',
'double',
'integer',
'real',
'str'
]
],
'phpdoc_no_alias_tag' => [
'replacements' => [
'property-read' => 'property',
'property-write' => 'property',
'type' => 'var',
'link' => 'see'
]

],
'phpdoc_no_package' => true,
'single_quote' => ['strings_containing_single_quote_chars' => true],
'no_spaces_inside_parenthesis' => true,
'single_line_comment_spacing' => true,
'no_alias_language_construct_call' => true,
'trailing_comma_in_multiline' => [
'after_heredoc' => true,
'elements' => ['arrays']
],
'unary_operator_spaces' => true,
'short_scalar_cast' => true,
'phpdoc_separation' => [
'groups' => [
['deprecated', 'link', 'see', 'since'],
['author', 'copyright', 'license'],
['category', 'package', 'subpackage'],
['property', 'property-read', 'property-write']
]
],
'cast_spaces' => ['space' => 'single'],
'no_extra_blank_lines' => [
'tokens' => [
'attribute',
'break',
'case',
'continue',
'curly_brace_block',
'default',
'extra',
'parenthesis_brace_block',
'return',
'square_brace_block',
'switch',
'throw',
'use',
'use_trait'
]
],
'blank_line_before_statement' => [
'statements' => [
'break',
'case',
'continue',
'declare',
'default',
'do',
'exit',
'for',
'foreach',
'goto',
'if',
'include',
'include_once',
'phpdoc',
'require',
'require_once',
'return',
'switch',
'throw',
'try',
'while',
'yield',
'yield_from'
]
],
'binary_operator_spaces' => [
'default' => 'single_space'
],
'no_blank_lines_after_phpdoc' => true,
'class_attributes_separation' => [
'elements' => [
'const' => 'one',
'method' => 'one',
'property' => 'one',
'trait_import' => 'none',
'case' => 'none'
]

],
'ternary_operator_spaces' => true,
'no_whitespace_in_blank_line' => true,
'phpdoc_align' => [
'tags' => ['method', 'param', 'property', 'return', 'throws', 'type', 'var'],
'align' => 'left'
],
'single_space_after_construct' => [
'constructs' => [
'abstract',
'as',
'attribute',
'break',
'case',
'catch',
'class',
'clone',
'comment',
'const',
'const_import',
'continue',
'do',
'echo',
'else',
'elseif',
'enum',
'extends',
'final',
'finally',
'for',
'foreach',
'function',
'function_import',
'global',
'goto',
'if',
'implements',
'include',
'include_once',
'instanceof',
'insteadof',
'interface',
'match',
'named_argument',
'namespace',
'new',
'open_tag_with_echo',
'php_doc',
'php_open',
'print',
'private',
'protected',
'public',
'readonly',
'require',
'require_once',
'return',
'static',
'switch',
'throw',
'trait',
'try',
'type_colon',
'use',
'use_lambda',
'use_trait',
'var',
'while',
'yield',
'yield_from'
]
],
'phpdoc_indent' => true,
'no_leading_import_slash' => true,
'phpdoc_to_comment' => ['ignored_tags' => ['todo']],
'single_line_comment_style' => ['comment_types' => ['asterisk', 'hash']],
'no_trailing_comma_in_singleline' => [
'elements' => [
'arguments',
'array_destructuring',
'array',
'group_import'
]
],
'whitespace_after_comma_in_array' => ['ensure_single_space' => true],

'no_unused_imports' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'single_line_throw' => true,
'standardize_increment' => true,
'native_function_casing' => true,
'phpdoc_trim' => true,
'class_definition' => [
'multi_line_extends_each_single_line' => false,
'single_item_single_line' => false,
'single_line' => true,
'space_before_parenthesis' => true,
'inline_constructor_arguments' => true
]

//'not_operator_with_successor_space' => false,
//'no_superfluous_elseif' => true,
//'operator_linebreak' => true,
])
->setFinder($finder);

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## [v2.3.6] - 2023-03-15
[Full Changelog](https://github.com/conekta/conekta_prestashop/compare/2.3.5...2.3.6)
- Add MSI feature by @ElvisHeredia [#115](https://github.com/conekta/conekta_prestashop/pull/115)
- Fix Coding standards to get approval from Prestashop Validator by @ElvisHeredia [#116](https://github.com/conekta/conekta_prestashop/pull/116)


## [v2.3.5] - 2022-11-04
Expand Down
Loading

0 comments on commit 98291d2

Please sign in to comment.