Assert\Assertion::integer PHP Метод

integer() публичный статический Метод

Assert that value is a php integer.
public static integer ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
Результат boolean
    public static function integer($value, $message = null, $propertyPath = null)
    {
        if (!is_int($value)) {
            $message = sprintf($message ?: 'Value "%s" is not an integer.', static::stringify($value));
            throw static::createException($value, $message, static::INVALID_INTEGER, $propertyPath);
        }
        return true;
    }

Usage Example

Пример #1
0
 /**
  * @param int $x
  * @param int $y
  */
 public function __construct($x, $y)
 {
     Assertion::integer($x);
     Assertion::integer($y);
     $this->x = $x;
     $this->y = $y;
 }
All Usage Examples Of Assert\Assertion::integer