Skip to content

Commit

Permalink
testing type before triggering match. switching match return value to…
Browse files Browse the repository at this point in the history
… more compact style
  • Loading branch information
fentie committed May 31, 2012
1 parent 33ced98 commit 24e4d74
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions PHPUnit/Extensions/Constraint/ArrayHasKeyValuePair.php
Expand Up @@ -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));
}

/**
Expand Down

0 comments on commit 24e4d74

Please sign in to comment.