Skip to content

Commit ad54134

Browse files
committed
First pass at adding php8 attributes to things
1 parent 561860c commit ad54134

File tree

9 files changed

+28
-256
lines changed

9 files changed

+28
-256
lines changed

.github/workflows/tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
uses: ./.github/actions/bootstrap
4444
with:
4545
php-version: ${{ matrix.php-version }}
46+
4647
- name: 'Run tests'
4748
# language=sh
4849
run: ./vendor/bin/phpunit -c 'phpunit/Builder.xml'

output/tests/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/Utilities/TypeHintUtils.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static function primitivePHPValueTypeSetterDoc(Version $version
6565

6666
if ($asArray) {
6767
$hintTypes[] = array_map(function (string $v) {
68-
return sprintf('%s[]', $v);
68+
return sprintf('iterable<%s>', $v);
6969
}, $hintTypes);
7070
}
7171

@@ -229,13 +229,13 @@ public static function propertyGetterDocHint(Version $version,
229229
$versionCoreFiles = $version->getVersionCoreFiles();
230230
$containedTypeInterface = $versionCoreFiles->getCoreFileByEntityName(PHPFHIR_VERSION_INTERFACE_VERSION_CONTAINED_TYPE);
231231
if ($property->isCollection()) {
232-
return "{$containedTypeInterface->getFullyQualifiedName(true)}[]";
232+
return "iterable<{$containedTypeInterface->getFullyQualifiedName(true)}>";
233233
}
234234
return ($nullable ? 'null|' : '') . $containedTypeInterface->getFullyQualifiedName(true);
235235
}
236236

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

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

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

286286
if ($nullable) {

src/Version/Definition/Property.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,14 @@ public function getValueFHIRType(): ?Type
193193
}
194194

195195
/**
196-
* @param \DCarbone\PHPFHIR\Version\Definition\Type $_valueFHIRType
196+
* @param \DCarbone\PHPFHIR\Version\Definition\Type $type
197197
* @return \DCarbone\PHPFHIR\Version\Definition\Property
198198
*/
199-
public function setValueFHIRType(Type $_valueFHIRType): Property
199+
public function setValueFHIRType(Type $type): Property
200200
{
201-
$this->_valueFHIRType = $_valueFHIRType;
202-
$this->_valueFHIRTypeName = $_valueFHIRType->getFHIRName();
201+
$this->_valueFHIRType = $type;
202+
$this->_valueFHIRTypeName = $type->getFHIRName();
203+
$type->setUsedAsProperty();
203204
return $this;
204205
}
205206

0 commit comments

Comments
 (0)