Webmozart\Assert\Assert::boolean PHP Method

boolean() public static method

public static boolean ( $value, $message = '' )
    public static function boolean($value, $message = '')
    {
        if (!is_bool($value)) {
            static::reportInvalidArgument(sprintf($message ?: 'Expected a boolean. Got: %s', static::typeToString($value)));
        }
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @param string $variableName
  * @param Type $type
  * @param bool $isVariadic
  * @param Description $description
  */
 public function __construct($variableName, Type $type = null, $isVariadic = false, Description $description = null)
 {
     Assert::string($variableName);
     Assert::boolean($isVariadic);
     $this->variableName = $variableName;
     $this->type = $type;
     $this->isVariadic = $isVariadic;
     $this->description = $description;
 }
All Usage Examples Of Webmozart\Assert\Assert::boolean