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
+30-30Lines changed: 30 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -438,11 +438,11 @@ public function setDeprecated(string $option, string $package, string $version,
438
438
}
439
439
440
440
if (!isset($this->defined[$option])) {
441
-
thrownewUndefinedOptionsException(sprintf('The option "%s" does not exist, defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
441
+
thrownewUndefinedOptionsException(\sprintf('The option "%s" does not exist, defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
442
442
}
443
443
444
444
if (!\is_string($message) && !$messageinstanceof \Closure) {
445
-
thrownewInvalidArgumentException(sprintf('Invalid type for deprecation message argument, expected string or \Closure, but got "%s".', get_debug_type($message)));
445
+
thrownewInvalidArgumentException(\sprintf('Invalid type for deprecation message argument, expected string or \Closure, but got "%s".', get_debug_type($message)));
446
446
}
447
447
448
448
// ignore if empty string
@@ -497,7 +497,7 @@ public function setNormalizer(string $option, \Closure $normalizer): static
497
497
}
498
498
499
499
if (!isset($this->defined[$option])) {
500
-
thrownewUndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
500
+
thrownewUndefinedOptionsException(\sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
501
501
}
502
502
503
503
$this->normalizers[$option] = [$normalizer];
@@ -538,7 +538,7 @@ public function addNormalizer(string $option, \Closure $normalizer, bool $forceP
538
538
}
539
539
540
540
if (!isset($this->defined[$option])) {
541
-
thrownewUndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
541
+
thrownewUndefinedOptionsException(\sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
542
542
}
543
543
544
544
if ($forcePrepend) {
@@ -581,7 +581,7 @@ public function setAllowedValues(string $option, mixed $allowedValues): static
581
581
}
582
582
583
583
if (!isset($this->defined[$option])) {
584
-
thrownewUndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
584
+
thrownewUndefinedOptionsException(\sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
@@ -621,7 +621,7 @@ public function addAllowedValues(string $option, mixed $allowedValues): static
621
621
}
622
622
623
623
if (!isset($this->defined[$option])) {
624
-
thrownewUndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
624
+
thrownewUndefinedOptionsException(\sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
625
625
}
626
626
627
627
if (!\is_array($allowedValues)) {
@@ -661,7 +661,7 @@ public function setAllowedTypes(string $option, string|array $allowedTypes): sta
661
661
}
662
662
663
663
if (!isset($this->defined[$option])) {
664
-
thrownewUndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
664
+
thrownewUndefinedOptionsException(\sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
@@ -695,7 +695,7 @@ public function addAllowedTypes(string $option, string|array $allowedTypes): sta
695
695
}
696
696
697
697
if (!isset($this->defined[$option])) {
698
-
thrownewUndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
698
+
thrownewUndefinedOptionsException(\sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
699
699
}
700
700
701
701
if (!isset($this->allowedTypes[$option])) {
@@ -716,7 +716,7 @@ public function addAllowedTypes(string $option, string|array $allowedTypes): sta
thrownewOptionDefinitionException(sprintf('The option "%s" is already defined.', $option));
719
+
thrownewOptionDefinitionException(\sprintf('The option "%s" is already defined.', $option));
720
720
}
721
721
722
722
returnnewOptionConfigurator($option, $this);
@@ -737,7 +737,7 @@ public function setInfo(string $option, string $info): static
737
737
}
738
738
739
739
if (!isset($this->defined[$option])) {
740
-
thrownewUndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
740
+
thrownewUndefinedOptionsException(\sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
741
741
}
742
742
743
743
$this->info[$option] = $info;
@@ -751,7 +751,7 @@ public function setInfo(string $option, string $info): static
751
751
publicfunctiongetInfo(string$option): ?string
752
752
{
753
753
if (!isset($this->defined[$option])) {
754
-
thrownewUndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
754
+
thrownewUndefinedOptionsException(\sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
755
755
}
756
756
757
757
return$this->info[$option] ?? null;
@@ -873,7 +873,7 @@ public function resolve(array $options = []): array
873
873
ksort($clone->defined);
874
874
ksort($diff);
875
875
876
-
thrownewUndefinedOptionsException(sprintf((\count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Defined options are: "%s".', $this->formatOptions(array_keys($diff)), implode('", "', array_keys($clone->defined))));
876
+
thrownewUndefinedOptionsException(\sprintf((\count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Defined options are: "%s".', $this->formatOptions(array_keys($diff)), implode('", "', array_keys($clone->defined))));
877
877
}
878
878
879
879
// Override options set by the user
@@ -893,7 +893,7 @@ public function resolve(array $options = []): array
893
893
if (\count($diff) > 0) {
894
894
ksort($diff);
895
895
896
-
thrownewMissingOptionsException(sprintf(\count($diff) > 1 ? 'The required options "%s" are missing.' : 'The required option "%s" is missing.', $this->formatOptions(array_keys($diff))));
896
+
thrownewMissingOptionsException(\sprintf(\count($diff) > 1 ? 'The required options "%s" are missing.' : 'The required option "%s" is missing.', $this->formatOptions(array_keys($diff))));
897
897
}
898
898
899
899
// Lock the container
@@ -939,10 +939,10 @@ public function offsetGet(mixed $option, bool $triggerDeprecation = true): mixed
939
939
// Check whether the option is set at all
940
940
if (!isset($this->defaults[$option]) && !\array_key_exists($option, $this->defaults)) {
941
941
if (!isset($this->defined[$option])) {
942
-
thrownewNoSuchOptionException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
942
+
thrownewNoSuchOptionException(\sprintf('The option "%s" does not exist. Defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
943
943
}
944
944
945
-
thrownewNoSuchOptionException(sprintf('The optional option "%s" has no value set. You should make sure it is set with "isset" before reading it.', $this->formatOptions([$option])));
945
+
thrownewNoSuchOptionException(\sprintf('The optional option "%s" has no value set. You should make sure it is set with "isset" before reading it.', $this->formatOptions([$option])));
946
946
}
947
947
948
948
$value = $this->defaults[$option];
@@ -951,11 +951,11 @@ public function offsetGet(mixed $option, bool $triggerDeprecation = true): mixed
951
951
if (isset($this->nested[$option])) {
952
952
// If the closure is already being called, we have a cyclic dependency
953
953
if (isset($this->calling[$option])) {
954
-
thrownewOptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling))));
954
+
thrownewOptionDefinitionException(\sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling))));
955
955
}
956
956
957
957
if (!\is_array($value)) {
958
-
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)));
958
+
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)));
959
959
}
960
960
961
961
// The following section must be protected from cyclic calls.
@@ -973,7 +973,7 @@ public function offsetGet(mixed $option, bool $triggerDeprecation = true): mixed
973
973
$values = [];
974
974
foreach ($valueas$index => $prototypeValue) {
975
975
if (!\is_array($prototypeValue)) {
976
-
thrownewInvalidOptionsException(sprintf('The value of the option "%s" is expected to be of type array of array, but is of type array of "%s".', $this->formatOptions([$option]), get_debug_type($prototypeValue)));
976
+
thrownewInvalidOptionsException(\sprintf('The value of the option "%s" is expected to be of type array of array, but is of type array of "%s".', $this->formatOptions([$option]), get_debug_type($prototypeValue)));
977
977
}
978
978
979
979
$resolver->prototypeIndex = $index;
@@ -994,7 +994,7 @@ public function offsetGet(mixed $option, bool $triggerDeprecation = true): mixed
994
994
// If the closure is already being called, we have a cyclic
995
995
// dependency
996
996
if (isset($this->calling[$option])) {
997
-
thrownewOptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling))));
997
+
thrownewOptionDefinitionException(\sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling))));
998
998
}
999
999
1000
1000
// The following section must be protected from cyclic
@@ -1030,10 +1030,10 @@ public function offsetGet(mixed $option, bool $triggerDeprecation = true): mixed
if (\is_array($value) && $allowedContainsArrayType) {
1033
-
thrownewInvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but one of the elements is of type "%s".', $this->formatOptions([$option]), $fmtActualValue, $fmtAllowedTypes, $fmtProvidedTypes));
1033
+
thrownewInvalidOptionsException(\sprintf('The option "%s" with value %s is expected to be of type "%s", but one of the elements is of type "%s".', $this->formatOptions([$option]), $fmtActualValue, $fmtAllowedTypes, $fmtProvidedTypes));
1034
1034
}
1035
1035
1036
-
thrownewInvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but is of type "%s".', $this->formatOptions([$option]), $fmtActualValue, $fmtAllowedTypes, $fmtProvidedTypes));
1036
+
thrownewInvalidOptionsException(\sprintf('The option "%s" with value %s is expected to be of type "%s", but is of type "%s".', $this->formatOptions([$option]), $fmtActualValue, $fmtAllowedTypes, $fmtProvidedTypes));
1037
1037
}
1038
1038
}
1039
1039
@@ -1062,21 +1062,21 @@ public function offsetGet(mixed $option, bool $triggerDeprecation = true): mixed
@@ -1092,13 +1092,13 @@ public function offsetGet(mixed $option, bool $triggerDeprecation = true): mixed
1092
1092
if ($messageinstanceof \Closure) {
1093
1093
// If the closure is already being called, we have a cyclic dependency
1094
1094
if (isset($this->calling[$option])) {
1095
-
thrownewOptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling))));
1095
+
thrownewOptionDefinitionException(\sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling))));
1096
1096
}
1097
1097
1098
1098
$this->calling[$option] = true;
1099
1099
try {
1100
1100
if (!\is_string($message = $message($this, $value))) {
1101
-
thrownewInvalidOptionsException(sprintf('Invalid type for deprecation message, expected string but got "%s", return an empty string to ignore.', get_debug_type($message)));
1101
+
thrownewInvalidOptionsException(\sprintf('Invalid type for deprecation message, expected string but got "%s", return an empty string to ignore.', get_debug_type($message)));
1102
1102
}
1103
1103
} finally {
1104
1104
unset($this->calling[$option]);
@@ -1115,7 +1115,7 @@ public function offsetGet(mixed $option, bool $triggerDeprecation = true): mixed
1115
1115
// If the closure is already being called, we have a cyclic
1116
1116
// dependency
1117
1117
if (isset($this->calling[$option])) {
1118
-
thrownewOptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling))));
1118
+
thrownewOptionDefinitionException(\sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling))));
1119
1119
}
1120
1120
1121
1121
// The following section must be protected from cyclic
@@ -1293,14 +1293,14 @@ private function formatOptions(array $options): string
0 commit comments