Skip to content

Commit

Permalink
#132 - change order in OrderedClassElementsFixer (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
Baakoma authored Dec 13, 2024
1 parent 7aecbaf commit de3ff09
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/Configuration/Defaults/CommonRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,20 +162,20 @@ class CommonRules extends Rules
"constant_public",
"constant_protected",
"constant_private",
"property_public_static",
"property_protected_static",
"property_private_static",
"property_public",
"property_protected",
"property_private",
"construct",
"destruct",
"magic",
"phpunit",
"property_public_static",
"method_public_static",
"method_public",
"property_protected_static",
"method_protected_static",
"method_protected",
"property_private_static",
"method_private_static",
"method_private",
],
Expand Down
10 changes: 8 additions & 2 deletions tests/fixtures/orderedClassElements/actual.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
<?php

class Example {
private static $staticVar = "Error";
protected static $staticClass = Error::class;
public static $staticLaravel = "LaravelPaths";
private string $var = "Error";
protected string $class = Error::class;
public string $laravel = "LaravelPaths";
public const PublicLaravel = "PublicLaravel";
protected const ProtectedLaravel = "ProtectedLaravel";
private const PrivateLaravel = "PrivateLaravel";

public function test(): void
public function test321(): void
{
}

public static function testStatic(): void
public static function testStatic123(): void
{
}

Expand Down
11 changes: 9 additions & 2 deletions tests/fixtures/orderedClassElements/expected.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,22 @@ class Example
{
use Castable;

public const PublicLaravel = "PublicLaravel";
protected const ProtectedLaravel = "ProtectedLaravel";
private const PrivateLaravel = "PrivateLaravel";

public static $staticLaravel = "LaravelPaths";
protected static $staticClass = Error::class;
private static $staticVar = "Error";
public string $laravel = "LaravelPaths";
protected string $class = Error::class;
private string $var = "Error";

public static function testStatic(): void
public static function testStatic123(): void
{
}

public function test(): void
public function test321(): void
{
}

Expand Down

0 comments on commit de3ff09

Please sign in to comment.