diff --git a/README.md b/README.md index 58e7de2..5341a66 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,8 @@ Review those changes before keeping them. ## What the preset includes -The preset starts from Mago's default rules and applies CakePHP formatting and +Formatting uses Mago's default PER-CS preset with CakePHP overrides. +The preset starts from Mago's default linter rules and applies CakePHP style choices, including short arrays, imported class references, camelCase function names, and `$this->assert…` in PHPUnit tests. It also checks for negated ternary conditions and parameter shadowing. See [cakephp.mago.toml](cakephp.mago.toml) diff --git a/cakephp.mago.toml b/cakephp.mago.toml index a676d0b..911721b 100644 --- a/cakephp.mago.toml +++ b/cakephp.mago.toml @@ -5,10 +5,10 @@ command = ["php", "vendor/cakephp/mago-rules/bin/mago-cakephp-worker"] # Mago owns generic formatting. These settings pin the CakePHP-specific -# choices that differ from, or are important additions to, PSR-12. +# choices that differ from, or are important additions to, PER-CS. [formatter] excludes = ["**/templates/**"] -preset = "psr-12" +preset = "default" print-width = 120 tab-width = 4 use-tabs = false diff --git a/src/CakePhpExtension.php b/src/CakePhpExtension.php index c7a672c..49de3c6 100644 --- a/src/CakePhpExtension.php +++ b/src/CakePhpExtension.php @@ -18,9 +18,7 @@ final class CakePhpExtension /** * Prevents instantiation of the extension factory. */ - private function __construct() - { - } + private function __construct() {} /** * Creates the CakePHP rules extension. diff --git a/src/Linter/Docblock.php b/src/Linter/Docblock.php index 10a8572..3f2db36 100644 --- a/src/Linter/Docblock.php +++ b/src/Linter/Docblock.php @@ -21,8 +21,7 @@ private function __construct( public Span $span, public string $text, public array $tags, - ) { - } + ) {} /** * Finds the docblock immediately preceding a declaration. diff --git a/src/Linter/DocblockTag.php b/src/Linter/DocblockTag.php index ed27cc2..769694b 100644 --- a/src/Linter/DocblockTag.php +++ b/src/Linter/DocblockTag.php @@ -20,6 +20,5 @@ public function __construct( public string $whitespace, public Span $whitespaceSpan, public string $value, - ) { - } + ) {} } diff --git a/tests/consumer/src/Invalid.php b/tests/consumer/src/Invalid.php index 61ff3b6..b36134a 100644 --- a/tests/consumer/src/Invalid.php +++ b/tests/consumer/src/Invalid.php @@ -5,6 +5,4 @@ namespace App; // @mago-expect lint:mago-cakephp/trait-suffix -trait Invalid -{ -} +trait Invalid {} diff --git a/tests/consumer/tests/ExampleTest.php b/tests/consumer/tests/ExampleTest.php index 17de429..9ba46e8 100644 --- a/tests/consumer/tests/ExampleTest.php +++ b/tests/consumer/tests/ExampleTest.php @@ -6,7 +6,5 @@ final class ExampleTest { - public function testExample(): void - { - } + public function testExample(): void {} } diff --git a/tests/fixer/expected.php b/tests/fixer/expected.php index cd838c2..f0e7e73 100644 --- a/tests/fixer/expected.php +++ b/tests/fixer/expected.php @@ -15,16 +15,12 @@ public function chain(): self /** * @inheritDoc */ - public function inherited(): void - { - } + public function inherited(): void {} /** * @inheritDoc */ - public function completelyInherited(): void - { - } + public function completelyInherited(): void {} } if ($first) {