Skip to content

Commit acd56a8

Browse files
author
Alexander Miertsch
authored
Merge pull request #5 from arnedesmedt/php7.4
use php7.4 functionality
2 parents 7fbb831 + 67f9058 commit acd56a8

File tree

2 files changed

+3
-28
lines changed

2 files changed

+3
-28
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717
],
1818
"require": {
19-
"php": "^7.2",
19+
"php": "^7.4",
2020
"roave/security-advisories": "dev-master"
2121
},
2222
"require-dev": {

src/ImmutableRecordLogic.php

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -277,34 +277,9 @@ private static function buildPropTypeMap()
277277
continue;
278278
}
279279

280-
if (! $refObj->hasMethod($prop->getName())) {
281-
throw new \RuntimeException(
282-
\sprintf(
283-
'No method found for Record property %s of %s that has the same name.',
284-
$prop->getName(),
285-
__CLASS__
286-
)
287-
);
288-
}
289-
290-
$method = $refObj->getMethod($prop->getName());
291-
292-
if (! $method->hasReturnType()) {
293-
throw new \RuntimeException(
294-
\sprintf(
295-
'Method %s of Record %s does not have a return type',
296-
$method->getName(),
297-
__CLASS__
298-
)
299-
);
300-
}
301-
302-
/** @var \ReflectionNamedType $returnType */
303-
$returnType = $method->getReturnType();
304-
305-
$type = $returnType->getName();
280+
$type = $prop->getType();
306281

307-
$propTypeMap[$prop->getName()] = [$type, self::isScalarType($type), $method->getReturnType()->allowsNull()];
282+
$propTypeMap[$prop->getName()] = [(string) $type, self::isScalarType((string) $type), $type->allowsNull()];
308283
}
309284

310285
return $propTypeMap;

0 commit comments

Comments
 (0)