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 blink/internal/fixer/rules/priorities.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ var fixerPriority = map[string]int{
"SingleClassElementPerStatementFixer": 56,
"SingleImportPerStatementFixer": 1,
"SingleLineAfterImportsFixer": -11,
"NoBlankLineBetweenImportsFixer": -50,
"NoBlankLineBetweenImportsFixer": -35,
"SpaceAfterCommaHereNowDocFixer": 0,
"ArrayOpenerAndCloserNewlineFixer": 34,
"SingleLineCommentSpacingFixer": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ public function getDefinition(): FixerDefinitionInterface
return new FixerDefinition(self::ERROR_MESSAGE, [new CodeSample("<?php\nuse Foo\\Bar;\n\nuse function Foo\\baz;\n")]);
}

// run after OrderedImportsFixer and BlankLineBetweenImportGroupsFixer
// run after OrderedImportsFixer, before BlankLineBetweenImportGroupsFixer
public function getPriority(): int
{
return -50;
return -35;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace Symplify\CodingStandard\Tests\Fixer\Spacing\NoBlankLineBetweenImportsFixer;

use Iterator;
use PHPUnit\Framework\Attributes\DataProvider;
use Symplify\EasyCodingStandard\Testing\PHPUnit\AbstractCheckerTestCase;

final class NoBlankLineBetweenImportsFixerWithImportGroupsTest extends AbstractCheckerTestCase
{
#[DataProvider('provideData')]
public function test(string $filePath): void
{
$this->doTestFile($filePath);
}

public static function provideData(): Iterator
{
return self::yieldFiles(__DIR__ . '/WithImportGroupsFixture');
}

public function provideConfig(): string
{
return __DIR__ . '/config/with_import_groups_rule.php';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Symplify\CodingStandard\Tests\Fixer\Spacing\NoBlankLineBetweenImportsFixer\WithImportGroupsFixture;

use Foo\Bar;
use Foo\Baz;
use function Foo\baz;

class AddBlankLineBetweenImportGroups
{
}

?>
-----
<?php

namespace Symplify\CodingStandard\Tests\Fixer\Spacing\NoBlankLineBetweenImportsFixer\WithImportGroupsFixture;

use Foo\Bar;
use Foo\Baz;

use function Foo\baz;

class AddBlankLineBetweenImportGroups
{
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Symplify\CodingStandard\Tests\Fixer\Spacing\NoBlankLineBetweenImportsFixer\WithImportGroupsFixture;

use Foo\Bar;

use Foo\Baz;

use function Foo\baz;

class KeepBlankLineBetweenImportGroups
{
}

?>
-----
<?php

namespace Symplify\CodingStandard\Tests\Fixer\Spacing\NoBlankLineBetweenImportsFixer\WithImportGroupsFixture;

use Foo\Bar;
use Foo\Baz;

use function Foo\baz;

class KeepBlankLineBetweenImportGroups
{
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Fixer\Whitespace\BlankLineBetweenImportGroupsFixer;
use Symplify\CodingStandard\Fixer\Spacing\NoBlankLineBetweenImportsFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ECSConfig $ecsConfig): void {
$ecsConfig->rule(BlankLineBetweenImportGroupsFixer::class);
$ecsConfig->rule(NoBlankLineBetweenImportsFixer::class);
};
Loading