Skip to content

Commit

Permalink
Allow for subclasses when typechecking arrays.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Baker committed May 12, 2016
1 parent a2f0cd5 commit c2a10a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion assert.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class Assert {
public static function type(array $a, $class) {
foreach ($a as $item) {
if (get_class($item) !== $class) {
if (get_class($item) !== $class && !is_subclass_of($item, $class)) {
throw new TypeException("$item is not of type $class");
}
}
Expand Down

0 comments on commit c2a10a8

Please sign in to comment.