ScalarVal.php 490 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /*
  3. * Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
  4. * SPDX-License-Identifier: MIT
  5. */
  6. declare(strict_types=1);
  7. namespace Respect\Validation\Rules;
  8. use function is_scalar;
  9. /**
  10. * Validates whether the input is a scalar value or not.
  11. *
  12. * @author Henrique Moody <henriquemoody@gmail.com>
  13. */
  14. final class ScalarVal extends AbstractRule
  15. {
  16. /**
  17. * {@inheritDoc}
  18. */
  19. public function validate($input): bool
  20. {
  21. return is_scalar($input);
  22. }
  23. }