respect-validation/library/Rules/CallableType.php

29 lines
503 B
PHP
Raw Normal View History

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