Skip to content

Commit

Permalink
remove support for global middlewares
Browse files Browse the repository at this point in the history
  • Loading branch information
wol-soft committed Sep 6, 2021
1 parent 23e0322 commit 75051b9
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/Workflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,9 @@ class Workflow extends Stage
AllowNextBefore,
AllowNextProcess;

private static array $globalMiddleware = [];
private string $name;
private array $middleware;

public static function addGlobalMiddleware(callable $middleware): void
{
self::$globalMiddleware[] = $middleware;
}

public function __construct(string $name, callable ...$middlewares)
{
parent::__construct($this);
Expand All @@ -39,7 +33,7 @@ public function __construct(string $name, callable ...$middlewares)
protected function runStage(WorkflowState $workflowState): ?Stage
{
$workflowState->setWorkflowName($this->name);
$workflowState->setMiddlewares([...self::$globalMiddleware, ...$this->middleware]);
$workflowState->setMiddlewares($this->middleware);

$nextStage = $this->nextStage;
while ($nextStage) {
Expand Down

0 comments on commit 75051b9

Please sign in to comment.