Skip to content

Commit

Permalink
ordered_imports & blank_line_between_import_groups
Browse files Browse the repository at this point in the history
  • Loading branch information
realodix committed Jul 29, 2024
1 parent 0c06a54 commit 890ee7d
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 6 deletions.
42 changes: 41 additions & 1 deletion tests/Fixtures/Ruleset/relax-commonbox2_actual.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,46 @@
<?php // blank_line_after_opening_tag
namespace Realodix\Relax; // blank_lines_before_namespace, no_leading_namespace_whitespace

namespace OtherNamespace; // blank_lines_before_namespace
// blank_line_after_namespace

const AAAA = "";
const BBB = "";

namespace Realodix\Relax; // no_leading_namespace_whitespace

use const OtherNamespace\BBB;
use const OtherNamespace\AAAA;
use OtherNamespace\Acme;
use OtherNamespace\AAC;
use OtherNamespace\Bar;
use function DDD;
use function CCC\AA;

/**
* ordered_imports
* blank_line_between_import_groups
*/
class Commonbox2
{
public function funcClass()
{
new AAC;
new Acme;
new Bar;
}

public function funcFunction()
{
AA();
DDD();
}

public function funcConst()
{
echo AAAA;
echo BBB;
}
}

// no_closing_tag
?>
43 changes: 42 additions & 1 deletion tests/Fixtures/Ruleset/relax-commonbox2_expected.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,49 @@

// blank_line_after_opening_tag

namespace Realodix\Relax; // blank_lines_before_namespace, no_leading_namespace_whitespace
namespace OtherNamespace; // blank_lines_before_namespace

// blank_line_after_namespace

const AAAA = '';
const BBB = '';

namespace Realodix\Relax; // no_leading_namespace_whitespace

use const OtherNamespace\AAAA;
use const OtherNamespace\BBB;

use OtherNamespace\AAC;
use OtherNamespace\Acme;
use OtherNamespace\Bar;

use function CCC\AA;
use function DDD;

/**
* ordered_imports
* blank_line_between_import_groups
*/
class Commonbox2
{
public function funcClass()
{
new AAC;
new Acme;
new Bar;
}

public function funcFunction()
{
AA();
DDD();
}

public function funcConst()
{
echo AAAA;
echo BBB;
}
}

// no_closing_tag
2 changes: 0 additions & 2 deletions tests/Fixtures/Ruleset/relax_actual.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use Realodix\Relax\no_unneeded_import_alias as no_unneeded_import_alias;
use Realodix\Relax\no_unused_imports;


use function \is_string;
class relax_actual extends no_unneeded_import_alias
{
/**
Expand Down
2 changes: 0 additions & 2 deletions tests/Fixtures/Ruleset/relax_expected.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
declare(strict_types=1);
use Realodix\Relax\no_unneeded_import_alias;

use function is_string;

class relax_actual extends no_unneeded_import_alias
{
/**
Expand Down

0 comments on commit 890ee7d

Please sign in to comment.