Skip to content

Commit

Permalink
CallbackMatcher should not be executed for internal function names
Browse files Browse the repository at this point in the history
  • Loading branch information
pskt committed Feb 5, 2015
1 parent 272f536 commit 1e21f66
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Coduo/PHPMatcher/Matcher/CallbackMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ public function match($value, $pattern)
*/
public function canMatch($pattern)
{
return is_callable($pattern);
return is_object($pattern) && is_callable($pattern);
}
}
1 change: 1 addition & 0 deletions tests/Coduo/PHPMatcher/Matcher/CallbackMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function test_negative_can_match()
{
$matcher = new CallbackMatcher();
$this->assertFalse($matcher->canMatch(new \DateTime()));
$this->assertFalse($matcher->canMatch('SIN'));
}

function test_positive_matches()
Expand Down

0 comments on commit 1e21f66

Please sign in to comment.