Skip to content

Commit d9ecb1a

Browse files
committed
[TypeInfo] Fix converting list to string
It should print `list<type>` instead of `array<type>`
1 parent 1dc93b0 commit d9ecb1a

File tree

8 files changed

+29
-29
lines changed

8 files changed

+29
-29
lines changed

Tests/CacheWarmer/StreamerCacheWarmerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,17 @@ public function testWarmUp()
5050

5151
$this->assertSame([
5252
\sprintf('%s/13791ba3dc4369dc488ec78466326979.json.php', $this->streamWritersDir),
53+
\sprintf('%s/30812f0966dfa8321b2976fca874c2c6.json.php', $this->streamWritersDir),
5354
\sprintf('%s/3d6bea319060b50305c349746ac6cabc.json.php', $this->streamWritersDir),
54-
\sprintf('%s/6f7c0ed338bb3b8730cc67686a91941b.json.php', $this->streamWritersDir),
5555
], glob($this->streamWritersDir.'/*'));
5656

5757
$this->assertSame([
5858
\sprintf('%s/13791ba3dc4369dc488ec78466326979.json.php', $this->streamReadersDir),
5959
\sprintf('%s/13791ba3dc4369dc488ec78466326979.json.stream.php', $this->streamReadersDir),
60+
\sprintf('%s/30812f0966dfa8321b2976fca874c2c6.json.php', $this->streamReadersDir),
61+
\sprintf('%s/30812f0966dfa8321b2976fca874c2c6.json.stream.php', $this->streamReadersDir),
6062
\sprintf('%s/3d6bea319060b50305c349746ac6cabc.json.php', $this->streamReadersDir),
6163
\sprintf('%s/3d6bea319060b50305c349746ac6cabc.json.stream.php', $this->streamReadersDir),
62-
\sprintf('%s/6f7c0ed338bb3b8730cc67686a91941b.json.php', $this->streamReadersDir),
63-
\sprintf('%s/6f7c0ed338bb3b8730cc67686a91941b.json.stream.php', $this->streamReadersDir),
6464
], glob($this->streamReadersDir.'/*'));
6565
}
6666

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
return static function (mixed $stream, \Psr\Container\ContainerInterface $valueTransformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
4-
$providers['array<int,mixed>'] = static function ($stream, $offset, $length) use ($options, $valueTransformers, $instantiator, &$providers) {
4+
$providers['list<mixed>'] = static function ($stream, $offset, $length) use ($options, $valueTransformers, $instantiator, &$providers) {
55
$data = \Symfony\Component\JsonStreamer\Read\Splitter::splitList($stream, $offset, $length);
66
$iterable = static function ($stream, $data) use ($options, $valueTransformers, $instantiator, &$providers) {
77
foreach ($data as $k => $v) {
@@ -10,5 +10,5 @@
1010
};
1111
return \iterator_to_array($iterable($stream, $data));
1212
};
13-
return $providers['array<int,mixed>']($stream, 0, null);
13+
return $providers['list<mixed>']($stream, 0, null);
1414
};
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
return static function (string|\Stringable $string, \Psr\Container\ContainerInterface $valueTransformers, \Symfony\Component\JsonStreamer\Read\Instantiator $instantiator, array $options): mixed {
4-
$providers['array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>'] = static function ($data) use ($options, $valueTransformers, $instantiator, &$providers) {
4+
$providers['list<Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>'] = static function ($data) use ($options, $valueTransformers, $instantiator, &$providers) {
55
$iterable = static function ($data) use ($options, $valueTransformers, $instantiator, &$providers) {
66
foreach ($data as $k => $v) {
77
yield $k => $providers['Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy']($v);
@@ -14,14 +14,14 @@
1414
return '_symfony_missing_value' !== $v;
1515
}));
1616
};
17-
$providers['array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>|null'] = static function ($data) use ($options, $valueTransformers, $instantiator, &$providers) {
17+
$providers['list<Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>|null'] = static function ($data) use ($options, $valueTransformers, $instantiator, &$providers) {
1818
if (\is_array($data) && \array_is_list($data)) {
19-
return $providers['array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>']($data);
19+
return $providers['list<Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>']($data);
2020
}
2121
if (null === $data) {
2222
return null;
2323
}
24-
throw new \Symfony\Component\JsonStreamer\Exception\UnexpectedValueException(\sprintf('Unexpected "%s" value for "array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>|null".', \get_debug_type($data)));
24+
throw new \Symfony\Component\JsonStreamer\Exception\UnexpectedValueException(\sprintf('Unexpected "%s" value for "list<Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>|null".', \get_debug_type($data)));
2525
};
26-
return $providers['array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>|null'](\Symfony\Component\JsonStreamer\Read\Decoder::decodeString((string) $string));
26+
return $providers['list<Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>|null'](\Symfony\Component\JsonStreamer\Read\Decoder::decodeString((string) $string));
2727
};

Tests/Fixtures/stream_reader/nullable_object_list.stream.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
return static function (mixed $stream, \Psr\Container\ContainerInterface $valueTransformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
4-
$providers['array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>'] = static function ($stream, $offset, $length) use ($options, $valueTransformers, $instantiator, &$providers) {
4+
$providers['list<Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>'] = static function ($stream, $offset, $length) use ($options, $valueTransformers, $instantiator, &$providers) {
55
$data = \Symfony\Component\JsonStreamer\Read\Splitter::splitList($stream, $offset, $length);
66
$iterable = static function ($stream, $data) use ($options, $valueTransformers, $instantiator, &$providers) {
77
foreach ($data as $k => $v) {
@@ -22,15 +22,15 @@
2222
}
2323
});
2424
};
25-
$providers['array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>|null'] = static function ($stream, $offset, $length) use ($options, $valueTransformers, $instantiator, &$providers) {
25+
$providers['list<Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>|null'] = static function ($stream, $offset, $length) use ($options, $valueTransformers, $instantiator, &$providers) {
2626
$data = \Symfony\Component\JsonStreamer\Read\Decoder::decodeStream($stream, $offset, $length);
2727
if (\is_array($data) && \array_is_list($data)) {
28-
return $providers['array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>']($data);
28+
return $providers['list<Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>']($data);
2929
}
3030
if (null === $data) {
3131
return null;
3232
}
33-
throw new \Symfony\Component\JsonStreamer\Exception\UnexpectedValueException(\sprintf('Unexpected "%s" value for "array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>|null".', \get_debug_type($data)));
33+
throw new \Symfony\Component\JsonStreamer\Exception\UnexpectedValueException(\sprintf('Unexpected "%s" value for "list<Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>|null".', \get_debug_type($data)));
3434
};
35-
return $providers['array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>|null']($stream, 0, null);
35+
return $providers['list<Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>|null']($stream, 0, null);
3636
};

Tests/Fixtures/stream_reader/object_list.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
return static function (string|\Stringable $string, \Psr\Container\ContainerInterface $valueTransformers, \Symfony\Component\JsonStreamer\Read\Instantiator $instantiator, array $options): mixed {
4-
$providers['array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>'] = static function ($data) use ($options, $valueTransformers, $instantiator, &$providers) {
4+
$providers['list<Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>'] = static function ($data) use ($options, $valueTransformers, $instantiator, &$providers) {
55
$iterable = static function ($data) use ($options, $valueTransformers, $instantiator, &$providers) {
66
foreach ($data as $k => $v) {
77
yield $k => $providers['Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy']($v);
@@ -14,5 +14,5 @@
1414
return '_symfony_missing_value' !== $v;
1515
}));
1616
};
17-
return $providers['array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>'](\Symfony\Component\JsonStreamer\Read\Decoder::decodeString((string) $string));
17+
return $providers['list<Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>'](\Symfony\Component\JsonStreamer\Read\Decoder::decodeString((string) $string));
1818
};

Tests/Fixtures/stream_reader/object_list.stream.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
return static function (mixed $stream, \Psr\Container\ContainerInterface $valueTransformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
4-
$providers['array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>'] = static function ($stream, $offset, $length) use ($options, $valueTransformers, $instantiator, &$providers) {
4+
$providers['list<Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>'] = static function ($stream, $offset, $length) use ($options, $valueTransformers, $instantiator, &$providers) {
55
$data = \Symfony\Component\JsonStreamer\Read\Splitter::splitList($stream, $offset, $length);
66
$iterable = static function ($stream, $data) use ($options, $valueTransformers, $instantiator, &$providers) {
77
foreach ($data as $k => $v) {
@@ -22,5 +22,5 @@
2222
}
2323
});
2424
};
25-
return $providers['array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>']($stream, 0, null);
25+
return $providers['list<Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>']($stream, 0, null);
2626
};

Tests/Fixtures/stream_reader/union.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
return static function (string|\Stringable $string, \Psr\Container\ContainerInterface $valueTransformers, \Symfony\Component\JsonStreamer\Read\Instantiator $instantiator, array $options): mixed {
4-
$providers['array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>'] = static function ($data) use ($options, $valueTransformers, $instantiator, &$providers) {
4+
$providers['list<Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>'] = static function ($data) use ($options, $valueTransformers, $instantiator, &$providers) {
55
$iterable = static function ($data) use ($options, $valueTransformers, $instantiator, &$providers) {
66
foreach ($data as $k => $v) {
77
yield $k => $providers['Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum']($v);
@@ -17,17 +17,17 @@
1717
return '_symfony_missing_value' !== $v;
1818
}));
1919
};
20-
$providers['Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes|array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>|int'] = static function ($data) use ($options, $valueTransformers, $instantiator, &$providers) {
20+
$providers['Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes|int|list<Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>'] = static function ($data) use ($options, $valueTransformers, $instantiator, &$providers) {
2121
if (\is_array($data) && \array_is_list($data)) {
22-
return $providers['array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>']($data);
22+
return $providers['list<Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>']($data);
2323
}
2424
if (\is_array($data)) {
2525
return $providers['Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes']($data);
2626
}
2727
if (\is_int($data)) {
2828
return $data;
2929
}
30-
throw new \Symfony\Component\JsonStreamer\Exception\UnexpectedValueException(\sprintf('Unexpected "%s" value for "Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes|array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>|int".', \get_debug_type($data)));
30+
throw new \Symfony\Component\JsonStreamer\Exception\UnexpectedValueException(\sprintf('Unexpected "%s" value for "Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes|int|list<Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>".', \get_debug_type($data)));
3131
};
32-
return $providers['Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes|array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>|int'](\Symfony\Component\JsonStreamer\Read\Decoder::decodeString((string) $string));
32+
return $providers['Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes|int|list<Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>'](\Symfony\Component\JsonStreamer\Read\Decoder::decodeString((string) $string));
3333
};

Tests/Fixtures/stream_reader/union.stream.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
return static function (mixed $stream, \Psr\Container\ContainerInterface $valueTransformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
4-
$providers['array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>'] = static function ($stream, $offset, $length) use ($options, $valueTransformers, $instantiator, &$providers) {
4+
$providers['list<Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>'] = static function ($stream, $offset, $length) use ($options, $valueTransformers, $instantiator, &$providers) {
55
$data = \Symfony\Component\JsonStreamer\Read\Splitter::splitList($stream, $offset, $length);
66
$iterable = static function ($stream, $data) use ($options, $valueTransformers, $instantiator, &$providers) {
77
foreach ($data as $k => $v) {
@@ -25,18 +25,18 @@
2525
}
2626
});
2727
};
28-
$providers['Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes|array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>|int'] = static function ($stream, $offset, $length) use ($options, $valueTransformers, $instantiator, &$providers) {
28+
$providers['Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes|int|list<Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>'] = static function ($stream, $offset, $length) use ($options, $valueTransformers, $instantiator, &$providers) {
2929
$data = \Symfony\Component\JsonStreamer\Read\Decoder::decodeStream($stream, $offset, $length);
3030
if (\is_array($data) && \array_is_list($data)) {
31-
return $providers['array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>']($data);
31+
return $providers['list<Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>']($data);
3232
}
3333
if (\is_array($data)) {
3434
return $providers['Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes']($data);
3535
}
3636
if (\is_int($data)) {
3737
return $data;
3838
}
39-
throw new \Symfony\Component\JsonStreamer\Exception\UnexpectedValueException(\sprintf('Unexpected "%s" value for "Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes|array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>|int".', \get_debug_type($data)));
39+
throw new \Symfony\Component\JsonStreamer\Exception\UnexpectedValueException(\sprintf('Unexpected "%s" value for "Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes|int|list<Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>".', \get_debug_type($data)));
4040
};
41-
return $providers['Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes|array<int,Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>|int']($stream, 0, null);
41+
return $providers['Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes|int|list<Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>']($stream, 0, null);
4242
};

0 commit comments

Comments
 (0)