Skip to content

Commit

Permalink
fix enum rule type checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Gummibeer committed Aug 5, 2019
1 parent 0a94736 commit d2ca2e3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Rules/EnumIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public function passes($attribute, $value): bool
$this->attribute = $attribute;
$this->value = $value;

return $this->enum::isValidIndex($value);
return is_int($value) && $this->enum::isValidIndex($value);
}
}
2 changes: 1 addition & 1 deletion src/Rules/EnumName.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public function passes($attribute, $value): bool
$this->attribute = $attribute;
$this->value = $value;

return $this->enum::isValidName($value);
return is_string($value) && $this->enum::isValidName($value);
}
}
2 changes: 1 addition & 1 deletion src/Rules/EnumValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public function passes($attribute, $value): bool
$this->attribute = $attribute;
$this->value = $value;

return $this->enum::isValidValue($value);
return is_string($value) && $this->enum::isValidValue($value);
}
}

0 comments on commit d2ca2e3

Please sign in to comment.