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
// Yet undefined options can be marked as resolved, because we only need
181
214
// to resolve options with lazy closures, normalizers or validation
@@ -354,6 +387,11 @@ public function getDefinedOptions()
354
387
returnarray_keys($this->defined);
355
388
}
356
389
390
+
publicfunctionisNested(string$option): bool
391
+
{
392
+
returnisset($this->nested[$option]);
393
+
}
394
+
357
395
/**
358
396
* Deprecates an option, allowed types or values.
359
397
*
@@ -649,6 +687,7 @@ public function clear()
649
687
650
688
$this->defined = array();
651
689
$this->defaults = array();
690
+
$this->nested = array();
652
691
$this->required = array();
653
692
$this->resolved = array();
654
693
$this->lazy = array();
@@ -767,6 +806,32 @@ public function offsetGet($option)
767
806
768
807
$value = $this->defaults[$option];
769
808
809
+
// Resolve the option if it is a nested definition
810
+
if (isset($this->nested[$option])) {
811
+
// If the closure is already being called, we have a cyclic dependency
812
+
if (isset($this->calling[$option])) {
813
+
thrownewOptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', implode('", "', array_keys($this->calling))));
814
+
}
815
+
816
+
if (!\is_array($value)) {
817
+
thrownewInvalidOptionsException(sprintf('The nested option "%s" with value %s is expected to be of type array, but is of type "%s".', $option, $this->formatValue($value), $this->formatTypeOf($value, 'array')));
818
+
}
819
+
820
+
// The following section must be protected from cyclic calls.
821
+
// BEGIN
822
+
$this->calling[$option] = true;
823
+
try {
824
+
$resolver = newself();
825
+
foreach ($this->nested[$option] as$closure) {
826
+
$closure($resolver, $this);
<
850C
div aria-hidden="true" style="left:-2px" class="position-absolute top-0 d-flex user-select-none DiffLineTableCellParts-module__in-progress-comment-indicator--hx3m3">
827
+
}
828
+
$value = $resolver->resolve($value);
829
+
} finally {
830
+
unset($this->calling[$option]);
831
+
}
832
+
// END
833
+
}
834
+
770
835
// Resolve the option if the default value is lazily evaluated
771
836
if (isset($this->lazy[$option])) {
772
837
// If the closure is already being called, we have a cyclic
0 commit comments