Browse files

testing type before triggering match. switching match return value to…

… more compact style
  • Loading branch information...
1 parent 33ced98 commit 24e4d745c1fec31587b36463ab2a046b0a42a8b9 @fentie fentie committed May 31, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 PHPUnit/Extensions/Constraint/ArrayHasKeyValuePair.php
View
6 PHPUnit/Extensions/Constraint/ArrayHasKeyValuePair.php
@@ -34,10 +34,10 @@ public function __construct($key, $value)
*/
protected function matches($other)
{
- if (array_key_exists($this->key, $other) && $other[$this->key] === $this->value) {
- return true;
+ if (!(is_array($other) || $other instanceof ArrayAccess)) {
+ return false;
}
- return false;
+ return (array_key_exists($this->key, $other) && ($other[$this->key] === $this->value));
}
/**

0 comments on commit 24e4d74

Please sign in to comment.