Skip to content

Commit 9ad67a9

Browse files
Narrow types
1 parent c0e73db commit 9ad67a9

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

src/Chunk.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,15 @@ final class Chunk implements IteratorAggregate
2222
private int $startRange;
2323
private int $end;
2424
private int $endRange;
25+
26+
/**
27+
* @var list<Line>
28+
*/
2529
private array $lines;
2630

31+
/**
32+
* @param list<Line> $lines
33+
*/
2734
public function __construct(int $start = 0, int $startRange = 1, int $end = 0, int $endRange = 1, array $lines = [])
2835
{
2936
$this->start = $start;

src/Differ.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,21 @@ public function __construct(DiffOutputBuilderInterface $outputBuilder)
4242
$this->outputBuilder = $outputBuilder;
4343
}
4444

45+
/**
46+
* @param list<string>|string $from
47+
* @param list<string>|string $to
48+
*/
4549
public function diff(array|string $from, array|string $to, ?LongestCommonSubsequenceCalculator $lcs = null): string
4650
{
4751
$diff = $this->diffToArray($from, $to, $lcs);
4852

4953
return $this->outputBuilder->getDiff($diff);
5054
}
5155

56+
/**
57+
* @param list<string>|string $from
58+
* @param list<string>|string $to
59+
*/
5260
public function diffToArray(array|string $from, array|string $to, ?LongestCommonSubsequenceCalculator $lcs = null): array
5361
{
5462
if (is_string($from)) {

src/Exception/ConfigurationException.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,8 @@
1616

1717
final class ConfigurationException extends InvalidArgumentException
1818
{
19-
public function __construct(
20-
string $option,
21-
string $expected,
22-
$value,
23-
int $code = 0,
24-
?Exception $previous = null
25-
) {
19+
public function __construct(string $option, string $expected, mixed $value, int $code = 0, ?Exception $previous = null)
20+
{
2621
parent::__construct(
2722
sprintf(
2823
'Option "%s" must be %s, got "%s".',

0 commit comments

Comments
 (0)