Skip to content

Commit d244ee4

Browse files
committed
Improve Item test suite
1 parent 5bf53fc commit d244ee4

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

phpunit.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
5+
bootstrap="vendor/autoload.php"
6+
backupGlobals="false"
7+
colors="true"
8+
processIsolation="false"
9+
stopOnFailure="false"
10+
cacheDirectory=".phpunit.cache"
11+
backupStaticProperties="false"
12+
>
313
<coverage>
414
<include>
515
<directory suffix=".php">src</directory>

src/ItemTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ public static function provideInvalidArguments(): iterable
7575

7676
#[Test]
7777
#[DataProvider('provideFrom1stArgument')]
78-
public function it_instantiate_many_types(mixed $value, string $expected): void
78+
public function it_instantiate_many_types(Value|ByteSequence|Token|DateTimeInterface|Stringable|string|int|float|bool $value, string $expected): void
7979
{
8080
self::assertSame($expected, Item::from($value)->toHttpValue());
8181
}
8282

8383
#[Test]
8484
#[DataProvider('provideFrom1stArgument')]
85-
public function it_updates_item(mixed $value, string $expected): void
85+
public function it_updates_item(Value|ByteSequence|Token|DateTimeInterface|Stringable|string|int|float|bool $value, string $expected): void
8686
{
8787
$parameters = Parameters::fromAssociative(['foo' => 'bar']);
8888
if ($value instanceof Value) {
@@ -96,7 +96,7 @@ public function it_updates_item(mixed $value, string $expected): void
9696
}
9797

9898
/**
99-
* @return iterable<string, array{value:mixed, expected:string}>>
99+
* @return iterable<string, array{value:Value|DataType, expected:string}>>
100100
*/
101101
public static function provideFrom1stArgument(): iterable
102102
{

src/Value.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
namespace Bakame\Http\StructuredFields;
66

77
use DateTimeImmutable;
8-
use DateTimeInterface;
9-
use Stringable;
108

119
/**
12-
* @phpstan-type DataType ByteSequence|Token|DateTimeInterface|Stringable|string|int|float|bool
10+
* @phpstan-type DataType ByteSequence|Token|\DateTimeInterface|\Stringable|string|int|float|bool
1311
*/
1412
interface Value extends ParameterAccess, StructuredField
1513
{
@@ -28,6 +26,8 @@ public function type(): Type;
2826
*
2927
* This method MUST retain the state of the current instance, and return
3028
* an instance that contains the specified value change.
29+
*
30+
* @param Value|DataType $value
3131
*/
3232
public function withValue(mixed $value): static;
3333
}

0 commit comments

Comments
 (0)