Skip to content

Commit 3fcfd66

Browse files
author
Norbert Orzechowicz
committed
Merge pull request #50 from pskt/callback-matcher-on-function-names
CallbackMatcher should not be executed for internal function names
2 parents 272f536 + 1e21f66 commit 3fcfd66

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Coduo/PHPMatcher/Matcher/CallbackMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ public function match($value, $pattern)
1717
*/
1818
public function canMatch($pattern)
1919
{
20-
return is_callable($pattern);
20+
return is_object($pattern) && is_callable($pattern);
2121
}
2222
}

tests/Coduo/PHPMatcher/Matcher/CallbackMatcherTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ function test_negative_can_match()
1515
{
1616
$matcher = new CallbackMatcher();
1717
$this->assertFalse($matcher->canMatch(new \DateTime()));
18+
$this->assertFalse($matcher->canMatch('SIN'));
1819
}
1920

2021
function test_positive_matches()

0 commit comments

Comments
 (0)