-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFixers.php
More file actions
35 lines (29 loc) · 868 Bytes
/
Fixers.php
File metadata and controls
35 lines (29 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
namespace whatwedo\PhpCodingStandard;
use PhpCsFixer\Fixer\FixerInterface;
/**
* @implements \IteratorAggregate<FixerInterface>
*/
final class Fixers implements \IteratorAggregate
{
/**
* @return \Generator<FixerInterface>
*/
public function getIterator(): \Generator
{
$classNames = [];
foreach (new \DirectoryIterator(__DIR__ . '/Fixer') as $fileInfo) {
$fileName = $fileInfo->getBasename('.php');
if (\in_array($fileName, ['.', '..', 'FixerTrait'], true)) {
continue;
}
$classNames[] = __NAMESPACE__ . '\\Fixer\\' . $fileName;
}
\sort($classNames);
foreach ($classNames as $className) {
$fixer = new $className();
\assert($fixer instanceof FixerInterface);
yield $fixer;
}
}
}