Skip to content

Commit

Permalink
Remove named constructor from CompositeException
Browse files Browse the repository at this point in the history
  • Loading branch information
jsor committed Sep 21, 2017
1 parent 07b7afd commit df0976e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
8 changes: 0 additions & 8 deletions src/Exception/CompositeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,4 @@ public function getExceptions()
{
return $this->exceptions;
}

public static function tooManyPromisesRejected(array $reasons)
{
return new self(
$reasons,
'Too many promises rejected.'
);
}
}
5 changes: 4 additions & 1 deletion src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ function some(array $promisesOrValues, $howMany)

if (0 === --$toReject) {
$reject(
CompositeException::tooManyPromisesRejected($reasons)
new CompositeException(
$reasons,
'Too many promises rejected.'
)
);
}
};
Expand Down
5 changes: 3 additions & 2 deletions tests/FunctionAnyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ public function shouldRejectWithAllRejectedInputValuesIfAllInputsAreRejected()
$exception2 = new \Exception();
$exception3 = new \Exception();

$compositeException = CompositeException::tooManyPromisesRejected(
[0 => $exception1, 1 => $exception2, 2 => $exception3]
$compositeException = new CompositeException(
[0 => $exception1, 1 => $exception2, 2 => $exception3],
'Too many promises rejected.'
);

$mock = $this->createCallableMock();
Expand Down
5 changes: 3 additions & 2 deletions tests/FunctionSomeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ public function shouldRejectIfAnyInputPromiseRejectsBeforeDesiredNumberOfInputsA
$exception2 = new \Exception();
$exception3 = new \Exception();

$compositeException = CompositeException::tooManyPromisesRejected(
[1 => $exception2, 2 => $exception3]
$compositeException = new CompositeException(
[1 => $exception2, 2 => $exception3],
'Too many promises rejected.'
);

$mock = $this->createCallableMock();
Expand Down

0 comments on commit df0976e

Please sign in to comment.