for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Equip\ValueObject;
use function Assert\that;
class Boolean
{
/**
* @var bool|null
*/
private $value;
* @param string|boolean|null $value
* @param string|boolean|null $default
public function __construct($value, $default = null)
if ($value === null) {
$value = $default;
}
that($value)->nullOr()->scalar();
$options = [
'flags' => \FILTER_NULL_ON_FAILURE,
];
$value = filter_var($value, \FILTER_VALIDATE_BOOLEAN, $options);
that($value)->boolean();
$this->value = $value;
* @return boolean
boolean|null
This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.
@return
public function value()
return $this->value;
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.