diff --git a/src/Version/Definition/Type.php b/src/Version/Definition/Type.php index 3ba9308e..8b6c20c2 100644 --- a/src/Version/Definition/Type.php +++ b/src/Version/Definition/Type.php @@ -852,7 +852,7 @@ public function getDirectlyImplementedInterfaces(): array // dstu1 has its own special type interface if ($sourceMeta->isDSTU1() && !$this->isPrimitiveOrListType() && !$this->hasPrimitiveOrListParent()) { - if (null === $this->getParentType()) { + if (!$this->hasConcreteParent()) { $interfaces[PHPFHIR_TYPES_INTERFACE_DSTU1_TYPE] = $coreFiles ->getCoreFileByEntityName(PHPFHIR_TYPES_INTERFACE_DSTU1_TYPE) ->getFullyQualifiedNamespace(false); @@ -884,7 +884,7 @@ public function getDirectlyImplementedInterfaces(): array ->getCoreFileByEntityName(PHPFHIR_TYPES_INTERFACE_RESOURCE_TYPE) ->getFullyQualifiedNamespace(false); } - } else if (!$this->hasParent() && !$sourceMeta->isDSTU1()) { + } else if (!$this->hasParent() && !$sourceMeta->isDSTU1() && !$this->isAbstract()) { $interfaces[PHPFHIR_TYPES_INTERFACE_ELEMENT_TYPE] = $coreFiles ->getCoreFileByEntityName(PHPFHIR_TYPES_INTERFACE_ELEMENT_TYPE) ->getFullyQualifiedNamespace(false); @@ -917,10 +917,10 @@ public function getDirectlyUsedTraits(): array $parentType = $this->getParentType(); $coreFiles = $this->_version->getConfig()->getCoreFiles(); - if (null === $parentType) { + if (!$this->hasConcreteParent()) { // if this type has no parent(s), try to add all traits - if ($this->isCommentContainer()) { + if ($this->isCommentContainer() && !$this->hasCommentContainerParent()) { $traits[PHPFHIR_TYPES_TRAIT_COMMENT_CONTAINER] = $coreFiles ->getCoreFileByEntityName(PHPFHIR_TYPES_TRAIT_COMMENT_CONTAINER) ->getFullyQualifiedNamespace(false); diff --git a/template/versions/types/class_default.php b/template/versions/types/class_default.php index e76de05a..7fec8483 100644 --- a/template/versions/types/class_default.php +++ b/template/versions/types/class_default.php @@ -187,14 +187,13 @@ public function _getResourceType(): string /* */ $version, - 'type' => $type, - ] - ); -endif; +echo require_with( + PHPFHIR_TEMPLATE_VERSION_TYPES_VALIDATION_DIR . '/methods.php', + [ + 'version' => $version, + 'type' => $type, + ] +); if ($type->isPrimitiveContainer() || $type->hasPrimitiveContainerParent()) : ?> @@ -232,6 +231,8 @@ public function _nonValueFieldDefined(): bool ] ); +endif; + if (null === $type->getParentType()) : ?> /* */