respect-validation/library/Rules/ScalarVal.php

29 lines
490 B
PHP
Raw Normal View History

2015-08-20 06:02:11 +02:00
<?php
/*
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
* SPDX-License-Identifier: MIT
2015-08-20 06:02:11 +02:00
*/
declare(strict_types=1);
2015-08-20 06:02:11 +02:00
namespace Respect\Validation\Rules;
use function is_scalar;
2015-08-20 06:02:11 +02:00
/**
* Validates whether the input is a scalar value or not.
*
2015-08-20 06:02:11 +02:00
* @author Henrique Moody <henriquemoody@gmail.com>
*/
final class ScalarVal extends AbstractRule
2015-08-20 06:02:11 +02:00
{
/**
* {@inheritDoc}
2015-08-20 06:02:11 +02:00
*/
public function validate($input): bool
2015-08-20 06:02:11 +02:00
{
return is_scalar($input);
}
}