Skip to content

Commit f385923

Browse files
committed
fix workflow global middleware
1 parent 80623d8 commit f385923

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/Workflow/GlobalMiddlewareMethodTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
use NeuronAI\Tests\Workflow\Stubs\NodeThree;
1010
use NeuronAI\Tests\Workflow\Stubs\NodeTwo;
1111
use NeuronAI\Workflow\Events\Event;
12+
use NeuronAI\Workflow\NodeInterface;
1213
use NeuronAI\Workflow\Workflow;
14+
use NeuronAI\Workflow\WorkflowState;
1315
use PHPUnit\Framework\TestCase;
1416

1517
class GlobalMiddlewareMethodTest extends TestCase
@@ -218,7 +220,7 @@ protected function globalMiddleware(): array
218220
public function testGlobalMiddlewareOverrideCanReadAndWriteState(): void
219221
{
220222
$middleware = FakeMiddleware::make()
221-
->setBeforeHandler(function ($node, $event, $state): void {
223+
->setBeforeHandler(function (NodeInterface $node, Event $event, WorkflowState $state): void {
222224
$state->set('injected_by_global', true);
223225
$state->set('execution_count', ($state->get('execution_count') ?? 0) + 1);
224226
});
@@ -250,7 +252,7 @@ protected function globalMiddleware(): array
250252
public function testEmptyGlobalMiddlewareOverrideDoesNotCauseErrors(): void
251253
{
252254
// A workflow that explicitly returns empty array should work fine
253-
$workflow = new class extends Workflow {
255+
$workflow = new class () extends Workflow {
254256
protected function nodes(): array
255257
{
256258
return [new NodeOne(), new NodeTwo(), new NodeThree()];

0 commit comments

Comments
 (0)