Skip to content

Commit a87b4c2

Browse files
authored
Merge pull request #133 from TYPO3/update-rules-v2
[TASK] Update rules
2 parents e3c9e49 + 72efaf4 commit a87b4c2

5 files changed

Lines changed: 18 additions & 14 deletions

File tree

rector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
use Rector\Symfony\Set\SymfonyLevelSetList;
2525
use Rector\Symfony\Set\SymfonySetList;
2626

27-
return static function(RectorConfig $rectorConfig): void {
27+
return static function (RectorConfig $rectorConfig): void {
2828
$rectorConfig->paths([
2929
__DIR__ . '/src',
3030
__DIR__ . '/tests',

src/CsFixerConfig.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,26 @@ class CsFixerConfig extends Config implements CsFixerConfigInterface
4141
*/
4242
protected static $typo3Rules = [
4343
'@DoctrineAnnotation' => true,
44-
'@PER' => true,
44+
// @todo: Switch to @PER-CS2.0 once php-cs-fixer's todo list is done: https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7247
45+
'@PER-CS1.0' => true,
46+
'array_indentation' => true,
4547
'array_syntax' => ['syntax' => 'short'],
4648
'cast_spaces' => ['space' => 'none'],
49+
// @todo: Can be dropped once we enable @PER-CS2.0
4750
'concat_space' => ['spacing' => 'one'],
48-
'curly_braces_position' => ['allow_single_line_empty_anonymous_classes' => true],
4951
'declare_equal_normalize' => ['space' => 'none'],
5052
'declare_parentheses' => true,
5153
'dir_constant' => true,
52-
'function_to_constant' => ['functions' => ['get_called_class', 'get_class', 'get_class_this', 'php_sapi_name', 'phpversion', 'pi']],
53-
'function_typehint_space' => true,
54+
// @todo: Can be dropped once we enable @PER-CS2.0
5455
'function_declaration' => [
55-
'closure_function_spacing' => 'none',
56-
],
57-
'single_line_throw' => false,
58-
'php_unit_internal_class' => false,
59-
'braces' => [
60-
'allow_single_line_closure' => true,
56+
'closure_fn_spacing' => 'none',
6157
],
58+
'function_to_constant' => ['functions' => ['get_called_class', 'get_class', 'get_class_this', 'php_sapi_name', 'phpversion', 'pi']],
59+
'type_declaration_spaces' => true,
60+
'global_namespace_import' => ['import_classes' => false, 'import_constants' => false, 'import_functions' => false],
61+
'list_syntax' => ['syntax' => 'short'],
62+
// @todo: Can be dropped once we enable @PER-CS2.0
63+
'method_argument_space' => true,
6264
'modernize_strpos' => true,
6365
'modernize_types_casting' => true,
6466
'native_function_casing' => true,
@@ -92,6 +94,8 @@ class CsFixerConfig extends Config implements CsFixerConfigInterface
9294
'single_quote' => true,
9395
'single_space_around_construct' => true,
9496
'single_line_comment_style' => ['comment_types' => ['hash']],
97+
// @todo: Can be dropped once we enable @PER-CS2.0
98+
'single_line_empty_body' => true,
9599
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
96100
'whitespace_after_comma_in_array' => ['ensure_single_space' => true],
97101
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],

tests/Console/Style/SimpleStyle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function section($message): void
102102
*/
103103
public function listing(array $elements): void
104104
{
105-
$elements = array_map(fn ($element) => sprintf(' * %s', $element), $elements);
105+
$elements = array_map(fn($element) => sprintf(' * %s', $element), $elements);
106106

107107
$this->writeln($elements);
108108
}

tests/Unit/CsFixerConfigTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function testCreateReturnsCorrectClass(): void
2727
$csFixerConfig = CsFixerConfig::create();
2828
self::assertInstanceOf(CsFixerConfig::class, $csFixerConfig);
2929
self::assertTrue($csFixerConfig->getRiskyAllowed());
30-
self::assertCount(51, $csFixerConfig->getRules());
30+
self::assertCount(52, $csFixerConfig->getRules());
3131
}
3232

3333
public function testAddRules(): void

typo3-coding-standards

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* Loads Composer's autoload.php.
1818
*/
19-
(static function(): void {
19+
(static function (): void {
2020
$possibleAutoloaders = [
2121
__DIR__ . '/../../autoload.php',
2222
__DIR__ . '/../autoload.php',

0 commit comments

Comments
 (0)