NumericVal.php 586 B

123456789101112131415161718192021222324252627282930
  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_numeric;
  9. /**
  10. * Validates whether the input is numeric.
  11. *
  12. * @author Alexandre Gomes Gaigalas <alganet@gmail.com>
  13. * @author Danilo Correa <danilosilva87@gmail.com>
  14. * @author Henrique Moody <henriquemoody@gmail.com>
  15. */
  16. final class NumericVal extends AbstractRule
  17. {
  18. /**
  19. * {@inheritDoc}
  20. */
  21. public function validate($input): bool
  22. {
  23. return is_numeric($input);
  24. }
  25. }