Skip to content

Commit b9526f2

Browse files
committed
[TASK] Update StyleCI and PHP CS Fixer configuration
1 parent 854c79c commit b9526f2

File tree

8 files changed

+89
-68
lines changed

8 files changed

+89
-68
lines changed

.php_cs.dist

+18-3
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,31 @@ return PhpCsFixer\Config::create()
1414
'syntax' => 'short',
1515
],
1616
'binary_operator_spaces' => true,
17+
'blank_line_after_opening_tag' => true,
1718
'blank_line_before_return' => true,
19+
'cast_spaces' => [
20+
'space' => 'none',
21+
],
22+
'compact_nullable_typehint' => true,
1823
'concat_space' => [
1924
'spacing' => 'one',
2025
],
26+
'declare_equal_normalize' => [
27+
'space' => 'none'
28+
],
29+
'declare_strict_types' => true,
2130
'function_typehint_space' => true,
2231
'hash_to_slash_comment' => true,
2332
'linebreak_after_opening_tag' => true,
2433
'lowercase_cast' => true,
34+
'lowercase_constants' => true,
35+
'lowercase_static_reference' => true,
2536
'method_separation' => true,
2637
'native_function_casing' => true,
2738
'new_with_braces' => true,
39+
'no_alias_functions' => true,
2840
'no_blank_lines_after_class_opening' => true,
2941
'no_blank_lines_after_phpdoc' => true,
30-
'no_blank_lines_before_namespace' => true,
31-
'no_alias_functions' => true,
3242
'no_empty_comment' => true,
3343
'no_empty_phpdoc' => true,
3444
'no_empty_statement' => true,
@@ -62,7 +72,9 @@ return PhpCsFixer\Config::create()
6272
'no_useless_return' => true,
6373
'no_whitespace_before_comma_in_array' => true,
6474
'no_whitespace_in_blank_line' => true,
75+
'non_printable_character' => true,
6576
'normalize_index_brace' => true,
77+
'object_operator_without_whitespace' => true,
6678
'ordered_imports' => true,
6779
'phpdoc_add_missing_param_annotation' => true,
6880
'phpdoc_annotation_without_dot' => true,
@@ -74,9 +86,13 @@ return PhpCsFixer\Config::create()
7486
'phpdoc_single_line_var_spacing' => true,
7587
'phpdoc_trim' => true,
7688
'phpdoc_types' => true,
89+
'self_accessor' => true,
7790
'phpdoc_var_without_name' => true,
91+
'return_type_declaration' => ['space_before' => 'none'],
7892
'short_scalar_cast' => true,
93+
'single_blank_line_before_namespace' => true,
7994
'single_quote' => true,
95+
'single_trait_insert_per_statement' => true,
8096
'standardize_not_equals' => true,
8197
'ternary_operator_spaces' => true,
8298
'trailing_comma_in_multiline_array' => true,
@@ -86,5 +102,4 @@ return PhpCsFixer\Config::create()
86102
PhpCsFixer\Finder::create()
87103
->in(__DIR__)
88104
->exclude('.Build')
89-
->notName('ext_emconf.php')
90105
);

.styleci.yml

+52-60
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,56 @@
1-
preset: psr2
1+
risky: true
2+
3+
preset: psr12
24

35
enabled:
4-
- alpha_ordered_imports
5-
- binary_operator_spaces
6-
- concat_with_spaces
7-
- function_typehint_space
8-
- hash_to_slash_comment
9-
- linebreak_after_opening_tag
10-
- lowercase_cast
11-
- method_separation
12-
- native_function_casing
13-
- new_with_braces
14-
- no_alias_functions
15-
- no_blank_lines_after_class_opening
16-
- no_blank_lines_after_phpdoc
17-
- no_blank_lines_before_namespace
18-
- no_empty_comment
19-
- no_empty_phpdoc
20-
- no_empty_statement
21-
- no_extra_block_blank_lines
22-
- no_extra_consecutive_blank_lines
23-
- no_leading_import_slash
24-
- no_leading_namespace_whitespace
25-
- no_multiline_whitespace_around_double_arrow
26-
- no_multiline_whitespace_before_semicolons
27-
- no_short_bool_cast
28-
- no_singleline_whitespace_before_semicolons
29-
- no_trailing_comma_in_list_call
30-
- no_trailing_comma_in_singleline_array
31-
- no_unneeded_control_parentheses
32-
- no_unreachable_default_argument_value
33-
- no_unused_imports
34-
- no_useless_else
35-
- no_useless_return
36-
- no_whitespace_before_comma_in_array
37-
- no_whitespace_in_blank_line
38-
- normalize_index_brace
39-
- phpdoc_add_missing_param_annotation
40-
- phpdoc_annotation_without_dot
41-
- phpdoc_indent
42-
- phpdoc_no_access
43-
- phpdoc_no_package
44-
- phpdoc_order
45-
- phpdoc_scalar
46-
- phpdoc_single_line_var_spacing
47-
- phpdoc_trim
48-
- phpdoc_types
49-
- phpdoc_var_without_name
50-
- short_array_syntax
51-
- short_scalar_cast
52-
- single_quote
53-
- standardize_not_equals
54-
- ternary_operator_spaces
55-
- trailing_comma_in_multiline_array
56-
- whitespace_after_comma_in_array
6+
- alpha_ordered_imports
7+
- binary_operator_spaces
8+
- blank_line_before_return
9+
- hash_to_slash_comment
10+
- linebreak_after_opening_tag
11+
- method_separation
12+
- native_function_casing
13+
- no_alias_functions
14+
- no_blank_lines_after_phpdoc
15+
- no_empty_comment
16+
- no_empty_phpdoc
17+
- no_empty_statement
18+
- no_extra_block_blank_lines
19+
- no_extra_consecutive_blank_lines
20+
- no_multiline_whitespace_around_double_arrow
21+
- no_multiline_whitespace_before_semicolons
22+
- no_short_bool_cast
23+
- no_singleline_whitespace_before_semicolons
24+
- no_trailing_comma_in_list_call
25+
- no_trailing_comma_in_singleline_array
26+
- no_unneeded_control_parentheses
27+
- no_unused_imports
28+
- no_useless_else
29+
- no_useless_return
30+
- no_whitespace_before_comma_in_array
31+
- non_printable_character
32+
- normalize_index_brace
33+
- object_operator_without_whitespace
34+
- phpdoc_add_missing_param_annotation
35+
- phpdoc_annotation_without_dot
36+
- phpdoc_indent
37+
- phpdoc_no_access
38+
- phpdoc_no_package
39+
- phpdoc_order
40+
- phpdoc_scalar
41+
- phpdoc_single_line_var_spacing
42+
- phpdoc_trim
43+
- phpdoc_types
44+
- phpdoc_var_without_name
45+
- self_accessor
46+
- short_array_syntax
47+
- single_quote
48+
- standardize_not_equals
49+
- trailing_comma_in_multiline_array
50+
- whitespace_after_comma_in_array
5751

5852
finder:
59-
name:
60-
- "*.php"
61-
exclude:
62-
- ".Build"
63-
not-name:
64-
- "ext_emconf.php"
53+
name:
54+
- "*.php"
55+
exclude:
56+
- ".Build"

phpunit.xml.dist

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.4/phpunit.xsd"
44
bootstrap=".Build/vendor/autoload.php"
55
executionOrder="depends,defects"
6-
forceCoversAnnotation="true"
6+
forceCoversAnnotation="false"
77
beStrictAboutCoversAnnotation="true"
88
beStrictAboutOutputDuringTests="true"
99
beStrictAboutTodoAnnotatedTests="true"

src/PhpunitMerger/Command/CoverageCommand.php

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
25
namespace Nimut\PhpunitMerger\Command;
36

47
use SebastianBergmann\CodeCoverage\CodeCoverage;

src/PhpunitMerger/Command/LogCommand.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
25
namespace Nimut\PhpunitMerger\Command;
36

47
use Symfony\Component\Console\Command\Command;
@@ -93,7 +96,7 @@ private function addTestSuites(\DOMElement $parent, array $testSuites)
9396
$attributes = $testSuite['@attributes'] ?? [];
9497
foreach ($attributes as $key => $value) {
9598
$value = $key === 'name' ? $value : 0;
96-
$element->setAttribute($key, $value);
99+
$element->setAttribute($key, (string)$value);
97100
}
98101
$parent->appendChild($element);
99102
$this->domElements[$name] = $element;
@@ -126,7 +129,7 @@ private function addTestCases(\DOMElement $parent, array $testCases)
126129

127130
$element = $this->document->createElement('testcase');
128131
foreach ($attributes as $key => $value) {
129-
$element->setAttribute($key, $value);
132+
$element->setAttribute($key, (string)$value);
130133
if (!is_numeric($value)) {
131134
continue;
132135
}
@@ -140,7 +143,7 @@ private function addTestCases(\DOMElement $parent, array $testCases)
140143
private function addAttributeValueToTestSuite(\DOMElement $element, $key, $value)
141144
{
142145
$currentValue = $element->hasAttribute($key) ? $element->getAttribute($key) : 0;
143-
$element->setAttribute($key, $currentValue + $value);
146+
$element->setAttribute($key, (string)($currentValue + $value));
144147

145148
if ($element->hasAttribute('parent')) {
146149
$parent = $element->getAttribute('parent');

tests/PhpunitMerger/Command/AbstractCommandTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
25
namespace Nimut\PhpunitMerger\Tests\Command;
36

47
use PHPUnit\Framework\TestCase;

tests/PhpunitMerger/Command/Coverage/CoverageCommandTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
25
namespace Nimut\PhpunitMerger\Tests\Command\Coverage;
36

47
use Nimut\PhpunitMerger\Command\CoverageCommand;
@@ -8,7 +11,6 @@
811
use Symfony\Component\Console\Output\OutputInterface;
912

1013
class CoverageCommandTest extends AbstractCommandTest
11-
1214
{
1315
/**
1416
* @var string

tests/PhpunitMerger/Command/Log/LogCommandTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
25
namespace Nimut\PhpunitMerger\Tests\Command\Log;
36

47
use Nimut\PhpunitMerger\Command\LogCommand;

0 commit comments

Comments
 (0)