Skip to content

Commit

Permalink
Assert: added bool()
Browse files Browse the repository at this point in the history
  • Loading branch information
janpecha committed Sep 9, 2017
1 parent 8b225fe commit 0f95a8d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function add($a, $b)
```

* `assert($value, $msg = NULL)` - checks if value is `TRUE`
* `bool($value, $msg = NULL)` - checks if value is `bool`
* `int($value, $msg = NULL)` - checks if value is `int`
* `intOrNull($value, $msg = NULL)` - checks if value is `int|NULL`
* `string($value, $msg = NULL)` - checks if value is `string`
Expand Down
14 changes: 14 additions & 0 deletions src/Assert.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ public static function assert($value, $msg = NULL)
}


/**
* Checks if value is bool
* @param mixed
* @param string|NULL
* @return void
* @throws AssertException
* @tracySkipLocation
*/
public static function bool($value, $msg = NULL)
{
self::assert(is_bool($value), self::message($msg, 'int', $value));
}


/**
* Checks if value is integer
* @param mixed
Expand Down

0 comments on commit 0f95a8d

Please sign in to comment.