public function castBoolean()
{
if (is_bool($this->value)) {
return $this->value;
}
foreach ($this->trueValues as $true) {
if ($this->value === $true) {
return true;
}
}
foreach ($this->falseValues as $false) {
if ($this->value === $false) {
return false;
}
}
$castFunction = function ($value) {
return (bool) $value;
};
return $this->handleMismatch($castFunction, 'boolean');
}