-
-
Notifications
You must be signed in to change notification settings - Fork 439
Expand file tree
/
Copy pathRectorTestResult.php
More file actions
40 lines (32 loc) · 926 Bytes
/
RectorTestResult.php
File metadata and controls
40 lines (32 loc) · 926 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
36
37
38
39
40
<?php
declare(strict_types=1);
namespace Rector\Testing\PHPUnit\ValueObject;
use Rector\Contract\Rector\RectorInterface;
use Rector\Util\RectorClassesSorter;
use Rector\ValueObject\ProcessResult;
/**
* @api used in tests
*/
final readonly class RectorTestResult
{
public function __construct(
private string $changedContents,
private ProcessResult $processResult
) {
}
public function getChangedContents(): string
{
return $this->changedContents;
}
/**
* @return array<class-string<RectorInterface>>
*/
public function getAppliedRectorClasses(): array
{
$rectorClasses = [];
foreach ($this->processResult->getFileDiffs(false) as $fileDiff) {
$rectorClasses = array_merge($rectorClasses, $fileDiff->getRectorClasses());
}
return RectorClassesSorter::sortAndFilterOutPostRectors($rectorClasses);
}
}