Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit46e18af

Browse files
committed
[Config] Backport type declarations
Signed-off-by: Alexander M. Turek <me@derrabus.de>
1 parent7957b48 commit46e18af

28 files changed

+144
-184
lines changed

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

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

205205
/**
206-
* Finalizes the value of this node.
207-
*
208-
* @param mixed $value
209-
*
210-
* @return mixed The finalised value
206+
* {@inheritdoc}
211207
*
212208
* @throws UnsetKeyException
213209
* @throws InvalidConfigurationException if the node doesn't have enough children
@@ -249,11 +245,7 @@ protected function finalizeValue($value)
249245
}
250246

251247
/**
252-
* Validates the type of the value.
253-
*
254-
* @param mixed $value
255-
*
256-
* @throws InvalidTypeException
248+
* {@inheritdoc}
257249
*/
258250
protectedfunctionvalidateType($value)
259251
{
@@ -269,11 +261,7 @@ protected function validateType($value)
269261
}
270262

271263
/**
272-
* Normalizes the value.
273-
*
274-
* @param mixed $value The value to normalize
275-
*
276-
* @return mixed The normalized value
264+
* {@inheritdoc}
277265
*
278266
* @throws InvalidConfigurationException
279267
*/
@@ -355,12 +343,7 @@ protected function remapXml($value)
355343
}
356344

357345
/**
358-
* Merges values together.
359-
*
360-
* @param mixed $leftSide The left side to merge
361-
* @param mixed $rightSide The right side to merge
362-
*
363-
* @return mixed The merged values
346+
* {@inheritdoc}
364347
*
365348
* @throws InvalidConfigurationException
366349
* @throws \RuntimeException

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

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

286286
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
publicfunctionalways(\Closure$then =null)
3939
{
40-
$this->ifPart =function ($v) {returntrue; };
40+
$this->ifPart =function () {returntrue; };
4141

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

173173
return$this;
174174
}
@@ -200,7 +200,7 @@ public function thenInvalid($message)
200200
*/
201201
publicfunctionthenUnset()
202202
{
203-
$this->thenPart =function ($v) {thrownewUnsetKeyException('Unsetting key.'); };
203+
$this->thenPart =function () {thrownewUnsetKeyException('Unsetting key.'); };
204204

205205
return$this;
206206
}

‎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-
* @parammixed $max
29+
* @paramint|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-
* @parammixed $min
48+
* @paramint|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
protectedfunctionfinalizeValue($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
publicfunction__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
@@ -173,14 +173,7 @@ public function addChild(NodeInterface $node)
173173
}
174174

175175
/**
176-
* Finalizes the value of this node.
177-
*
178-
* @param mixed $value
179-
*
180-
* @return mixed The finalized value
181-
*
182-
* @throws UnsetKeyException
183-
* @throws InvalidConfigurationException if the node doesn't have enough children
176+
* {@inheritdoc}
184177
*/
185178
protectedfunctionfinalizeValue($value)
186179
{
@@ -208,13 +201,8 @@ protected function finalizeValue($value)
208201
}
209202

210203
/**
211-
* Normalizes the value.
212-
*
213-
* @param mixed $value The value to normalize
214-
*
215-
* @return mixed The normalized value
204+
* {@inheritdoc}
216205
*
217-
* @throws InvalidConfigurationException
218206
* @throws DuplicateKeyException
219207
*/
220208
protectedfunctionnormalizeValue($value)
@@ -282,15 +270,7 @@ protected function normalizeValue($value)
282270
}
283271

284272
/**
285-
* Merges values together.
286-
*
287-
* @param mixed $leftSide The left side to merge
288-
* @param mixed $rightSide The right side to merge
289-
*
290-
* @return mixed The merged values
291-
*
292-
* @throws InvalidConfigurationException
293-
* @throws \RuntimeException
273+
* {@inheritdoc}
294274
*/
295275
protectedfunctionmergeValues($leftSide,$rightSide)
296276
{

‎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-
publicfunctiontestCacheIsNotValidIfNothingHasBeenCached($debug)
41+
publicfunctiontestCacheIsNotValidIfNothingHasBeenCached(bool$debug)
4242
{
4343
unlink($this->cacheFile);// remove tempnam() side effect
4444
$cache =newConfigCache($this->cacheFile,$debug);
@@ -60,7 +60,7 @@ public function testIsAlwaysFreshInProduction()
6060
/**
6161
* @dataProvider debugModes
6262
*/
63-
publicfunctiontestIsFreshWhenNoResourceProvided($debug)
63+
publicfunctiontestIsFreshWhenNoResourceProvided(bool$debug)
6464
{
6565
$cache =newConfigCache($this->cacheFile,$debug);
6666
$cache->write('', []);
@@ -89,7 +89,7 @@ public function testStaleResourceInDebug()
8989
$this->assertFalse($cache->isFresh());
9090
}
9191

92-
publicfunctiondebugModes()
92+
publicfunctiondebugModes():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
@@ -55,7 +55,7 @@ public function testNormalizeWithoutProposals()
5555
$node->normalize(['beta' =>'foo']);
5656
}
5757

58-
publicfunctionignoreAndRemoveMatrixProvider()
58+
publicfunctionignoreAndRemoveMatrixProvider():array
5959
{
6060
$unrecognizedOptionException =newInvalidConfigurationException('Unrecognized option "foo" under "root"');
6161

@@ -68,9 +68,11 @@ public function ignoreAndRemoveMatrixProvider()
6868
}
6969

7070
/**
71+
* @param array|\Exception $expected
72+
*
7173
* @dataProvider ignoreAndRemoveMatrixProvider
7274
*/
73-
publicfunctiontestIgnoreAndRemoveBehaviors($ignore,$remove,$expected,$message ='')
75+
publicfunctiontestIgnoreAndRemoveBehaviors(bool$ignore,bool$remove,$expected,string$message ='')
7476
{
7577
if ($expectedinstanceof \Exception) {
7678
$this->expectException(\get_class($expected));
@@ -85,7 +87,7 @@ public function testIgnoreAndRemoveBehaviors($ignore, $remove, $expected, $messa
8587
/**
8688
* @dataProvider getPreNormalizationTests
8789
*/
88-
publicfunctiontestPreNormalize($denormalized,$normalized)
90+
publicfunctiontestPreNormalize(array$denormalized,array$normalized)
8991
{
9092
$node =newArrayNode('foo');
9193

@@ -95,7 +97,7 @@ public function testPreNormalize($denormalized, $normalized)
9597
$this->assertSame($normalized,$r->invoke($node,$denormalized));
9698
}
9799

98-
publicfunctiongetPreNormalizationTests()
100+
publicfunctiongetPreNormalizationTests():array
99101
{
100102
return [
101103
[
@@ -120,7 +122,7 @@ public function getPreNormalizationTests()
120122
/**
121123
* @dataProvider getZeroNamedNodeExamplesData
122124
*/
123-
publicfunctiontestNodeNameCanBeZero($denormalized,$normalized)
125+
publicfunctiontestNodeNameCanBeZero(array$denormalized,array$normalized)
124126
{
125127
$zeroNode =newArrayNode(0);
126128
$zeroNode->addChild(newScalarNode('name'));
@@ -137,7 +139,7 @@ public function testNodeNameCanBeZero($denormalized, $normalized)
137139
$this->assertSame($normalized,$r->invoke($rootNode,$denormalized));
138140
}
139141

140-
publicfunctiongetZeroNamedNodeExamplesData()
142+
publicfunctiongetZeroNamedNodeExamplesData():array
141143
{
142144
return [
143145
[
@@ -168,7 +170,7 @@ public function getZeroNamedNodeExamplesData()
168170
/**
169171
* @dataProvider getPreNormalizedNormalizedOrderedData
170172
*/
171-
publicfunctiontestChildrenOrderIsMaintainedOnNormalizeValue($prenormalized,$normalized)
173+
publicfunctiontestChildrenOrderIsMaintainedOnNormalizeValue(array$prenormalized,array$normalized)
172174
{
173175
$scalar1 =newScalarNode('1');
174176
$scalar2 =newScalarNode('2');
@@ -184,7 +186,7 @@ public function testChildrenOrderIsMaintainedOnNormalizeValue($prenormalized, $n
184186
$this->assertSame($normalized,$r->invoke($node,$prenormalized));
185187
}
186188

187-
publicfunctiongetPreNormalizedNormalizedOrderedData()
189+
publicfunctiongetPreNormalizedNormalizedOrderedData():array
188190
{
189191
return [
190192
[
@@ -260,7 +262,7 @@ public function testSetDeprecated()
260262
/**
261263
* @dataProvider getDataWithIncludedExtraKeys
262264
*/
263-
publicfunctiontestMergeWithoutIgnoringExtraKeys($prenormalizeds,$merged)
265+
publicfunctiontestMergeWithoutIgnoringExtraKeys(array$prenormalizeds)
264266
{
265267
$this->expectException(\RuntimeException::class);
266268
$this->expectExceptionMessage('merge() expects a normalized config array.');
@@ -278,7 +280,7 @@ public function testMergeWithoutIgnoringExtraKeys($prenormalizeds, $merged)
278280
/**
279281
* @dataProvider getDataWithIncludedExtraKeys
280282
*/
281-
publicfunctiontestMergeWithIgnoringAndRemovingExtraKeys($prenormalizeds,$merged)
283+
publicfunctiontestMergeWithIgnoringAndRemovingExtraKeys(array$prenormalizeds)
282284
{
283285
$this->expectException(\RuntimeException::class);
284286
$this->expectExceptionMessage('merge() expects a normalized config array.');
@@ -296,7 +298,7 @@ public function testMergeWithIgnoringAndRemovingExtraKeys($prenormalizeds, $merg
296298
/**
297299
* @dataProvider getDataWithIncludedExtraKeys
298300
*/
299-
publicfunctiontestMergeWithIgnoringExtraKeys($prenormalizeds,$merged)
301+
publicfunctiontestMergeWithIgnoringExtraKeys(array$prenormalizeds,array$merged)
300302
{
301303
$node =newArrayNode('root');
302304
$node->addChild(newScalarNode('foo'));
@@ -309,7 +311,7 @@ public function testMergeWithIgnoringExtraKeys($prenormalizeds, $merged)
309311
$this->assertEquals($merged,$r->invoke($node, ...$prenormalizeds));
310312
}
311313

312-
publicfunctiongetDataWithIncludedExtraKeys()
314+
publicfunctiongetDataWithIncludedExtraKeys():array
313315
{
314316
return [
315317
[

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp