Skip to content

Commit

Permalink
developer commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzadamodassir committed Nov 14, 2024
1 parent 21c7ce0 commit ac21d12
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Shahzada Modassir <[email protected]>
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Release Notes

## [Unreleased](https://github.com/lazervel/promise/compare/v3.0.0...v3.0.1) - 11 November 2024

- Fixed bugs in `Promise` that caused [e.g., incorrect output, duplicate combination, etc.].
22 changes: 14 additions & 8 deletions src/Executor.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ class Executor
*/
protected $state = 'pending';

/**
* Actual callbacks Resolve, Reject and Finally store in queue
*
* @var array
*/
protected $queue = [];

/**
* Flag to know if executor handler was already fired
*
Expand Down Expand Up @@ -85,12 +92,6 @@ class Executor
*/
private $rejected = false;

/**
*
* @var array
*/
protected $queue = [];

/**
* Creates a new Executor instance.
* Initializes a new instance of Executor with the given $executor.
Expand All @@ -111,6 +112,11 @@ public function __construct(callable $executor)
*/
protected function finalExecutorExecute() : void
{
if (!$this->catched && $this->rejected) {
$this->execute();
return;
}

try {
ErrorHandler::PHP_ErrorHandlerActivate();
$this->execute();
Expand Down Expand Up @@ -140,12 +146,12 @@ private function resolve($value = null) : void
*/
private function reject($value = null) : void
{
$this->rejected = true;
if (!$this->locked) $this->rejected = true;
$this->fireWith($value, 'rejected');
}

/**
*
* Returns a forced static function Handler Resolve or Reject
*
* @param string $handler [required]
* @return static Returns resolve or reject Handler.
Expand Down
7 changes: 7 additions & 0 deletions tests/Promise.Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

use Modassir\Promise\Promise;

require __DIR__.'/../vendor/autoload.php';

?>

0 comments on commit ac21d12

Please sign in to comment.