Skip to content

Commit 01eb2de

Browse files
committed
Sort ordered_class_elements alphabetically
1 parent 25f0f7b commit 01eb2de

File tree

3 files changed

+44
-44
lines changed

3 files changed

+44
-44
lines changed

PhpCsFixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
// There should not be space before or after object operators `->` and `?->`.
193193
'object_operator_without_whitespace' => true,
194194
// Orders the elements of classes/interfaces/traits.
195-
'ordered_class_elements' => ['order'=>['use_trait','constant_public','constant_protected','constant_private','property_public','property_protected','property_private','construct','destruct','magic','phpunit','method_public','method_protected','method_private']],
195+
'ordered_class_elements' => ['sort_algorithm' => 'alpha'],
196196
// Ordering `use` statements.
197197
'ordered_imports' => true,
198198
// Orders the interfaces in an `implements` or `interface extends` clause.

src/PHPFUI/PHPUnitSyntaxCoverage/ClassFinder.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ public function enterNode(int|\PhpParser\Node|null $node)
3535
return $node;
3636
}
3737

38-
public function getNamespace() : string
39-
{
40-
return $this->currentNamespace;
41-
}
42-
4338
/**
4439
* @return array<string>
4540
*/
4641
public function getClasses() : array
4742
{
4843
return $this->classes;
4944
}
45+
46+
public function getNamespace() : string
47+
{
48+
return $this->currentNamespace;
49+
}
5050
}

src/PHPFUI/PHPUnitSyntaxCoverage/Extensions.php

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
class Extensions extends \PHPUnit\Framework\TestCase
1616
{
17+
private ?\PHPFUI\PHPUnitSyntaxCoverage\ClassFinder $classFinder = null;
18+
1719
private static \PhpParser\Parser $parser;
1820

1921
/**
@@ -30,8 +32,6 @@ class Extensions extends \PHPUnit\Framework\TestCase
3032

3133
private ?\PhpParser\NodeTraverser $traverser = null;
3234

33-
private ?\PHPFUI\PHPUnitSyntaxCoverage\ClassFinder $classFinder = null;
34-
3535
public static function setUpBeforeClass() : void
3636
{
3737
$factory = new \PhpParser\ParserFactory();
@@ -50,6 +50,32 @@ protected function tearDown() : void
5050
$this->classFinder = null;
5151
}
5252

53+
/**
54+
* Exclude any file with this $directory string in the path.
55+
*
56+
* Only a simple stripos is used to match anything in the file name.
57+
*
58+
* You can add multiple skips.
59+
*/
60+
public function addSkipDirectory(string $directory) : self
61+
{
62+
$this->skipDirectories[] = $directory;
63+
64+
return $this;
65+
}
66+
67+
/**
68+
* Exclude namespace from namespace testing
69+
*
70+
* You can add multiple namespaces to skip.
71+
*/
72+
public function addSkipNamespace(string $namespace) : self
73+
{
74+
$this->skipNamespaces[] = $namespace;
75+
76+
return $this;
77+
}
78+
5379
/**
5480
* Assert a string containing valid PHP will parse.
5581
*
@@ -87,42 +113,6 @@ public function assertValidPHP(string $code, string $message = '') : void
87113
}
88114
}
89115

90-
/**
91-
* Exclude any file with this $directory string in the path.
92-
*
93-
* Only a simple stripos is used to match anything in the file name.
94-
*
95-
* You can add multiple skips.
96-
*/
97-
public function addSkipDirectory(string $directory) : self
98-
{
99-
$this->skipDirectories[] = $directory;
100-
101-
return $this;
102-
}
103-
104-
/**
105-
* Skip namespace testing
106-
*/
107-
public function skipNamespaceTesting() : self
108-
{
109-
$this->skipNamespaceTest = true;
110-
111-
return $this;
112-
}
113-
114-
/**
115-
* Exclude namespace from namespace testing
116-
*
117-
* You can add multiple namespaces to skip.
118-
*/
119-
public function addSkipNamespace(string $namespace) : self
120-
{
121-
$this->skipNamespaces[] = $namespace;
122-
123-
return $this;
124-
}
125-
126116
/**
127117
* Validate all files in a directory. Recursive and only looks at .php files by default.
128118
*
@@ -200,4 +190,14 @@ public function assertValidPHPFile(string $fileName, string $message = '') : voi
200190
}
201191
}
202192
}
193+
194+
/**
195+
* Skip namespace testing
196+
*/
197+
public function skipNamespaceTesting() : self
198+
{
199+
$this->skipNamespaceTest = true;
200+
201+
return $this;
202+
}
203203
}

0 commit comments

Comments
 (0)