Skip to content
Snippets Groups Projects
Unverified Commit 9ad67a92 authored by Sebastian Bergmann's avatar Sebastian Bergmann
Browse files

Narrow types

parent c0e73dbf
No related branches found
No related tags found
No related merge requests found
......@@ -22,8 +22,15 @@ final class Chunk implements IteratorAggregate
private int $startRange;
private int $end;
private int $endRange;
/**
* @var list<Line>
*/
private array $lines;
/**
* @param list<Line> $lines
*/
public function __construct(int $start = 0, int $startRange = 1, int $end = 0, int $endRange = 1, array $lines = [])
{
$this->start = $start;
......
......@@ -42,6 +42,10 @@ final class Differ
$this->outputBuilder = $outputBuilder;
}
/**
* @param list<string>|string $from
* @param list<string>|string $to
*/
public function diff(array|string $from, array|string $to, ?LongestCommonSubsequenceCalculator $lcs = null): string
{
$diff = $this->diffToArray($from, $to, $lcs);
......@@ -49,6 +53,10 @@ final class Differ
return $this->outputBuilder->getDiff($diff);
}
/**
* @param list<string>|string $from
* @param list<string>|string $to
*/
public function diffToArray(array|string $from, array|string $to, ?LongestCommonSubsequenceCalculator $lcs = null): array
{
if (is_string($from)) {
......
......@@ -16,13 +16,8 @@ use Exception;
final class ConfigurationException extends InvalidArgumentException
{
public function __construct(
string $option,
string $expected,
$value,
int $code = 0,
?Exception $previous = null
) {
public function __construct(string $option, string $expected, mixed $value, int $code = 0, ?Exception $previous = null)
{
parent::__construct(
sprintf(
'Option "%s" must be %s, got "%s".',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment