Skip to content

Commit

Permalink
Fix #89
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroTroller committed Oct 17, 2018
1 parent e35c93a commit f3b399e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ function it_doesnt_support_non_constant_pattern_values()
$this->supports('foo')->shouldReturn(false);
}

function it_doesnt_support_integers()
{
$this->supports(0)->shouldReturn(false);
}

function it_doesnt_support_non_existing_classes()
{
$this->supports('My\Awesome\Non\Existing\Class::CONST')->shouldReturn(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ class ConstantTransformer implements ValueTransformer
*/
public function supports($value): bool
{
if (false === \is_string($value)) {
return false;
}

$matches = [];

if (0 === preg_match($this->pattern, $value, $matches)) {
Expand Down

0 comments on commit f3b399e

Please sign in to comment.