1
0
mirror of https://github.com/danog/amp.git synced 2024-11-30 04:29:08 +01:00

Replace BaseException refs with Throwable

This commit is contained in:
Daniel Lowrey 2015-07-07 10:15:57 -04:00
parent ad96a584d5
commit 4d4e9bad32
5 changed files with 10 additions and 10 deletions

View File

@ -11,11 +11,11 @@ class Failure implements Promise {
/**
* The error parameter used to fail a promisor must always be an exception
* instance. However, we cannot typehint this parameter in environments
* where PHP5.x compatibility is required because PHP7 BaseException
* where PHP5.x compatibility is required because PHP7 Throwable
* instances will break the typehint.
*/
public function __construct($error) {
if (!($error instanceof \Exception || $error instanceof \BaseException)) {
if (!($error instanceof \Exception || $error instanceof \Throwable)) {
throw new \InvalidArgumentException(
"Only exceptions may be used to fail a promise"
);

View File

@ -65,7 +65,7 @@ trait Placeholder {
/**
* The error parameter used to fail a promisor must always be an exception
* instance. However, we cannot typehint this parameter in environments
* where PHP5.x compatibility is required because PHP7 BaseException
* where PHP5.x compatibility is required because PHP7 Throwable
* instances will break the typehint.
*/
private function resolve($error = null, $result = null) {
@ -81,7 +81,7 @@ trait Placeholder {
$result->when(function($error, $result) {
$this->resolve($error, $result);
});
} elseif (isset($error) && !($error instanceof \Exception || $error instanceof \BaseException)) {
} elseif (isset($error) && !($error instanceof \Exception || $error instanceof \Throwable)) {
throw new \InvalidArgumentException(
"Only exceptions may be used to fail a promise"
);

View File

@ -61,10 +61,10 @@ trait PrivatePromisor {
*
* The error parameter used to fail a promisor must always be an exception
* instance. However, we cannot typehint this parameter in environments
* where PHP5.x compatibility is required because PHP7 BaseException
* where PHP5.x compatibility is required because PHP7 Throwable
* instances will break the typehint.
*
* @param mixed $error An Exception or BaseException in PHP7 environments
* @param mixed $error An Exception or Throwable in PHP7 environments
* @return void
*/
public function fail($error) {

View File

@ -62,10 +62,10 @@ interface Promisor {
*
* The error parameter used to fail a promisor must always be an exception
* instance. However, we cannot typehint this parameter in environments
* where PHP5.x compatibility is required because PHP7 BaseException
* where PHP5.x compatibility is required because PHP7 Throwable
* instances will break the typehint.
*
* @param mixed $error An Exception or BaseException in PHP7 environments
* @param mixed $error An Exception or Throwable in PHP7 environments
* @return void
*/
public function fail($error);

View File

@ -53,10 +53,10 @@ trait PublicPromisor {
*
* The error parameter used to fail a promisor must always be an exception
* instance. However, we cannot typehint this parameter in environments
* where PHP5.x compatibility is required because PHP7 BaseException
* where PHP5.x compatibility is required because PHP7 Throwable
* instances will break the typehint.
*
* @param mixed $error An Exception or BaseException in PHP7 environments
* @param mixed $error An Exception or Throwable in PHP7 environments
* @return void
*/
public function fail($error) {