Skip to content

Commit 139feda

Browse files
Merge branch '7.4' into 8.0
* 7.4: [TypeInfo] Simple array should be array type Handle signals on text input [TwigBridge] Fix form constraint [Runtime] Reuse the already created Request object when the app needs it as argument returns a kernel [Config] Fix array shape generation for backed enums [Config] Define `TreeBuilder` default generic type Update validators.el.xlf Fix MoneyType: add missing step attribute when html5=true [JsonStreamer] fix invalid json output for list of self [Console] Preserve `--help` option when a command is not found [FrameworkBundle] Fix using `FailedMessages*Command` with `SigningSerializer` [Lock] Fix unserializing already serialized Key payloads [HttpClient] CachingHttpClient must run after UriTemplate and Scoping Only register PhpConfigReferenceDumpPass in dev env with debug flag enabled [Messenger] Fix PHP 8.5 deprecation for pgsqlGetNotify() in PostgreSQL transport chore: PHP CS Fixer - do not use deprecated sets in config verify spanish translations with state needs-review-translation [Security] Fix OIDC discovery when using multiple HttpClient instances [DependencyInjection] Allow manual bindings on parameters with #[Target]
2 parents 56af61f + 95791ff commit 139feda

16 files changed

+350
-6
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Symfony\Component\JsonStreamer\Tests\Fixtures\Model;
4+
5+
class DummyWithList
6+
{
7+
/** @var list<ClassicDummy> */
8+
public array $dummies;
9+
10+
public string $customProperty;
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Fixtures\Model;
4+
5+
namespace Symfony\Component\JsonStreamer\Tests\Fixtures\Model;
6+
7+
class DummyWithNestedDictDummies
8+
{
9+
/** @var array<string, DummyWithNestedDictDummies> */
10+
public array $dummies = [];
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Symfony\Component\JsonStreamer\Tests\Fixtures\Model;
4+
5+
class DummyWithNestedList
6+
{
7+
/** @var list<DummyWithList> */
8+
public array $dummies;
9+
10+
public string $stringProperty;
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Fixtures\Model;
4+
5+
namespace Symfony\Component\JsonStreamer\Tests\Fixtures\Model;
6+
7+
class DummyWithNestedListDummies
8+
{
9+
/** @var DummyWithNestedListDummies[] */
10+
public array $dummies = [];
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Symfony\Component\JsonStreamer\Tests\Fixtures\Model;
4+
5+
class SelfReferencingDummyDict
6+
{
7+
/**
8+
* @var array<string, self>
9+
*/
10+
public array $items = [];
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Symfony\Component\JsonStreamer\Tests\Fixtures\Model;
4+
5+
class SelfReferencingDummyList
6+
{
7+
/**
8+
* @var self[]
9+
*/
10+
public array $items = [];
11+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
return static function (mixed $data, \Psr\Container\ContainerInterface $valueTransformers, array $options): \Traversable {
4+
try {
5+
yield '[';
6+
$prefix = '';
7+
foreach ($data as $value1) {
8+
yield $prefix;
9+
yield '{"dummies":{';
10+
$prefix = '';
11+
foreach ($value1->dummies as $key2 => $value2) {
12+
$key2 = is_int($key2) ? $key2 : \substr(\json_encode($key2), 1, -1);
13+
yield "{$prefix}\"{$key2}\":";
14+
yield '{"dummies":{';
15+
$prefix = '';
16+
foreach ($value2->dummies as $key3 => $value3) {
17+
$key3 = is_int($key3) ? $key3 : \substr(\json_encode($key3), 1, -1);
18+
yield "{$prefix}\"{$key3}\":";
19+
yield '{"id":';
20+
yield \json_encode($value3->id, \JSON_THROW_ON_ERROR, 506);
21+
yield ',"name":';
22+
yield \json_encode($value3->name, \JSON_THROW_ON_ERROR, 506);
23+
yield '}';
24+
$prefix = ',';
25+
}
26+
yield '},"customProperty":';
27+
yield \json_encode($value2->customProperty, \JSON_THROW_ON_ERROR, 508);
28+
yield '}';
29+
$prefix = ',';
30+
}
31+
yield '},"stringProperty":';
32+
yield \json_encode($value1->stringProperty, \JSON_THROW_ON_ERROR, 510);
33+
yield '}';
34+
$prefix = ',';
35+
}
36+
yield ']';
37+
} catch (\JsonException $e) {
38+
throw new \Symfony\Component\JsonStreamer\Exception\NotEncodableValueException($e->getMessage(), 0, $e);
39+
}
40+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
return static function (mixed $data, \Psr\Container\ContainerInterface $valueTransformers, array $options): \Traversable {
4+
try {
5+
yield '[';
6+
$prefix = '';
7+
foreach ($data as $value1) {
8+
yield $prefix;
9+
yield '{"dummies":{';
10+
$prefix = '';
11+
foreach ($value1->dummies as $key2 => $value2) {
12+
$key2 = is_int($key2) ? $key2 : \substr(\json_encode($key2), 1, -1);
13+
yield "{$prefix}\"{$key2}\":";
14+
yield '{"id":';
15+
yield \json_encode($value2->id, \JSON_THROW_ON_ERROR, 508);
16+
yield ',"name":';
17+
yield \json_encode($value2->name, \JSON_THROW_ON_ERROR, 508);
18+
yield '}';
19+
$prefix = ',';
20+
}
21+
yield '},"customProperty":';
22+
yield \json_encode($value1->customProperty, \JSON_THROW_ON_ERROR, 510);
23+
yield '}';
24+
$prefix = ',';
25+
}
26+
yield ']';
27+
} catch (\JsonException $e) {
28+
throw new \Symfony\Component\JsonStreamer\Exception\NotEncodableValueException($e->getMessage(), 0, $e);
29+
}
30+
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/**
4+
* @param Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNestedDictDummies $data
5+
*/
6+
return static function (mixed $data, \Psr\Container\ContainerInterface $valueTransformers, array $options): \Traversable {
7+
$generators['Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNestedDictDummies'] = static function ($data, $depth) use ($valueTransformers, $options, &$generators) {
8+
if ($depth >= 512) {
9+
throw new \Symfony\Component\JsonStreamer\Exception\NotEncodableValueException('Maximum stack depth exceeded');
10+
}
11+
$prefix1 = '';
12+
yield "{{$prefix1}\"dummies\":";
13+
yield "{";
14+
$prefix2 = '';
15+
foreach ($data->dummies as $key1 => $value1) {
16+
$key1 = \substr(\json_encode($key1), 1, -1);
17+
yield "{$prefix2}\"{$key1}\":";
18+
yield from $generators['Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNestedDictDummies']($value1, $depth + 1);
19+
$prefix2 = ',';
20+
}
21+
yield "}}";
22+
};
23+
try {
24+
yield from $generators['Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNestedDictDummies']($data, 0);
25+
} catch (\JsonException $e) {
26+
throw new \Symfony\Component\JsonStreamer\Exception\NotEncodableValueException($e->getMessage(), 0, $e);
27+
}
28+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
/**
4+
* @param Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNestedListDummies $data
5+
*/
6+
return static function (mixed $data, \Psr\Container\ContainerInterface $valueTransformers, array $options): \Traversable {
7+
$generators['Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNestedListDummies'] = static function ($data, $depth) use ($valueTransformers, $options, &$generators) {
8+
if ($depth >= 512) {
9+
throw new \Symfony\Component\JsonStreamer\Exception\NotEncodableValueException('Maximum stack depth exceeded');
10+
}
11+
$prefix1 = '';
12+
yield "{{$prefix1}\"dummies\":";
13+
yield "[";
14+
$prefix2 = '';
15+
foreach ($data->dummies as $value1) {
16+
yield "{$prefix2}";
17+
yield from $generators['Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNestedListDummies']($value1, $depth + 1);
18+
$prefix2 = ',';
19+
}
20+
yield "]}";
21+
};
22+
try {
23+
yield from $generators['Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNestedListDummies']($data, 0);
24+
} catch (\JsonException $e) {
25+
throw new \Symfony\Component\JsonStreamer\Exception\NotEncodableValueException($e->getMessage(), 0, $e);
26+
}
27+
};

0 commit comments

Comments
 (0)