Skip to content

Commit

Permalink
Narrow types
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Mar 27, 2023
1 parent d22c334 commit 98ca6fd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Parser.php
Expand Up @@ -20,7 +20,7 @@
final class Parser
{
/**
* @psalm-return Generator<int, array<string, mixed>>
* @psalm-return Generator<int, array<string, bool|int|float|object|string>>
*
* @throws CannotReadCsvFileException
* @throws OutOfBoundsException
Expand All @@ -39,7 +39,7 @@ public function parse(string $filename, Schema $schema, bool $ignoreFirstLine):
}

/**
* @psalm-return Generator<int, array<string, mixed>>
* @psalm-return Generator<int, array<string, bool|int|float|object|string>>
*/
private function generator(SplFileObject $file, Schema $schema, bool $ignoreFirstLine): Generator
{
Expand Down
2 changes: 1 addition & 1 deletion src/schema/ColumnDefinition.php
Expand Up @@ -51,7 +51,7 @@ private function __construct(int $position, string $name, Type $type)

/**
* @psalm-param list<string> $input
* @psalm-param array<string, mixed> $output
* @psalm-param array<string, bool|int|float|object|string> $output
*
* @throws OutOfBoundsException
*/
Expand Down
2 changes: 1 addition & 1 deletion src/schema/Schema.php
Expand Up @@ -42,7 +42,7 @@ private function __construct(array $columnDefinitions)
/**
* @psalm-param list<string> $line
*
* @psalm-return array<string, mixed>
* @psalm-return array<string, bool|int|float|object|string>
*/
public function apply(array $line): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/schema/type/Type.php
Expand Up @@ -45,5 +45,5 @@ private function __construct()
{
}

abstract public function apply(string $value): mixed;
abstract public function apply(string $value): bool|int|float|object|string;
}

0 comments on commit 98ca6fd

Please sign in to comment.