Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions cakephp.mago.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/CakePhpExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ final class CakePhpExtension
/**
* Prevents instantiation of the extension factory.
*/
private function __construct()
{
}
private function __construct() {}

/**
* Creates the CakePHP rules extension.
Expand Down
3 changes: 1 addition & 2 deletions src/Linter/Docblock.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ private function __construct(
public Span $span,
public string $text,
public array $tags,
) {
}
) {}

/**
* Finds the docblock immediately preceding a declaration.
Expand Down
3 changes: 1 addition & 2 deletions src/Linter/DocblockTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ public function __construct(
public string $whitespace,
public Span $whitespaceSpan,
public string $value,
) {
}
) {}
}
4 changes: 1 addition & 3 deletions tests/consumer/src/Invalid.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@
namespace App;

// @mago-expect lint:mago-cakephp/trait-suffix
trait Invalid
{
}
trait Invalid {}
4 changes: 1 addition & 3 deletions tests/consumer/tests/ExampleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@

final class ExampleTest
{
public function testExample(): void
{
}
public function testExample(): void {}
}
8 changes: 2 additions & 6 deletions tests/fixer/expected.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading