Skip to content

Commit adc8c67

Browse files
committed
Merge branch '5.2' into 5.3
* 5.2: [Config] Backport type declarations [VarExporter] Fix test on PHP 8.1 [DependencyInjection] Fix CSV file mime type guess test for PHP 8.1
2 parents b6626be + a7f8180 commit adc8c67

30 files changed

+154
-186
lines changed

src/Symfony/Component/Config/Definition/ArrayNode.php

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,7 @@ public function addChild(NodeInterface $node)
195195
}
196196

197197
/**
198-
* Finalizes the value of this node.
199-
*
200-
* @param mixed $value
201-
*
202-
* @return mixed The finalised value
198+
* {@inheritdoc}
203199
*
204200
* @throws UnsetKeyException
205201
* @throws InvalidConfigurationException if the node doesn't have enough children
@@ -248,11 +244,7 @@ protected function finalizeValue($value)
248244
}
249245

250246
/**
251-
* Validates the type of the value.
252-
*
253-
* @param mixed $value
254-
*
255-
* @throws InvalidTypeException
247+
* {@inheritdoc}
256248
*/
257249
protected function validateType($value)
258250
{
@@ -268,11 +260,7 @@ protected function validateType($value)
268260
}
269261

270262
/**
271-
* Normalizes the value.
272-
*
273-
* @param mixed $value The value to normalize
274-
*
275-
* @return mixed The normalized value
263+
* {@inheritdoc}
276264
*
277265
* @throws InvalidConfigurationException
278266
*/
@@ -352,12 +340,7 @@ protected function remapXml(array $value)
352340
}
353341

354342
/**
355-
* Merges values together.
356-
*
357-
* @param mixed $leftSide The left side to merge
358-
* @param mixed $rightSide The right side to merge
359-
*
360-
* @return mixed The merged values
343+
* {@inheritdoc}
361344
*
362345
* @throws InvalidConfigurationException
363346
* @throws \RuntimeException

src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public function canBeEnabled()
276276
->treatNullLike(['enabled' => true])
277277
->beforeNormalization()
278278
->ifArray()
279-
->then(function ($v) {
279+
->then(function (array $v) {
280280
$v['enabled'] = $v['enabled'] ?? true;
281281

282282
return $v;

src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(NodeDefinition $node)
3737
*/
3838
public function always(\Closure $then = null)
3939
{
40-
$this->ifPart = function ($v) { return true; };
40+
$this->ifPart = function () { return true; };
4141

4242
if (null !== $then) {
4343
$this->thenPart = $then;
@@ -168,7 +168,7 @@ public function then(\Closure $closure)
168168
*/
169169
public function thenEmptyArray()
170170
{
171-
$this->thenPart = function ($v) { return []; };
171+
$this->thenPart = function () { return []; };
172172

173173
return $this;
174174
}
@@ -198,7 +198,7 @@ public function thenInvalid(string $message)
198198
*/
199199
public function thenUnset()
200200
{
201-
$this->thenPart = function ($v) { throw new UnsetKeyException('Unsetting key.'); };
201+
$this->thenPart = function () { throw new UnsetKeyException('Unsetting key.'); };
202202

203203
return $this;
204204
}

src/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ abstract class NumericNodeDefinition extends ScalarNodeDefinition
2626
/**
2727
* Ensures that the value is smaller than the given reference.
2828
*
29-
* @param mixed $max
29+
* @param int|float $max
3030
*
3131
* @return $this
3232
*
@@ -45,7 +45,7 @@ public function max($max)
4545
/**
4646
* Ensures that the value is bigger than the given reference.
4747
*
48-
* @param mixed $min
48+
* @param int|float $min
4949
*
5050
* @return $this
5151
*

src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ private function writeNode(NodeInterface $node, int $depth = 0, bool $root = fal
4949

5050
// xml remapping
5151
if ($node->getParent()) {
52-
$remapping = array_filter($node->getParent()->getXmlRemappings(), function ($mapping) use ($rootName) {
52+
$remapping = array_filter($node->getParent()->getXmlRemappings(), function (array $mapping) use ($rootName) {
5353
return $rootName === $mapping[1];
5454
});
5555

src/Symfony/Component/Config/Definition/EnumNode.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public function getValues()
3838
return $this->values;
3939
}
4040

41+
/**
42+
* {@inheritdoc}
43+
*/
4144
protected function finalizeValue($value)
4245
{
4346
$value = parent::finalizeValue($value);

src/Symfony/Component/Config/Definition/NumericNode.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ class NumericNode extends ScalarNode
2323
protected $min;
2424
protected $max;
2525

26+
/**
27+
* @param int|float|null $min
28+
* @param int|float|null $max
29+
*/
2630
public function __construct(?string $name, NodeInterface $parent = null, $min = null, $max = null, string $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR)
2731
{
2832
parent::__construct($name, $parent, $pathSeparator);

src/Symfony/Component/Config/Definition/PrototypedArrayNode.php

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,7 @@ public function addChild(NodeInterface $node)
163163
}
164164

165165
/**
166-
* Finalizes the value of this node.
167-
*
168-
* @param mixed $value
169-
*
170-
* @return mixed The finalized value
171-
*
172-
* @throws UnsetKeyException
173-
* @throws InvalidConfigurationException if the node doesn't have enough children
166+
* {@inheritdoc}
174167
*/
175168
protected function finalizeValue($value)
176169
{
@@ -198,13 +191,8 @@ protected function finalizeValue($value)
198191
}
199192

200193
/**
201-
* Normalizes the value.
202-
*
203-
* @param mixed $value The value to normalize
204-
*
205-
* @return mixed The normalized value
194+
* {@inheritdoc}
206195
*
207-
* @throws InvalidConfigurationException
208196
* @throws DuplicateKeyException
209197
*/
210198
protected function normalizeValue($value)
@@ -272,15 +260,7 @@ protected function normalizeValue($value)
272260
}
273261

274262
/**
275-
* Merges values together.
276-
*
277-
* @param mixed $leftSide The left side to merge
278-
* @param mixed $rightSide The right side to merge
279-
*
280-
* @return mixed The merged values
281-
*
282-
* @throws InvalidConfigurationException
283-
* @throws \RuntimeException
263+
* {@inheritdoc}
284264
*/
285265
protected function mergeValues($leftSide, $rightSide)
286266
{

src/Symfony/Component/Config/Tests/ConfigCacheTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ protected function tearDown(): void
3838
/**
3939
* @dataProvider debugModes
4040
*/
41-
public function testCacheIsNotValidIfNothingHasBeenCached($debug)
41+
public function testCacheIsNotValidIfNothingHasBeenCached(bool $debug)
4242
{
4343
unlink($this->cacheFile); // remove tempnam() side effect
4444
$cache = new ConfigCache($this->cacheFile, $debug);
@@ -60,7 +60,7 @@ public function testIsAlwaysFreshInProduction()
6060
/**
6161
* @dataProvider debugModes
6262
*/
63-
public function testIsFreshWhenNoResourceProvided($debug)
63+
public function testIsFreshWhenNoResourceProvided(bool $debug)
6464
{
6565
$cache = new ConfigCache($this->cacheFile, $debug);
6666
$cache->write('', []);
@@ -89,7 +89,7 @@ public function testStaleResourceInDebug()
8989
$this->assertFalse($cache->isFresh());
9090
}
9191

92-
public function debugModes()
92+
public function debugModes(): array
9393
{
9494
return [
9595
[true],

src/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function testNormalizeWithoutProposals()
5858
$node->normalize(['beta' => 'foo']);
5959
}
6060

61-
public function ignoreAndRemoveMatrixProvider()
61+
public function ignoreAndRemoveMatrixProvider(): array
6262
{
6363
$unrecognizedOptionException = new InvalidConfigurationException('Unrecognized option "foo" under "root"');
6464

@@ -71,9 +71,11 @@ public function ignoreAndRemoveMatrixProvider()
7171
}
7272

7373
/**
74+
* @param array|\Exception $expected
75+
*
7476
* @dataProvider ignoreAndRemoveMatrixProvider
7577
*/
76-
public function testIgnoreAndRemoveBehaviors($ignore, $remove, $expected, $message = '')
78+
public function testIgnoreAndRemoveBehaviors(bool $ignore, bool $remove, $expected, string $message = '')
7779
{
7880
if ($expected instanceof \Exception) {
7981
$this->expectException(\get_class($expected));
@@ -88,7 +90,7 @@ public function testIgnoreAndRemoveBehaviors($ignore, $remove, $expected, $messa
8890
/**
8991
* @dataProvider getPreNormalizationTests
9092
*/
91-
public function testPreNormalize($denormalized, $normalized)
93+
public function testPreNormalize(array $denormalized, array $normalized)
9294
{
9395
$node = new ArrayNode('foo');
9496

@@ -98,7 +100,7 @@ public function testPreNormalize($denormalized, $normalized)
98100
$this->assertSame($normalized, $r->invoke($node, $denormalized));
99101
}
100102

101-
public function getPreNormalizationTests()
103+
public function getPreNormalizationTests(): array
102104
{
103105
return [
104106
[
@@ -123,7 +125,7 @@ public function getPreNormalizationTests()
123125
/**
124126
* @dataProvider getZeroNamedNodeExamplesData
125127
*/
126-
public function testNodeNameCanBeZero($denormalized, $normalized)
128+
public function testNodeNameCanBeZero(array $denormalized, array $normalized)
127129
{
128130
$zeroNode = new ArrayNode(0);
129131
$zeroNode->addChild(new ScalarNode('name'));
@@ -140,7 +142,7 @@ public function testNodeNameCanBeZero($denormalized, $normalized)
140142
$this->assertSame($normalized, $r->invoke($rootNode, $denormalized));
141143
}
142144

143-
public function getZeroNamedNodeExamplesData()
145+
public function getZeroNamedNodeExamplesData(): array
144146
{
145147
return [
146148
[
@@ -171,7 +173,7 @@ public function getZeroNamedNodeExamplesData()
171173
/**
172174
* @dataProvider getPreNormalizedNormalizedOrderedData
173175
*/
174-
public function testChildrenOrderIsMaintainedOnNormalizeValue($prenormalized, $normalized)
176+
public function testChildrenOrderIsMaintainedOnNormalizeValue(array $prenormalized, array $normalized)
175177
{
176178
$scalar1 = new ScalarNode('1');
177179
$scalar2 = new ScalarNode('2');
@@ -187,7 +189,7 @@ public function testChildrenOrderIsMaintainedOnNormalizeValue($prenormalized, $n
187189
$this->assertSame($normalized, $r->invoke($node, $prenormalized));
188190
}
189191

190-
public function getPreNormalizedNormalizedOrderedData()
192+
public function getPreNormalizedNormalizedOrderedData(): array
191193
{
192194
return [
193195
[
@@ -297,7 +299,7 @@ public function testSetDeprecatedWithoutPackageAndVersion()
297299
/**
298300
* @dataProvider getDataWithIncludedExtraKeys
299301
*/
300-
public function testMergeWithoutIgnoringExtraKeys($prenormalizeds, $merged)
302+
public function testMergeWithoutIgnoringExtraKeys(array $prenormalizeds)
301303
{
302304
$this->expectException(\RuntimeException::class);
303305
$this->expectExceptionMessage('merge() expects a normalized config array.');
@@ -315,7 +317,7 @@ public function testMergeWithoutIgnoringExtraKeys($prenormalizeds, $merged)
315317
/**
316318
* @dataProvider getDataWithIncludedExtraKeys
317319
*/
318-
public function testMergeWithIgnoringAndRemovingExtraKeys($prenormalizeds, $merged)
320+
public function testMergeWithIgnoringAndRemovingExtraKeys(array $prenormalizeds)
319321
{
320322
$this->expectException(\RuntimeException::class);
321323
$this->expectExceptionMessage('merge() expects a normalized config array.');
@@ -333,7 +335,7 @@ public function testMergeWithIgnoringAndRemovingExtraKeys($prenormalizeds, $merg
333335
/**
334336
* @dataProvider getDataWithIncludedExtraKeys
335337
*/
336-
public function testMergeWithIgnoringExtraKeys($prenormalizeds, $merged)
338+
public function testMergeWithIgnoringExtraKeys(array $prenormalizeds, array $merged)
337339
{
338340
$node = new ArrayNode('root');
339341
$node->addChild(new ScalarNode('foo'));
@@ -346,7 +348,7 @@ public function testMergeWithIgnoringExtraKeys($prenormalizeds, $merged)
346348
$this->assertEquals($merged, $r->invoke($node, ...$prenormalizeds));
347349
}
348350

349-
public function getDataWithIncludedExtraKeys()
351+
public function getDataWithIncludedExtraKeys(): array
350352
{
351353
return [
352354
[

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy