Skip to content

Commit

Permalink
Tweak TypeError helper method names
Browse files Browse the repository at this point in the history
  • Loading branch information
jsor committed Feb 28, 2018
1 parent 41f7c09 commit 18b7514
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/Promise.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/TypeError.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,7 +32,7 @@ public static function messageForTypeHintedArgument(
);
}

public static function messageForClassTypeHintedArgument(
public static function messageForIncorrectArgumentClassType(
$message,
$method,
$arg
Expand Down

0 comments on commit 18b7514

Please sign in to comment.