diff --git a/PHPUnit/Framework/Assert.php b/PHPUnit/Framework/Assert.php index db8e7375afc..da489f8cd4b 100644 --- a/PHPUnit/Framework/Assert.php +++ b/PHPUnit/Framework/Assert.php @@ -78,7 +78,7 @@ public static function assertArrayHasKey($key, $array, $message = '') } if (!(is_array($array) || $array instanceof ArrayAccess)) { throw PHPUnit_Util_InvalidArgumentHelper::factory( - 1, 'array or ArrayAccess' + 2, 'array or ArrayAccess' ); } @@ -104,7 +104,7 @@ public static function assertArrayNotHasKey($key, $array, $message = '') } if (!(is_array($array) || $array instanceof ArrayAccess)) { throw PHPUnit_Util_InvalidArgumentHelper::factory( - 1, 'array or ArrayAccess' + 2, 'array or ArrayAccess' ); } @@ -2376,6 +2376,7 @@ public static function isTrue() /** * Returns a PHPUnit_Framework_Constraint_Callback matcher object. * + * @param callable $callback * @return PHPUnit_Framework_Constraint_Callback */ public static function callback($callback) diff --git a/PHPUnit/Framework/Assert/Functions.php b/PHPUnit/Framework/Assert/Functions.php index 057a950175e..2b0e04ca412 100644 --- a/PHPUnit/Framework/Assert/Functions.php +++ b/PHPUnit/Framework/Assert/Functions.php @@ -1699,11 +1699,12 @@ function isTrue() /** * Returns a PHPUnit_Framework_Constraint_Callback matcher object. * + * @param callable $callback * @return PHPUnit_Framework_Constraint_Callback */ -function callback() +function callback($callback) { - return PHPUnit_Framework_Assert::callback(); + return PHPUnit_Framework_Assert::callback($callback); } /** diff --git a/PHPUnit/Framework/Constraint/Callback.php b/PHPUnit/Framework/Constraint/Callback.php index 7a3340dcf7a..dbc33ceb90b 100644 --- a/PHPUnit/Framework/Constraint/Callback.php +++ b/PHPUnit/Framework/Constraint/Callback.php @@ -58,7 +58,7 @@ class PHPUnit_Framework_Constraint_Callback extends PHPUnit_Framework_Constraint private $callback; /** - * @param callable $value + * @param callable $callback * @throws InvalidArgumentException */ public function __construct($callback) diff --git a/PHPUnit/Framework/Constraint/JsonMatches.php b/PHPUnit/Framework/Constraint/JsonMatches.php index 01bb70b8e8d..de3ed61c174 100644 --- a/PHPUnit/Framework/Constraint/JsonMatches.php +++ b/PHPUnit/Framework/Constraint/JsonMatches.php @@ -83,13 +83,13 @@ public function __construct($value) protected function matches($other) { $decodedOther = json_decode($other); - if (!is_object($decodedOther)) { + if (json_last_error()) { $this->failure_reason = $this->getJsonError(); return FALSE; } $decodedValue = json_decode($this->value); - if (!is_object($decodedValue)) { + if (json_last_error()) { $this->failure_reason = $this->getJsonError(); return FALSE; } @@ -123,4 +123,4 @@ public function toString() $this->value ); } -} \ No newline at end of file +}