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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Latest stable version](https://img.shields.io/packagist/v/kubawerlos/php-cs-fixer-custom-fixers.svg?label=current%20version)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers)
[![PHP version](https://img.shields.io/packagist/php-v/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://php.net)
[![License](https://img.shields.io/github/license/kubawerlos/php-cs-fixer-custom-fixers.svg)](LICENSE)
![Tests](https://img.shields.io/badge/tests-3613-brightgreen.svg)
![Tests](https://img.shields.io/badge/tests-3607-brightgreen.svg)
[![Downloads](https://img.shields.io/packagist/dt/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers)

[![CI status](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/actions/workflows/ci.yaml/badge.svg)](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/actions/workflows/ci.yaml)
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/ConstructorEmptyBracesFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(
}

/**
* Must run after BracesFixer, CurlyBracesPositionFixer, PromotedConstructorPropertyFixer.
* Must run after BracesPositionFixer, PromotedConstructorPropertyFixer.
*/
public function getPriority(): int
{
Expand Down
4 changes: 2 additions & 2 deletions src/Fixer/MultilinePromotedPropertiesFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ public function setWhitespacesConfig(WhitespacesFixerConfig $config): void
}

/**
* Must run before BracesFixer.
* Must run before BracesPositionFixer.
* Must run after PromotedConstructorPropertyFixer.
*/
public function getPriority(): int
{
return 36;
return 0;
}

public function isCandidate(Tokens $tokens): bool
Expand Down
4 changes: 2 additions & 2 deletions src/Fixer/NoDoctrineMigrationsGeneratedCommentFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ public function down(Schema $schema)
}

/**
* Must run before BracesFixer.
* Must run before NoExtraBlankLinesFixer.
*/
public function getPriority(): int
{
return 36;
return 0;
}

public function isCandidate(Tokens $tokens): bool
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/PromotedConstructorPropertyFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function configure(array $configuration): void
}

/**
* Must run before BracesFixer, ClassAttributesSeparationFixer, ConstructorEmptyBracesFixer, MultilinePromotedPropertiesFixer, NoExtraBlankLinesFixer, ReadonlyPromotedPropertiesFixer.
* Must run before ClassAttributesSeparationFixer, ConstructorEmptyBracesFixer, MultilinePromotedPropertiesFixer, NoExtraBlankLinesFixer, ReadonlyPromotedPropertiesFixer.
*/
public function getPriority(): int
{
Expand Down
9 changes: 9 additions & 0 deletions tests/PriorityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace Tests;

use PhpCsFixer\AbstractFixer;
use PhpCsFixer\Fixer\DeprecatedFixerInterface;
use PhpCsFixer\Fixer\FixerInterface;
use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface;
use PhpCsFixer\FixerFactory;
Expand Down Expand Up @@ -45,6 +47,13 @@ public function testPriorities(FixerInterface $firstFixer, FixerInterface $secon
*/
public function testInOrder(FixerInterface $firstFixer, FixerInterface $secondFixer, string $expected, string $input): void
{
if ($firstFixer instanceof AbstractFixer) {
self::assertNotInstanceOf(DeprecatedFixerInterface::class, $firstFixer);
}
if ($secondFixer instanceof AbstractFixer) {
self::assertNotInstanceOf(DeprecatedFixerInterface::class, $secondFixer);
}

Tokens::clearCache();
$tokens = Tokens::fromCode($input);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--CONFIGURATION--
{ "PhpCsFixerCustomFixers/multiline_promoted_properties": true, "braces": true }
{ "PhpCsFixerCustomFixers/multiline_promoted_properties": true, "braces_position": true }
--EXPECTED--
<?php class Foo
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--CONFIGURATION--
{ "PhpCsFixerCustomFixers/no_doctrine_migrations_generated_comment": true, "braces": true }
{ "PhpCsFixerCustomFixers/no_doctrine_migrations_generated_comment": true, "no_extra_blank_lines": {"tokens": ["curly_brace_block"]} }
--EXPECTED--
<?php
use Doctrine\Migrations\AbstractMigration;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--CONFIGURATION--
{ "braces": true, "PhpCsFixerCustomFixers/constructor_empty_braces": true }
{ "braces_position": true, "PhpCsFixerCustomFixers/constructor_empty_braces": true }
--EXPECTED--
<?php class Foo
{
Expand Down

This file was deleted.