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

Commit35eec33

Browse files
committed
[Config] Add parameter types
Signed-off-by: Alexander M. Turek <me@derrabus.de>
1 parent210dc98 commit35eec33

File tree

57 files changed

+113
-163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+113
-163
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(LoaderResolverInterface $resolver, array $defaultOpt
4242
/**
4343
* {@inheritdoc}
4444
*/
45-
publicfunctionload($resource,string$type =null)
45+
publicfunctionload(mixed$resource,string$type =null)
4646
{
4747
if ($this->loading) {
4848
// This can happen if a fatal error occurs in parent::load().

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
3232
protected$removeExtraKeys =true;
3333
protected$normalizeKeys =true;
3434

35-
publicfunctionsetNormalizeKeys($normalizeKeys)
35+
publicfunctionsetNormalizeKeys(bool$normalizeKeys)
3636
{
37-
$this->normalizeKeys =(bool)$normalizeKeys;
37+
$this->normalizeKeys =$normalizeKeys;
3838
}
3939

4040
/**
@@ -46,7 +46,7 @@ public function setNormalizeKeys($normalizeKeys)
4646
* If you have a mixed key like foo-bar_moo, it will not be altered.
4747
* The key will also not be altered if the target key already exists.
4848
*/
49-
protectedfunctionpreNormalize($value)
49+
protectedfunctionpreNormalize(mixed$value)
5050
{
5151
if (!$this->normalizeKeys || !\is_array($value)) {
5252
return$value;
@@ -200,7 +200,7 @@ public function addChild(NodeInterface $node)
200200
* @throws UnsetKeyException
201201
* @throws InvalidConfigurationException if the node doesn't have enough children
202202
*/
203-
protectedfunctionfinalizeValue($value)
203+
protectedfunctionfinalizeValue(mixed$value)
204204
{
205205
if (false ===$value) {
206206
thrownewUnsetKeyException(sprintf('Unsetting key for path "%s", value: %s.',$this->getPath(),json_encode($value)));
@@ -246,7 +246,7 @@ protected function finalizeValue($value)
246246
/**
247247
* {@inheritdoc}
248248
*/
249-
protectedfunctionvalidateType($value)
249+
protectedfunctionvalidateType(mixed$value)
250250
{
251251
if (!\is_array($value) && (!$this->allowFalse ||false !==$value)) {
252252
$ex =newInvalidTypeException(sprintf('Invalid type for path "%s". Expected "array", but got "%s"',$this->getPath(),get_debug_type($value)));
@@ -264,7 +264,7 @@ protected function validateType($value)
264264
*
265265
* @throws InvalidConfigurationException
266266
*/
267-
protectedfunctionnormalizeValue($value)
267+
protectedfunctionnormalizeValue(mixed$value)
268268
{
269269
if (false ===$value) {
270270
return$value;
@@ -345,7 +345,7 @@ protected function remapXml(array $value)
345345
* @throws InvalidConfigurationException
346346
* @throws \RuntimeException
347347
*/
348-
protectedfunctionmergeValues($leftSide,$rightSide)
348+
protectedfunctionmergeValues(mixed$leftSide,mixed$rightSide)
349349
{
350350
if (false ===$rightSide) {
351351
// if this is still false after the last config has been merged the

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class BooleanNode extends ScalarNode
2323
/**
2424
* {@inheritdoc}
2525
*/
26-
protectedfunctionvalidateType($value)
26+
protectedfunctionvalidateType(mixed$value)
2727
{
2828
if (!\is_bool($value)) {
2929
$ex =newInvalidTypeException(sprintf('Invalid type for path "%s". Expected "bool", but got "%s".',$this->getPath(),get_debug_type($value)));
@@ -39,7 +39,7 @@ protected function validateType($value)
3939
/**
4040
* {@inheritdoc}
4141
*/
42-
protectedfunctionisValueEmpty($value)
42+
protectedfunctionisValueEmpty(mixed$value)
4343
{
4444
// a boolean value cannot be empty
4545
returnfalse;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function addDefaultsIfNotSet()
154154
*
155155
* @return $this
156156
*/
157-
publicfunctionaddDefaultChildrenIfNoneSet($children =null)
157+
publicfunctionaddDefaultChildrenIfNoneSet(int|string|array|null$children =null)
158158
{
159159
$this->addDefaultChildren =$children;
160160

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,11 @@ abstract class NumericNodeDefinition extends ScalarNodeDefinition
2626
/**
2727
* Ensures that the value is smaller than the given reference.
2828
*
29-
* @param int|float $max
30-
*
3129
* @return $this
3230
*
3331
* @throws \InvalidArgumentException when the constraint is inconsistent
3432
*/
35-
publicfunctionmax($max)
33+
publicfunctionmax(int|float$max)
3634
{
3735
if (isset($this->min) &&$this->min >$max) {
3836
thrownew \InvalidArgumentException(sprintf('You cannot define a max(%s) as you already have a min(%s).',$max,$this->min));
@@ -45,13 +43,11 @@ public function max($max)
4543
/**
4644
* Ensures that the value is bigger than the given reference.
4745
*
48-
* @param int|float $min
49-
*
5046
* @return $this
5147
*
5248
* @throws \InvalidArgumentException when the constraint is inconsistent
5349
*/
54-
publicfunctionmin($min)
50+
publicfunctionmin(int|float$min)
5551
{
5652
if (isset($this->max) &&$this->max <$min) {
5753
thrownew \InvalidArgumentException(sprintf('You cannot define a min(%s) as you already have a max(%s).',$min,$this->max));

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,8 @@ private function writeLine(string $text, int $indent = 0)
268268

269269
/**
270270
* Renders the string conversion of the value.
271-
*
272-
* @param mixed $value
273271
*/
274-
privatefunctionwriteValue($value):string
272+
privatefunctionwriteValue(mixed$value):string
275273
{
276274
if ('%%%%not_defined%%%%' ===$value) {
277275
return'';

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function getValues()
4141
/**
4242
* {@inheritdoc}
4343
*/
44-
protectedfunctionfinalizeValue($value)
44+
protectedfunctionfinalizeValue(mixed$value)
4545
{
4646
$value =parent::finalizeValue($value);
4747

‎src/Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class InvalidConfigurationException extends Exception
2222
private$path;
2323
private$containsHints =false;
2424

25-
publicfunctionsetPath($path)
25+
publicfunctionsetPath(string$path)
2626
{
2727
$this->path =$path;
2828
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class FloatNode extends NumericNode
2323
/**
2424
* {@inheritdoc}
2525
*/
26-
protectedfunctionvalidateType($value)
26+
protectedfunctionvalidateType(mixed$value)
2727
{
2828
// Integers are also accepted, we just cast them
2929
if (\is_int($value)) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class IntegerNode extends NumericNode
2323
/**
2424
* {@inheritdoc}
2525
*/
26-
protectedfunctionvalidateType($value)
26+
protectedfunctionvalidateType(mixed$value)
2727
{
2828
if (!\is_int($value)) {
2929
$ex =newInvalidTypeException(sprintf('Invalid type for path "%s". Expected "int", but got "%s".',$this->getPath(),get_debug_type($value)));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp