for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace TimiTao\ValueObject\Beberlei\Nullable;
use Exception;
use TimiTao\ValueObject\Nullable\ValueObject\FloatValueObject as FloatValueObjectInterface;
abstract class FloatValueObject implements FloatValueObjectInterface
{
private $value;
/**
* @throws Exception if value is invalid
*/
public function __construct(?float $value)
$this->guard($value);
$this->value = $value;
}
public function equals(FloatValueObjectInterface $other): bool
if (static::class !== get_class($other)) {
return false;
return $this->getValue() === $other->getValue();
public function getValue(): ?float
return $this->value;
abstract protected function guard(?float $value): void;