diff --git a/src/Promise.php b/src/Promise.php index 8681123..8b32408 100644 --- a/src/Promise.php +++ b/src/Promise.php @@ -65,7 +65,7 @@ public function __construct($resolver = null, $canceller = null) { if (null !== $resolver && !\is_callable($resolver)) { throw new TypeError( - TypeError::messageForTypeHintedArgument( + TypeError::messageForIncorrectArgumentType( 'Argument 1 passed to Pact\Promise::__construct() must be callable or null', __METHOD__, $resolver @@ -75,7 +75,7 @@ public function __construct($resolver = null, $canceller = null) if (null !== $canceller && !\is_callable($canceller)) { throw new TypeError( - TypeError::messageForTypeHintedArgument( + TypeError::messageForIncorrectArgumentType( 'Argument 2 passed to Pact\Promise::__construct() must be callable or null', __METHOD__, $canceller @@ -115,7 +115,7 @@ public static function reject($reason) if (\PHP_VERSION_ID >= 50408) { \assert( $assertion = \PHP_VERSION_ID >= 70000 ? $reason instanceof \Throwable : $reason instanceof \Exception, - $assertion ? null : (($desc = TypeError::messageForClassTypeHintedArgument( + $assertion ? null : (($desc = TypeError::messageForIncorrectArgumentClassType( \PHP_VERSION_ID >= 70000 ? 'Argument 1 passed to Pact\Promise::reject() must implement interface Throwable' : 'Argument 1 passed to Pact\Promise::reject() must be an instance of Exception', @@ -156,7 +156,7 @@ public function then($onFulfilled = null, $onRejected = null) if (\PHP_VERSION_ID >= 50408) { \assert( $assertion = (null === $onFulfilled || \is_callable($onFulfilled)), - $assertion ? null : (($desc = TypeError::messageForTypeHintedArgument( + $assertion ? null : (($desc = TypeError::messageForIncorrectArgumentType( 'Argument 1 passed to Pact\Promise::then() must be callable or null', __METHOD__, $onFulfilled @@ -171,7 +171,7 @@ public function then($onFulfilled = null, $onRejected = null) if (\PHP_VERSION_ID >= 50408) { \assert( $assertion = (null === $onRejected || \is_callable($onRejected)), - $assertion ? null : (($desc = TypeError::messageForTypeHintedArgument( + $assertion ? null : (($desc = TypeError::messageForIncorrectArgumentType( 'Argument 2 passed to Pact\Promise::then() must be callable or null', __METHOD__, $onRejected @@ -202,7 +202,7 @@ public function always($onSettled) if (\PHP_VERSION_ID >= 50408) { \assert( $assertion = \is_callable($onSettled), - $assertion ? null : (($desc = TypeError::messageForTypeHintedArgument( + $assertion ? null : (($desc = TypeError::messageForIncorrectArgumentType( 'Argument 1 passed to Pact\Promise::always() must be callable', __METHOD__, $onSettled diff --git a/src/TypeError.php b/src/TypeError.php index 660bc86..4fc97d0 100644 --- a/src/TypeError.php +++ b/src/TypeError.php @@ -20,7 +20,7 @@ class TypeError extends Error namespace Pact { final class TypeError extends \TypeError implements PactThrowable { - public static function messageForTypeHintedArgument( + public static function messageForIncorrectArgumentType( $message, $method, $arg @@ -32,7 +32,7 @@ public static function messageForTypeHintedArgument( ); } - public static function messageForClassTypeHintedArgument( + public static function messageForIncorrectArgumentClassType( $message, $method, $arg