diff --git a/composer.json b/composer.json index 063233c..9f955e1 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.4", "roave/security-advisories": "dev-master" }, "require-dev": { diff --git a/src/ImmutableRecordLogic.php b/src/ImmutableRecordLogic.php index 91f7c90..d271844 100644 --- a/src/ImmutableRecordLogic.php +++ b/src/ImmutableRecordLogic.php @@ -277,34 +277,9 @@ private static function buildPropTypeMap() continue; } - if (! $refObj->hasMethod($prop->getName())) { - throw new \RuntimeException( - \sprintf( - 'No method found for Record property %s of %s that has the same name.', - $prop->getName(), - __CLASS__ - ) - ); - } - - $method = $refObj->getMethod($prop->getName()); - - if (! $method->hasReturnType()) { - throw new \RuntimeException( - \sprintf( - 'Method %s of Record %s does not have a return type', - $method->getName(), - __CLASS__ - ) - ); - } - - /** @var \ReflectionNamedType $returnType */ - $returnType = $method->getReturnType(); - - $type = $returnType->getName(); + $type = $prop->getType(); - $propTypeMap[$prop->getName()] = [$type, self::isScalarType($type), $method->getReturnType()->allowsNull()]; + $propTypeMap[$prop->getName()] = [(string) $type, self::isScalarType((string) $type), $type->allowsNull()]; } return $propTypeMap;