Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
VennDev committed Jul 11, 2023
1 parent 1a66048 commit c353567
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
9 changes: 8 additions & 1 deletion src/vennv/vapm/Async.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public function getId(): int
*/
public static function await(Promise|Async|callable $await): mixed
{
$result = null;

if (is_callable($await))
{
$await = new Async($await);
Expand All @@ -65,7 +67,12 @@ public static function await(Promise|Async|callable $await): mixed
FiberManager::wait();
}

return $return->getResult();
if ($return instanceof Promise)
{
$result = $return->getResult();
}

return $result;
}

}
2 changes: 0 additions & 2 deletions src/vennv/vapm/EventLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public static function getQueue(int $id): ?Promise

/**
* @return array<int, Promise>
* @phpstan-param array<int, Promise> $queues
*/
public static function getQueues(): array
{
Expand Down Expand Up @@ -104,7 +103,6 @@ public static function getReturn(int $id): ?Promise

/**
* @return array<int, Promise>
* @phpstan-param array<int, Promise> $queues
*/
public static function getReturns(): array
{
Expand Down
2 changes: 0 additions & 2 deletions src/vennv/vapm/EventLoopInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public static function getQueue(int $id): ?Promise;

/**
* @return array<int, Promise>
* @phpstan-param array<int, Promise> $queues
*/
public static function getQueues(): array;

Expand All @@ -51,7 +50,6 @@ public static function getReturn(int $id): ?Promise;

/**
* @return array<int, Promise>
* @phpstan-param array<int, Promise> $queues
*/
public static function getReturns(): array;

Expand Down
1 change: 0 additions & 1 deletion src/vennv/vapm/MacroTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public static function getTask(int $id): ?SampleMacro

/**
* @return array<int, SampleMacro>
* @phpstan-param array<int, SampleMacro> $tasks
*/
public static function getTasks(): array
{
Expand Down
3 changes: 3 additions & 0 deletions src/vennv/vapm/MicroTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public static function getTask(int $id): ?Promise
return self::$tasks[$id] ?? null;
}

/**
* @return array<int, Promise>
*/
public static function getTasks(): array
{
return self::$tasks;
Expand Down

0 comments on commit c353567

Please sign in to comment.