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

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

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

Usage Example

 /**
  * RedirectUriParameterChecker constructor.
  *
  * @param bool $secured_redirect_uri_enforced
  * @param bool $redirect_uri_storage_enforced
  */
 public function __construct($secured_redirect_uri_enforced, $redirect_uri_storage_enforced)
 {
     Assertion::boolean($secured_redirect_uri_enforced);
     Assertion::boolean($redirect_uri_storage_enforced);
     $this->secured_redirect_uri_enforced = $secured_redirect_uri_enforced;
     $this->redirect_uri_storage_enforced = $redirect_uri_storage_enforced;
 }
All Usage Examples Of Assert\Assertion::boolean