You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: OptionsResolver.php
+4-16Lines changed: 4 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -434,7 +434,7 @@ public function setDeprecated(string $option, $deprecationMessage = 'The option
434
434
}
435
435
436
436
if (!\is_string($deprecationMessage) && !$deprecationMessageinstanceof \Closure) {
437
-
thrownewInvalidArgumentException(sprintf('Invalid type for deprecation message argument, expected string or \Closure, but got "%s".', \gettype($deprecationMessage)));
437
+
thrownewInvalidArgumentException(sprintf('Invalid type for deprecation message argument, expected string or \Closure, but got "%s".', get_debug_type($deprecationMessage)));
438
438
}
439
439
440
440
// ignore if empty string
@@ -929,7 +929,7 @@ public function offsetGet($option, bool $triggerDeprecation = true)
929
929
}
930
930
931
931
if (!\is_array($value)) {
932
-
thrownewInvalidOptionsException(sprintf('The nested option "%s" with value %s is expected to be of type array, but is of type "%s".', $this->formatOptions([$option]), $this->formatValue($value), $this->formatTypeOf($value)));
932
+
thrownewInvalidOptionsException(sprintf('The nested option "%s" with value %s is expected to be of type array, but is of type "%s".', $this->formatOptions([$option]), $this->formatValue($value), get_debug_type($value)));
933
933
}
934
934
935
935
// The following section must be protected from cyclic calls.
@@ -1059,7 +1059,7 @@ public function offsetGet($option, bool $triggerDeprecation = true)
1059
1059
$this->calling[$option] = true;
1060
1060
try {
1061
1061
if (!\is_string($deprecationMessage = $deprecationMessage($this, $value))) {
1062
-
thrownewInvalidOptionsException(sprintf('Invalid type for deprecation message, expected string but got "%s", return an empty string to ignore.', \gettype($deprecationMessage)));
1062
+
thrownewInvalidOptionsException(sprintf('Invalid type for deprecation message, expected string but got "%s", return an empty string to ignore.', get_debug_type($deprecationMessage)));
1063
1063
}
1064
1064
} finally {
1065
1065
unset($this->calling[$option]);
@@ -1120,7 +1120,7 @@ private function verifyTypes(string $type, $value, array &$invalidTypes, int $le
@@ -842,18 +842,18 @@ public function testResolveFailsIfInvalidType($actualType, $allowedType, $except
842
842
publicfunctionprovideInvalidTypes()
843
843
{
844
844
return [
845
-
[true, 'string', 'The option "option" with value true is expected to be of type "string", but is of type "boolean".'],
846
-
[false, 'string', 'The option "option" with value false is expected to be of type "string", but is of type "boolean".'],
847
-
[fopen(__FILE__, 'r'), 'string', 'The option "option" with value resource is expected to be of type "string", but is of type "resource".'],
845
+
[true, 'string', 'The option "option" with value true is expected to be of type "string", but is of type "bool".'],
846
+
[false, 'string', 'The option "option" with value false is expected to be of type "string", but is of type "bool".'],
847
+
[fopen(__FILE__, 'r'), 'string', 'The option "option" with value resource is expected to be of type "string", but is of type "resource (stream)".'],
848
848
[[], 'string', 'The option "option" with value array is expected to be of type "string", but is of type "array".'],
849
849
[newOptionsResolver(), 'string', 'The option "option" with value Symfony\Component\OptionsResolver\OptionsResolver is expected to be of type "string", but is of type "Symfony\Component\OptionsResolver\OptionsResolver".'],
850
-
[42, 'string', 'The option "option" with value 42 is expected to be of type "string", but is of type "integer".'],
851
-
[null, 'string', 'The option "option" with value null is expected to be of type "string", but is of type "NULL".'],
850
+
[42, 'string', 'The option "option" with value 42 is expected to be of type "string", but is of type "int".'],
851
+
[null, 'string', 'The option "option" with value null is expected to be of type "string", but is of type "null".'],
852
852
['bar', '\stdClass', 'The option "option" with value "bar" is expected to be of type "\stdClass", but is of type "string".'],
853
-
[['foo', 12], 'string[]', 'The option "option" with value array is expected to be of type "string[]", but one of the elements is of type "integer".'],
854
-
[123, ['string[]', 'string'], 'The option "option" with value 123 is expected to be of type "string[]" or "string", but is of type "integer".'],
855
-
[[null], ['string[]', 'string'], 'The option "option" with value array is expected to be of type "string[]" or "string", but one of the elements is of type "NULL".'],
856
-
[['string', null], ['string[]', 'string'], 'The option "option" with value array is expected to be of type "string[]" or "string", but one of the elements is of type "NULL".'],
853
+
[['foo', 12], 'string[]', 'The option "option" with value array is expected to be of type "string[]", but one of the elements is of type "int".'],
854
+
[123, ['string[]', 'string'], 'The option "option" with value 123 is expected to be of type "string[]" or "string", but is of type "int".'],
855
+
[[null], ['string[]', 'string'], 'The option "option" with value array is expected to be of type "string[]" or "string", but one of the elements is of type "null".'],
856
+
[['string', null], ['string[]', 'string'], 'The option "option" with value array is expected to be of type "string[]" or "string", but one of the elements is of type "null".'],
857
857
[[\stdClass::class], ['string'], 'The option "option" with value array is expected to be of type "string", but is of type "array".'],
858
858
];
859
859
}
@@ -869,7 +869,7 @@ public function testResolveSucceedsIfValidType()
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "float[][][][]", but one of the elements is of type "integer".');
1909
+
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "float[][][][]", but one of the elements is of type "int".');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "boolean|string|array".');
1927
+
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "bool|string|array".');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "boolean|string|array".');
1940
+
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "int[][]", but one of the elements is of type "bool|string|array".');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "string|integer".');
1953
+
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "string|int".');
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "integer".');
1966
+
$this->expectExceptionMessage('The option "foo" with value array is expected to be of type "string[][][]", but one of the elements is of type "int".');
0 commit comments