diff --git a/src/Generator/CodeGeneratorAbstract.php b/src/Generator/CodeGeneratorAbstract.php index 943773d..c57d68e 100644 --- a/src/Generator/CodeGeneratorAbstract.php +++ b/src/Generator/CodeGeneratorAbstract.php @@ -281,12 +281,22 @@ protected function supportsExtends(): bool private function supportsMap(Code\Name $name, MapDefinitionType $type): bool { - return !!$this->writeMap($name, $this->generator->getType($type->getSchema()), $type); + $schema = $type->getSchema(); + if (!$schema instanceof PropertyTypeAbstract) { + return false; + } + + return !!$this->writeMap($name, $this->generator->getType($schema), $type); } private function supportsArray(Code\Name $name, ArrayDefinitionType $type): bool { - return !!$this->writeArray($name, $this->generator->getType($type->getSchema()), $type); + $schema = $type->getSchema(); + if (!$schema instanceof PropertyTypeAbstract) { + return false; + } + + return !!$this->writeArray($name, $this->generator->getType($schema), $type); } abstract protected function writeStruct(Code\Name $name, array $properties, ?string $extends, ?array $generics, ?array $templates, StructDefinitionType $origin): string;