respect-validation/library/Rules/FalseVal.php
Danilo Correa 0be63bd313
Apply contribution guidelines to "FalseVal" rule
Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
2018-10-03 00:04:38 +02:00

35 lines
806 B
PHP

<?php
/*
* This file is part of Respect/Validation.
*
* (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
*
* For the full copyright and license information, please view the "LICENSE.md"
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Rules;
use const FILTER_NULL_ON_FAILURE;
use const FILTER_VALIDATE_BOOLEAN;
use function filter_var;
/**
* Validates if a value is considered as false.
*
* @author Danilo Correa <danilosilva87@gmail.com>
* @author Henrique Moody <henriquemoody@gmail.com>
*/
final class FalseVal extends AbstractRule
{
/**
* {@inheritdoc}
*/
public function validate($input): bool
{
return false === filter_var($input, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
}
}