8000 Merge branch '6.1' into 6.2 · symfony/symfony@f3a9ac1 · GitHub
[go: up one dir, main page]

Skip to content

Commit f3a9ac1

Browse files
Merge branch '6.1' into 6.2
* 6.1: [Workflow] Add ZEturf as backer [Serializer] code cleanup [Serializer] Forget partially collected traces Added missing __call to TraceableEncoder Revert "feature #45092 [HttpFoundation] Send `Content-Length` when calling `Response::send()` and the content is a non-empty string (nicolas-grekas)" [PropertyInfo] Fix extracting int range type [FrameworkBundle] Add alximy as backer of version 6.1 [WebProfilerBundle] Fix AJAX requests info are truncated in the WDT
2 parents 2424b43 + 786e71c commit f3a9ac1

File tree

12 files changed

+93
-56
lines changed

12 files changed

+93
-56
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ div.sf-toolbar .sf-toolbar-block .sf-toolbar-info-piece.sf-toolbar-info-php-ext
336336
.sf-toolbar-block.hover .sf-toolbar-info {
337337
display: block;
338338
padding: 10px;
339-
max-width: 480px;
339+
max-width: 525px;
340340
max-height: 480px;
341341
word-wrap: break-word;
342342
overflow: hidden;

src/Symfony/Component/HttpFoundation/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ CHANGELOG
66

77
* Add stale while revalidate and stale if error cache header
88
* Allow dynamic session "ttl" when using a remote storage
9-
* Send `Content-Length` when calling `Response::send()` and the content is a non-empty string
109

1110
6.0
1211
---

src/Symfony/Component/HttpFoundation/Response.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,6 @@ public function sendContent(): static
371371
*/
372372
public function send(): static
373373
{
374-
if (\is_string($this->content) && '' !== $this->content && !$this->headers->has('Transfer-Encoding')) {
375-
$this->headers->set('Content-Length', \strlen($this->content));
376-
}
377-
378374
$this->sendHeaders();
379375
$this->sendContent();
380376

src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,6 @@ public function testSend()
5757
$this->assertObjectHasAttribute('statusCode', $responseSent);
5858
$this->assertObjectHasAttribute('statusText', $responseSent);
5959
$this->assertObjectHasAttribute('charset', $responseSent);
60-
$this->assertFalse($responseSent->headers->has('Content-Length'));
61-
62-
ob_start();
63-
64-
$response = new Response('foo');
65-
$responseSent = $response->send();
66-
$this->assertSame('3', $responseSent->headers->get('Content-Length'));
67-
68-
$response = new Response('bar');
69-
$response->headers->set('Transfer-Encoding', 'chunked');
70-
$responseSent = $response->send();
71-
$this->assertFalse($responseSent->headers->has('Content-Length'));
72-
73-
$this->assertSame('foobar', ob_get_clean());
7460
}
7561

7662
public function testGetCharset()

src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTestDoc.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,23 @@ public function testDummyNamespaceWithProperty()
437437
$this->assertEquals($phpDocTypes[0]->getClassName(), $phpStanTypes[0]->getClassName());
438438
}
439439

440+
/**
441+
* @dataProvider intRangeTypeProvider
442+
*/
443+
public function testExtractorIntRangeType(string $property, ?array $types)
444+
{
445+
$this->assertEquals($types, $this->extractor->getTypes('Symfony\Component\PropertyInfo\Tests\Fixtures\IntRangeDummy', $property));
446+
}
447+
448+
public function intRangeTypeProvider(): array
449+
{
450+
return [
451+
['a', [new Type(Type::BUILTIN_TYPE_INT)]],
452+
['b', [new Type(Type::BUILTIN_TYPE_INT, true)]],
453+
['c', [new Type(Type::BUILTIN_TYPE_INT)]],
454+
];
455+
}
456+
440457
/**
441458
* @dataProvider php80TypesProvider
442459
*/
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\PropertyInfo\Tests\Fixtures;
13+
14+
class IntRangeDummy
15+
{
16 10000 +
/**
17+
* @var int<0, 100>
18+
*/
19+
public $a;
20+
21+
/**
22+
* @var int<min, 100>|null
23+
*/
24+
public $b;
25+
26+
/**
27+
* @var int<50, max>
28+
*/
29+
public $c;
30+
}

src/Symfony/Component/PropertyInfo/Util/PhpStanTypeHelper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ private function extractTypes(TypeNode $node, NameScope $nameScope): array
121121

122122
[$mainType] = $this->extractTypes($node->type, $nameScope);
123123

124+
if (Type::BUILTIN_TYPE_INT === $mainType->getBuiltinType()) {
125+
return [$mainType];
126+
}
127+
124128
$collectionKeyTypes = $mainType->getCollectionKeyTypes();
125129
$collectionKeyValues = [];
126130
if (1 === \count($node->genericTypes)) {

src/Symfony/Component/Serializer/DataCollector/SerializerDataCollector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ public function lateCollect(): void
179179
];
180180

181181
foreach ($this->collected as $collected) {
182+
if (!isset($collected['data'])) {
183+
continue;
184+
}
185+
182186
$data = [
183187
'data' => $this->cloneVar($collected['data']),
184188
'dataType' => get_debug_type($collected['data']),

src/Symfony/Component/Serializer/Debug/TraceableEncoder.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,13 @@ public function encode(mixed $data, string $format, array $context = []): string
5555

5656
/**
5757
* {@inheritDoc}
58-
*
59-
* @param array $context
6058
*/
61-
public function supportsEncoding(string $format /*, array $context = [] */): bool
59+
public function supportsEncoding(string $format, array $context = []): bool
6260
{
6361
if (!$this->encoder instanceof EncoderInterface) {
6462
return false;
6563
}
6664

67-
$context = \func_num_args() > 1 ? func_get_arg(1) : [];
68-
6965
return $this->encoder->supportsEncoding($format, $context);
7066
}
7167

@@ -91,17 +87,13 @@ public function decode(string $data, string $format, array $context = []): mixed
9187

9288
/**
9389
* {@inheritDoc}
94-
*
95-
* @param array $context
9690
*/
97-
public function supportsDecoding(string $format /*, array $context = [] */): bool
91+
public function supportsDecoding(string $format, array $context = []): bool
9892
{
9993
if (!$this->encoder instanceof DecoderInterface) {
10094
return false;
10195
}
10296

103-
$context = \func_num_args() > 1 ? func_get_arg(1) : [];
104-
10597
return $this->encoder->supportsDecoding($format, $context);
10698
}
10799

@@ -121,4 +113,12 @@ public function needsNormalization(): bool
121113
{
122114
return !$this->encoder instanceof NormalizationAwareEncoder;
123115
}
116+
117+
/**
118+
* Proxies all method calls to the original encoder.
119+
*/
120+
public function __call(string $method, array $arguments): mixed
121+
{
122+
return $this->encoder->{$method}(...$arguments);
123+
}
124124
}

src/Symfony/Component/Serializer/Debug/TraceableNormalizer.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,13 @@ public function normalize(mixed $object, string $format = null, array $context =
5757

5858
/**
5959
* {@inheritDoc}
60-
*
61-
* @param array $context
6260
*/
63-
public function supportsNormalization(mixed $data, string $format = null /*, array $context = [] */): bool
61+
public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
6462
{
6563
if (!$this->normalizer instanceof NormalizerInterface) {
6664
return false;
6765
}
6866

69-
$context = \func_num_args() > 2 ? func_get_arg(2) : [];
70-
7167
return $this->normalizer->supportsNormalization($data, $format, $context);
7268
}
7369

@@ -93,17 +89,13 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
9389

9490
/**
9591
* {@inheritDoc}
96-
*
97-
* @param array $context
9892
*/
99-
public function supportsDenormalization(mixed $data, string $type, string $format = null /*, array $context = [] */): bool
93+
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
10094
{
10195
if (!$this->normalizer instanceof DenormalizerInterface) {
10296
return false;
10397
}
10498

105-
$context = \func_num_args() > 3 ? func_get_arg(3) : [];
106-
10799
return $this->normalizer->supportsDenormalization($data, $type, $format, $context);
108100
}
109101

src/Symfony/Component/Serializer/Tests/DataCollector/SerializerDataCollectorTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,27 @@ public function testReset()
276276
$this->assertSame([], $dataCollector->getData());
277277
}
278278

279+
public function testDoNotCollectPartialTraces()
280+
{
281+
$dataCollector = new SerializerDataCollector();
282+
283+
$dataCollector->collectNormalization('traceIdOne', DateTimeNormalizer::class, 1.0);
284+
$dataCollector->collectDenormalization('traceIdTwo', DateTimeNormalizer::class, 1.0);
285+
$dataCollector->collectEncoding('traceIdThree', CsvEncoder::class, 10.0);
286+
$dataCollector->collectDecoding('traceIdFour', JsonEncoder::class, 1.0);
287+
288+
$dataCollector->lateCollect();
289+
290+
$data = $dataCollector->getData();
291+
292+
$this->assertSame([], $data['serialize']);
293+
$this->assertSame([], $data['deserialize']);
294+
$this->assertSame([], $data['normalize']);
295+
$this->assertSame([], $data['denormalize']);
296+
$this->assertSame([], $data['encode']);
297+
$this->assertSame([], $data['decode']);
298+
}
299+
279300
/**
280301
* Cast cloned vars to be able to test nested values.
281302
*/

src/Symfony/Component/Serializer/Tests/Debug/TraceableSerializerTest.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,7 @@ public function normalize(mixed $object, string $format = null, array $context =
145145
return 'normalized';
146146
}
147147

148-
/**
149-
* @param array $context
150-
*/
151-
public function supportsNormalization(mixed $data, string $format = null /*, array $context = [] */): bool
148+
public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
152149
{
153150
return true;
154151
}
@@ -158,10 +155,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
158155
return 'denormalized';
159156
}
160157

161-
/**
162-
* @param array $context
163-
*/
164-
public function supportsDenormalization(mixed $data, string $type, string $format = null /*, array $context = [] */): bool
158+
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
165159
{
166160
return true;
167161
}
@@ -171,10 +165,7 @@ public function encode(mixed $data, string $format, array $context = []): string
171165
return 'encoded';
172166
}
173167

174-
/**
175-
* @param array $context
176-
*/
177-
public function supportsEncoding(string $format /*, array $context = [] */): bool
168+
public function supportsEncoding(string $format, array $context = []): bool
178169
{
179170
return true;
180171
}
@@ -184,10 +175,7 @@ public function decode(string $data, string $format, array $context = []): mixed
184175
return 'decoded';
185176
}
186177

187-
/**
188-
* @param array $context
189-
*/
190-
public function supportsDecoding(string $format /*, array $context = [] */): bool
178+
public function supportsDecoding(string $format, array $context = []): bool
191179
{
192180
return true;
193181
}

0 commit comments

Comments
 (0)
0