Skip to content

Commit 713fec7

Browse files
committed
allowing "root" types to be instantiated
1 parent a17035e commit 713fec7

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

template/types/definition.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
/** @var \DCarbone\PHPFHIR\Definition\Type $type */
2121
/** @var \DCarbone\PHPFHIR\Definition\Type|null $parentType */
2222

23-
$isRoot = $type->getKind()->isRoot($config->getVersion()->getName());
2423
$interfaces = $type->getDirectlyImplementedInterfaces();
2524
$traits = $type->getDirectlyUsedTraits();
2625

template/types/serialization/xml.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
ob_start();
3434

35-
if (!$typeKind->isRoot($versionName)) : ?>
35+
if (!$type->isAbstract()) : ?>
3636
/**
3737
* @return string
3838
*/

template/types/serialization/xml/unserialize/header.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static function xmlUnserialize(null|string|\DOMElement $element = null, n
5050
if (!($element instanceof \DOMElement)) {
5151
throw new \InvalidArgumentException(sprintf('<?php echo $typeClassName?>::xmlUnserialize - $node value must be null, \\DOMElement, or valid XML string, %s seen', is_object($element) ? get_class($element) : gettype($element)));
5252
}
53-
<?php if ($typeKind->isRoot($versionName)) : // root types may not be instantiated directly ?>
53+
<?php if ($type->isAbstract()) : // abstract types may not be instantiated directly ?>
5454
if (null === $type) {
5555
throw new \RuntimeException('<?php echo $typeClassName; ?>::xmlUnserialize: Cannot unserialize directly into root type');
5656
} else if (!($type instanceof <?php echo $typeClassName; ?>)) {

0 commit comments

Comments
 (0)