Skip to content

Commit

Permalink
[BUGFIX] Avoid yoda-style conditions in PHP (#31)
Browse files Browse the repository at this point in the history
* [BUGFIX] Avoid yoda-style conditions in PHP

This commit streamlines the PHP-CS-Fixer rules with TYPO3/typo3@0fb53e0
which added configuration to disable yoda-style conditions.

* Fix rules count

Co-authored-by: Simon Gilli <[email protected]>
  • Loading branch information
eliashaeussler and gilbertsoft authored Jul 1, 2022
1 parent 1c6187a commit 8ec5562
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/CsFixerConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class CsFixerConfig extends Config
'single_trait_insert_per_statement' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'whitespace_after_comma_in_array' => true,
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
];

public function __construct(string $name = 'TYPO3')
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/CsFixerConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testCreateReturnsCorrectClass(): void
$config = CsFixerConfig::create();
self::assertInstanceOf(CsFixerConfig::class, $config);
self::assertTrue($config->getRiskyAllowed());
self::assertCount(49, $config->getRules());
self::assertCount(50, $config->getRules());
}

public function testAddRules(): void
Expand Down

0 comments on commit 8ec5562

Please sign in to comment.