Skip to content

Commit

Permalink
few generation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dcarbone committed Apr 12, 2024
1 parent acd54c5 commit d969ed9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 4 additions & 2 deletions files/funcs.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* limitations under the License.
*/

use DCarbone\PHPFHIR\Config\VersionConfig;

/**
* require_with is used to ensure a clean context per required template file.
*
Expand All @@ -36,11 +38,11 @@ function require_with(string $requiredFile, array $vars)
)
);
}
if (!isset($config) || !($config instanceof \DCarbone\PHPFHIR\Config\VersionConfig)) {
if (!isset($config) || !($config instanceof VersionConfig)) {
throw new \LogicException(sprintf(
'Refusing to require "%s" as you didn\'t provide \'config\' => $config(%s)',
$requiredFile,
\DCarbone\PHPFHIR\Config\VersionConfig::class,
VersionConfig::class,
));
}
// unset vars defined by this func
Expand Down
6 changes: 3 additions & 3 deletions src/Definition/TypeDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public static function determinePrimitiveTypes(VersionConfig $config, Types $typ
$logger = $config->getLogger();
foreach ($types->getIterator() as $type) {
if (in_array($type->getFHIRName(), self::DSTU1_PRIMITIVES, true)) {
$ptn = PrimitiveType::STRING;
$ptn = PrimitiveType::STRING->value;
$logger->debug(sprintf('(DSTU1 suppport) Type "%s" determined to be DSTU1 primitive', $type->getFHIRName()));
} elseif ($type->hasPrimitiveParent()) {
$ptn = $type->getParentType()->getFHIRName();
Expand Down Expand Up @@ -348,8 +348,8 @@ private static function determineParsedTypeKind(VersionConfig $config, Types $ty
}

if (!$set) {
$logger->debug(sprintf('Setting Type "%s" kind to root type kind "%s"', $type->getFHIRName(), $rootTypeKind));
self::setTypeKind($config, $types, $type, (string)$rootTypeKind);
$logger->debug(sprintf('Setting Type "%s" kind to root type kind "%s"', $type->getFHIRName(), $rootTypeKind->value));
self::setTypeKind($config, $types, $type, $rootTypeKind->value);
}

return;
Expand Down
2 changes: 1 addition & 1 deletion template/properties/methods.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
);
else :
echo require_with(
PHPFHIR_TEMPLATE_PROPERTIES_DIR . DIRECTORY_SEPARATOR . 'methods' . DIRECTORY_SEPARATOR . 'methods/default.php',
PHPFHIR_TEMPLATE_PROPERTIES_DIR . DIRECTORY_SEPARATOR . 'methods' . DIRECTORY_SEPARATOR . 'default.php',
[
'config' => $config,
'type' => $type,
Expand Down
2 changes: 0 additions & 2 deletions template/properties/methods/primitive/integer_type.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
/** @var \DCarbone\PHPFHIR\Enum\PrimitiveType $primitiveType */
/** @var string $typeClassName */

$primitiveTypeString = (string)$primitiveType;

ob_start(); ?>
/**
* @param <?php echo TypeHintUtils::primitivePHPValueTypeDoc($config, $primitiveType, true, false, 'string'); ?> $value
Expand Down

0 comments on commit d969ed9

Please sign in to comment.