Skip to content

Commit

Permalink
test: reduce computational complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
g105b committed Jun 29, 2023
1 parent 5ca1b27 commit c6c062a
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/Promise.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,6 @@ private function tryComplete():void {
}

private function complete():void {
$this->sortChain();
$this->handleChain();
$this->completed = true;
}

private function sortChain():void {
usort(
$this->chain,
function(Chainable $a, Chainable $b) {
Expand All @@ -151,9 +145,6 @@ function(Chainable $a, Chainable $b) {
return 0;
}
);
}

private function handleChain():void {
$handledRejections = [];

$emptyChain = empty($this->chain);
Expand All @@ -178,6 +169,8 @@ private function handleChain():void {
}

$this->handleCatches($originalChain, $emptyChain, $handledRejections);

$this->completed = true;
}

private function getNextChainItem():?Chainable {
Expand Down

0 comments on commit c6c062a

Please sign in to comment.