throw new OptionDefinitionException(\sprintf('The options "%s" have a cyclic dependency.', $this->formatOptions(array_keys($this->calling)))); } // The following section must be protected from cyclic // calls. Set $calling for the current $option to detect a cyclic // dependency // BEGIN $this->calling[$option] = true; try { foreach ($this->normalizers[$option] as $normalizer) { $value = $normalizer($this, $value); } } finally { unset($this->calling[$option]); } // END } // Mark as resolved $this->resolved[$option] = $value; return $value; } private function verifyTypes(string $type, mixed $value, ?array &$invalidTypes = null, int $level = 0): bool { $type = trim($type); $allowedTypes = $this->splitOutsideParenthesis($type); if (\count($allowedTypes) > 1) { foreach ($allowedTypes as $allowedType) { if ($this->verifyTypes($allowedType, $value)) { return true; } } if (\is_array($invalidTypes) && (!$invalidTypes || $level > 0)) { $invalidTypes[get_debug_type($value)] = true; } return false; } $type = $allowedTypes[0]; if (str_starts_with($type, '(') && str_ends_with($type, ')')) { return $this->verifyTypes(substr($type, 1, -1), $value, $invalidTypes, $level); } if (\is_array($value) && str_ends_with($type, '[]')) { $type = substr($type, 0, -2); $valid = true; foreach ($value as $val) { if (!$this->verifyTypes($type, $val, $invalidTypes, $level + 1)) { $valid = false; } } return $valid; } if (('null' === $type && null === $value) || (isset(self::VALIDATION_FUNCTIONS[$type]) ? self::VALIDATION_FUNCTIONS[$type]($value) : $value instanceof $type)) { return true; } if (\is_array($invalidTypes) && (!$invalidTypes || $level > 0)) { $invalidTypes[get_debug_type($value)] = true; } return false; } /** * @return list */ private function splitOutsideParenthesis(string $type): array { return preg_split(<<<'EOF' / # Define a recursive subroutine for matching balanced parentheses (?(DEFINE) (? \( # Match an opening parenthesis (?: # Start a non-capturing group for the contents [^()] # Match any character that is not a parenthesis | # OR (?&balanced) # Recursively match a nested balanced group )* # Repeat the group for all contents \) # Match the final closing parenthesis ) ) # Match any balanced parenthetical group, then skip it (?&balanced)(*SKIP)(*FAIL) # Use the defined subroutine and discard the match | # OR \| # Match the pipe delimiter (only if not inside a skipped group) /x EOF, $type ); } /** * Returns whether a resolved option with the given name exists. * * @throws AccessException If accessing this method outside of {@link resolve()} * * @see \ArrayAccess::offsetExists() */ public function offsetExists(mixed $option): bool { if (!$this->locked) { throw new AccessException('Array access is only supported within closures of lazy options and normalizers.'); } return \array_key_exists($option, $this->defaults); } /** * Not supported. * * @throws AccessException */ public function offsetSet(mixed $option, mixed $value): void { throw new AccessException('Setting options via array access is not supported. Use setDefault() instead.'); } /** * Not supported. * * @throws AccessException */ public function offsetUnset(mixed $option): void { throw new AccessException('Removing options via array access is not supported. Use remove() instead.'); } /** * Returns the number of set options. * * This may be only a subset of the defined options. * * @throws AccessException If accessing this method outside of {@link resolve()} * * @see \Countable::count() */ public function count(): int { if (!$this->locked) { throw new AccessException('Counting is only supported within closures of lazy options and normalizers.'); } return \count($this->defaults); } /** * Sets whether ignore undefined options. * * @return $this */ public function setIgnoreUndefined(bool $ignore = true): static { $this->ignoreUndefined = $ignore; return $this; } /** * Returns a string representation of the value. * * This method returns the equivalent PHP tokens for most scalar types * (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped * in double quotes ("). */ private function formatValue(mixed $value): string { if (\is_object($value)) { return $value::class; } if (\is_array($value)) { return 'array'; } if (\is_string($value)) { return '"'.$value.'"'; } if (\is_resource($value)) { return 'resource'; } if (null === $value) { return 'null'; } if (false === $value) { return 'false'; } if (true === $value) { return 'true'; } return (string) $value; } /** * Returns a string representation of a list of values. * * Each of the values is converted to a string using * {@link formatValue()}. The values are then concatenated with commas. * * @see formatValue() */ private function formatValues(array $values): string { foreach ($values as $key => $value) { $values[$key] = $this->formatValue($value); } return implode(', ', $values); } private function formatOptions(array $options): string { if ($this->parentsOptions) { $prefix = array_shift($this->parentsOptions); if ($this->parentsOptions) { $prefix .= \sprintf('[%s]', implode('][', $this->parentsOptions)); } if ($this->prototype && null !== $this->prototypeIndex) { $prefix .= \sprintf('[%s]', $this->prototypeIndex); } $options = array_map(static fn (string $option): string => \sprintf('%s[%s]', $prefix, $option), $options); } return implode('", "', $options); } private function getParameterClassName(\ReflectionParameter $parameter): ?string { if (!($type = $parameter->getType()) instanceof \ReflectionNamedType || $type->isBuiltin()) { return null; } return $type->getName(); } } An Error Occurred: Whoops, looks like something went wrong.

Sorry, there was a problem we could not recover from.

The server returned a "500 - Whoops, looks like something went wrong."

Help me resolve this