Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
uses: ./.github/actions/bootstrap
with:
php-version: ${{ matrix.php-version }}

- name: 'Run tests'
# language=sh
run: ./vendor/bin/phpunit -c 'phpunit/Builder.xml'
Expand Down
8 changes: 4 additions & 4 deletions src/Utilities/TypeHintUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static function primitivePHPValueTypeSetterDoc(Version $version

if ($asArray) {
$hintTypes[] = array_map(function (string $v) {
return sprintf('%s[]', $v);
return sprintf('iterable<%s>', $v);
}, $hintTypes);
}

Expand Down Expand Up @@ -229,13 +229,13 @@ public static function propertyGetterDocHint(Version $version,
$versionCoreFiles = $version->getVersionCoreFiles();
$containedTypeInterface = $versionCoreFiles->getCoreFileByEntityName(PHPFHIR_VERSION_INTERFACE_VERSION_CONTAINED_TYPE);
if ($property->isCollection()) {
return "{$containedTypeInterface->getFullyQualifiedName(true)}[]";
return "iterable<{$containedTypeInterface->getFullyQualifiedName(true)}>";
}
return ($nullable ? 'null|' : '') . $containedTypeInterface->getFullyQualifiedName(true);
}

if ($property->isCollection()) {
return "{$pt->getFullyQualifiedClassName(true)}[]";
return "iterable<{$pt->getFullyQualifiedClassName(true)}>";
}

return ($nullable ? 'null|' : '') . $pt->getFullyQualifiedClassName(true);
Expand Down Expand Up @@ -280,7 +280,7 @@ public static function buildSetterParameterDocHint(Version $version,
}

if (!$ignoreCollection && $property->isCollection()) {
$hintTypes = array_map(fn(string $n) => "{$n}[]", $hintTypes);
$hintTypes = array_map(fn(string $n) => "iterable<{$n}>", $hintTypes);
}

if ($nullable) {
Expand Down
9 changes: 5 additions & 4 deletions src/Version/Definition/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,14 @@ public function getValueFHIRType(): ?Type
}

/**
* @param \DCarbone\PHPFHIR\Version\Definition\Type $_valueFHIRType
* @param \DCarbone\PHPFHIR\Version\Definition\Type $type
* @return \DCarbone\PHPFHIR\Version\Definition\Property
*/
public function setValueFHIRType(Type $_valueFHIRType): Property
public function setValueFHIRType(Type $type): Property
{
$this->_valueFHIRType = $_valueFHIRType;
$this->_valueFHIRTypeName = $_valueFHIRType->getFHIRName();
$this->_valueFHIRType = $type;
$this->_valueFHIRTypeName = $type->getFHIRName();
$type->setUsedAsProperty();
return $this;
}

Expand Down
Loading