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
+12-59Lines changed: 12 additions & 59 deletions
Original file line number
Diff line number
Diff line change
@@ -388,11 +388,7 @@ public function setNormalizer($option, \Closure $normalizer)
388
388
}
389
389
390
390
if (!isset($this->defined[$option])) {
391
-
thrownewUndefinedOptionsException(sprintf(
392
-
'The option "%s" does not exist. Defined options are: "%s".',
393
-
$option,
394
-
implode('", "', array_keys($this->defined))
395
-
));
391
+
thrownewUndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined))));
396
392
}
397
393
398
394
$this->normalizers[$option] = $normalizer;
@@ -466,11 +462,7 @@ public function setAllowedValues($option, $allowedValues = null)
466
462
}
467
463
468
464
if (!isset($this->defined[$option])) {
469
-
thrownewUndefinedOptionsException(sprintf(
470
-
'The option "%s" does not exist. Defined options are: "%s".',
471
-
$option,
472
-
implode('", "', array_keys($this->defined))
473
-
));
465
+
thrownewUndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined))));
@@ -522,11 +514,7 @@ public function addAllowedValues($option, $allowedValues = null)
522
514
}
523
515
524
516
if (!isset($this->defined[$option])) {
525
-
thrownewUndefinedOptionsException(sprintf(
526
-
'The option "%s" does not exist. Defined options are: "%s".',
527
-
$option,
528
-
implode('", "', array_keys($this->defined))
529
-
));
517
+
thrownewUndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined))));
530
518
}
531
519
532
520
if (!\is_array($allowedValues)) {
@@ -578,11 +566,7 @@ public function setAllowedTypes($option, $allowedTypes = null)
578
566
}
579
567
580
568
if (!isset($this->defined[$option])) {
581
-
thrownewUndefinedOptionsException(sprintf(
582
-
'The option "%s" does not exist. Defined options are: "%s".',
583
-
$option,
584
-
implode('", "', array_keys($this->defined))
585
-
));
569
+
thrownewUndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined))));
@@ -628,11 +612,7 @@ public function addAllowedTypes($option, $allowedTypes = null)
628
612
}
629
613
630
614
if (!isset($this->defined[$option])) {
631
-
thrownewUndefinedOptionsException(sprintf(
632
-
'The option "%s" does not exist. Defined options are: "%s".',
633
-
$option,
634
-
implode('", "', array_keys($this->defined))
635
-
));
615
+
thrownewUndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined))));
636
616
}
637
617
638
618
if (!isset($this->allowedTypes[$option])) {
@@ -737,11 +717,7 @@ public function resolve(array $options = array())
737
717
ksort($clone->defined);
738
718
ksort($diff);
739
719
740
-
thrownewUndefinedOptionsException(sprintf(
741
-
(\count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Defined options are: "%s".',
742
-
implode('", "', array_keys($diff)),
743
-
implode('", "', array_keys($clone->defined))
744
-
));
720
+
thrownewUndefinedOptionsException(sprintf((\count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Defined options are: "%s".', implode('", "', array_keys($diff)), implode('", "', array_keys($clone->defined))));
745
721
}
746
722
747
723
// Override options set by the user
@@ -756,10 +732,7 @@ public function resolve(array $options = array())
756
732
if (\count($diff) > 0) {
757
733
ksort($diff);
758
734
759
-
thrownewMissingOptionsException(sprintf(
760
-
\count($diff) > 1 ? 'The required options "%s" are missing.' : 'The required option "%s" is missing.',
761
-
implode('", "', array_keys($diff))
762
-
));
735
+
thrownewMissingOptionsException(sprintf(\count($diff) > 1 ? 'The required options "%s" are missing.' : 'The required option "%s" is missing.', implode('", "', array_keys($diff))));
763
736
}
764
737
765
738
// Lock the container
@@ -803,17 +776,10 @@ public function offsetGet($option)
803
776
// Check whether the option is set at all
804
777
if (!array_key_exists($option, $this->defaults)) {
805
778
if (!isset($this->defined[$option])) {
806
-
thrownewNoSuchOptionException(sprintf(
807
-
'The option "%s" does not exist. Defined options are: "%s".',
808
-
$option,
809
-
implode('", "', array_keys($this->defined))
810
-
));
779
+
thrownewNoSuchOptionException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined))));
811
780
}
812
781
813
-
thrownewNoSuchOptionException(sprintf(
814
-
'The optional option "%s" has no value set. You should make sure it is set with "isset" before reading it.',
815
-
$option
816
-
));
782
+
thrownewNoSuchOptionException(sprintf('The optional option "%s" has no value set. You should make sure it is set with "isset" before reading it.', $option));
817
783
}
818
784
819
785
$value = $this->defaults[$option];
@@ -823,10 +789,7 @@ public function offsetGet($option)
823
789
// If the closure is already being called, we have a cyclic
824
790
// dependency
825
791
if (isset($this->calling[$option])) {
826
-
thrownewOptionDefinitionException(sprintf(
827
-
'The options "%s" have a cyclic dependency.',
828
-
implode('", "', array_keys($this->calling))
829
-
));
792
+
thrownewOptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', implode('", "', array_keys($this->calling))));
830
793
}
831
794
832
795
// The following section must be protected from cyclic
@@ -872,14 +835,7 @@ public function offsetGet($option)
872
835
}
873
836
874
837
if (!$valid) {
875
-
thrownewInvalidOptionsException(sprintf(
876
-
'The option "%s" with value %s is expected to be of type '.
877
-
'"%s", but is of type "%s".',
878
-
$option,
879
-
$this->formatValue($value),
880
-
implode('" or "', $this->allowedTypes[$option]),
881
-
$this->formatTypeOf($value)
882
-
));
838
+
thrownewInvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but is of type "%s".', $option, $this->formatValue($value), implode('" or "', $this->allowedTypes[$option]), $this->formatTypeOf($value)));
883
839
}
884
840
}
885
841
@@ -928,10 +884,7 @@ public function offsetGet($option)
928
884
// If the closure is already being called, we have a cyclic
929
885
// dependency
930
886
if (isset($this->calling[$option])) {
931
-
thrownewOptionDefinitionException(sprintf(
932
-
'The options "%s" have a cyclic dependency.',
933
-
implode('", "', array_keys($this->calling))
934
-
));
887
+
thrownewOptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', implode('", "', array_keys($this->calling))));
0 commit comments