diff --git a/src/Builder/Creator/AbstractReflectionClass.php b/src/Builder/Creator/AbstractReflectionClass.php index 2fae386f..29fba2ac 100644 --- a/src/Builder/Creator/AbstractReflectionClass.php +++ b/src/Builder/Creator/AbstractReflectionClass.php @@ -36,6 +36,11 @@ class AbstractReflectionClass */ protected const RETURN_TYPE_INT = 'int'; + /** + * @var string + */ + protected const RETURN_TYPE_FLOAT = 'float'; + /** * @param mixed $value * diff --git a/src/Builder/Creator/MethodDocBlockCreator.php b/src/Builder/Creator/MethodDocBlockCreator.php index 3707accf..776ff37c 100644 --- a/src/Builder/Creator/MethodDocBlockCreator.php +++ b/src/Builder/Creator/MethodDocBlockCreator.php @@ -29,6 +29,12 @@ public function createMethodDocBlock($value): Doc if (is_bool($value)) { $docBlockReturnType = static::RETURN_TYPE_BOOL; } + if (is_int($value)) { + $docBlockReturnType = static::RETURN_TYPE_INT; + } + if (is_float($value)) { + $docBlockReturnType = static::RETURN_TYPE_FLOAT; + } $docBlockReturnItems[] = ' * @return ' . $docBlockReturnType; $docBlockReturnItems[] = ' */'; diff --git a/src/Builder/Creator/MethodReturnTypeCreator.php b/src/Builder/Creator/MethodReturnTypeCreator.php index f8f024d4..230cb7b6 100644 --- a/src/Builder/Creator/MethodReturnTypeCreator.php +++ b/src/Builder/Creator/MethodReturnTypeCreator.php @@ -28,6 +28,14 @@ public function createMethodReturnType($value): Identifier $returnType = static::RETURN_TYPE_BOOL; } + if (is_float($value)) { + $returnType = static::RETURN_TYPE_FLOAT; + } + + if (is_int($value)) { + $returnType = static::RETURN_TYPE_INT; + } + return new Identifier($returnType); } }