Skip to content

Commit

Permalink
Merge pull request #3823 from c4ll-m3-j4ck/patch-1
Browse files Browse the repository at this point in the history
Add float case handling to NodePropertyConversionService
  • Loading branch information
grebaldi authored Jul 12, 2024
2 parents 7bb5c4f + b5d33fd commit 3616efd
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Classes/Domain/Service/NodePropertyConversionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ public function convert(string $propertyType, string|array|null $rawValue): mixe
case 'DateTime':
return $this->convertDateTime($rawValue);

case 'float':
return $this->convertFloat($rawValue);

case 'integer':
return $this->convertInteger($rawValue);

Expand Down Expand Up @@ -153,6 +156,20 @@ protected function convertDateTime(string|array $rawValue): ?\DateTime
return null;
}

/**
* Convert raw value to float
*
* @param string|array<int|string,mixed> $rawValue
*/
protected function convertFloat(string|array $rawValue): ?float
{
if (is_numeric($rawValue)) {
return (float)$rawValue;
}

return null;
}

/**
* Convert raw value to integer
*
Expand Down

0 comments on commit 3616efd

Please sign in to comment.