forked from php/docbook-cs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFix.php
More file actions
33 lines (28 loc) · 859 Bytes
/
Copy pathFix.php
File metadata and controls
33 lines (28 loc) · 859 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
<?php
declare(strict_types=1);
namespace DocbookCS\Fix;
use DocbookCS\Violation\SourceRange;
use DocbookCS\Violation\Violation;
final readonly class Fix
{
public static function fromViolationAndRange(Violation $violation, SourceRange $range, string $replacement): self
{
return new self(
filePath: $violation->filePath,
beginOffset: $range->beginOffset,
untilOffset: $range->untilOffset,
replacement: $replacement,
sniffCode: $violation->sniffCode,
expectedContent: $range->content,
);
}
public function __construct(
public string $filePath,
public int $beginOffset,
public int $untilOffset,
public string $replacement,
public string $sniffCode,
public ?string $expectedContent = null,
) {
}
}