Skip to content

Commit df0976e

Browse files
committed
Remove named constructor from CompositeException
1 parent 07b7afd commit df0976e

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

src/Exception/CompositeException.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,4 @@ public function getExceptions()
2727
{
2828
return $this->exceptions;
2929
}
30-
31-
public static function tooManyPromisesRejected(array $reasons)
32-
{
33-
return new self(
34-
$reasons,
35-
'Too many promises rejected.'
36-
);
37-
}
3830
}

src/functions.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ function some(array $promisesOrValues, $howMany)
115115

116116
if (0 === --$toReject) {
117117
$reject(
118-
CompositeException::tooManyPromisesRejected($reasons)
118+
new CompositeException(
119+
$reasons,
120+
'Too many promises rejected.'
121+
)
119122
);
120123
}
121124
};

tests/FunctionAnyTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ public function shouldRejectWithAllRejectedInputValuesIfAllInputsAreRejected()
5858
$exception2 = new \Exception();
5959
$exception3 = new \Exception();
6060

61-
$compositeException = CompositeException::tooManyPromisesRejected(
62-
[0 => $exception1, 1 => $exception2, 2 => $exception3]
61+
$compositeException = new CompositeException(
62+
[0 => $exception1, 1 => $exception2, 2 => $exception3],
63+
'Too many promises rejected.'
6364
);
6465

6566
$mock = $this->createCallableMock();

tests/FunctionSomeTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ public function shouldRejectIfAnyInputPromiseRejectsBeforeDesiredNumberOfInputsA
101101
$exception2 = new \Exception();
102102
$exception3 = new \Exception();
103103

104-
$compositeException = CompositeException::tooManyPromisesRejected(
105-
[1 => $exception2, 2 => $exception3]
104+
$compositeException = new CompositeException(
105+
[1 => $exception2, 2 => $exception3],
106+
'Too many promises rejected.'
106107
);
107108

108109
$mock = $this->createCallableMock();

0 commit comments

Comments
 (0)