Skip to content

Commit

Permalink
refactor(core): improvements on AbstractFiberHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
Guikingone committed May 4, 2022
1 parent 335bacd commit 406201a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Fiber/AbstractFiberHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@
namespace SchedulerBundle\Fiber;

use Closure;
use DateTimeZone;
use Fiber;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use SchedulerBundle\Pool\Configuration\SchedulerConfiguration;
use SchedulerBundle\Task\LazyTask;
use SchedulerBundle\Task\LazyTaskList;
use SchedulerBundle\Task\TaskInterface;
use SchedulerBundle\Task\TaskListInterface;
use SchedulerBundle\Transport\Configuration\ConfigurationInterface;
use Throwable;
use function sprintf;

Expand All @@ -23,7 +30,7 @@ public function __construct(?LoggerInterface $logger = null)
$this->logger = $logger ?? new NullLogger();
}

protected function handleOperationViaFiber(Closure $func): mixed
protected function handleOperationViaFiber(Closure $func): TaskListInterface|LazyTaskList|TaskInterface|LazyTask|SchedulerConfiguration|ConfigurationInterface|DateTimeZone|string|float|int|bool|array|null
{
$fiber = new Fiber(callback: function (Closure $operation): void {
$value = $operation();
Expand Down
1 change: 1 addition & 0 deletions tests/Task/Builder/ChainedBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public function testBuilderCanBuild(array $configuration): void

self::assertInstanceOf(ChainedTask::class, $task);
self::assertCount(3, $task->getTasks());
self::assertIsArray($configuration['tasks']);
self::assertInstanceOf(ShellTask::class, $task->getTask($configuration['tasks'][0]['name']));
self::assertSame('foo', $task->getTask($configuration['tasks'][0]['name'])->getName());
self::assertInstanceOf(NullTask::class, $task->getTask($configuration['tasks'][1]['name']));
Expand Down

0 comments on commit 406201a

Please sign in to comment.