Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
rodber committed Feb 12, 2025
1 parent 0a00f29 commit 92f5bb1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/ArgumentsSignatureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use ReflectionFunction;
use function Chevere\Parameter\int;
use function Chevere\Parameter\null;
use function Chevere\Parameter\reflectionToParameters;
use function Chevere\Parameter\union;

final class ArgumentsSignatureTest extends TestCase
{
Expand Down Expand Up @@ -122,4 +125,18 @@ public static function dataProviderVariadic(): array
],
];
}

public function testAllowsNull(): void
{
$fn = function (?int $number): ?int {
return $number;
};
$parameters = reflectionToParameters(
new ReflectionFunction($fn)
);
$this->assertEquals(
$parameters->get('number'),
union(int(), null())
);
}
}

0 comments on commit 92f5bb1

Please sign in to comment.