$child instanceof PrototypedArrayNode =>
$this->
handlePrototypedArrayNode($child,
$class,
$namespace),
$child instanceof VariableNode =>
$this->
handleVariableNode($child,
$class),
$child instanceof ArrayNode =>
$this->
handleArrayNode($child,
$class,
$namespace),
default =>
throw new \
RuntimeException(sprintf('Unknown node "%s".',
$child::
class)),
};
} } private function handleArrayNode(ArrayNode
$node, ClassBuilder
$class, string
$namespace): void
{ $childClass =
new ClassBuilder($namespace,
$node->
getName());
$childClass->
setAllowExtraKeys($node->
shouldIgnoreExtraKeys());
$class->
addRequire($childClass);
$this->classes
[] =
$childClass;
$hasNormalizationClosures =
$this->
hasNormalizationClosures($node);
$comment =
$this->
getComment($node);
if ($hasNormalizationClosures) { $comment =
sprintf(" * @template TValue\n * @param TValue \$value\n%s",
$comment);
$comment .=
sprintf(' * @return %s|$this'."\n",
$childClass->
getFqcn());
$comment .=
sprintf(' * @psalm-return (TValue is array ? %s : static)'."\n ",
$childClass->
getFqcn());
} if ('' !==
$comment) {