Skip to content

Commit a558cb0

Browse files
committed
Add support for official action syntax and enhance class step field compatibility
1 parent 5584cbe commit a558cb0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Support/FlowBuilder.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public function buildStep(array $stepDefinition): mixed
5757
'conditional' => $this->buildConditionalStep($stepDefinition),
5858
'class' => $this->buildClassStep($stepDefinition),
5959
'step' => $this->buildClassStep($stepDefinition),
60+
'action' => $this->buildClassStep($stepDefinition), // Support for official action syntax
6061
'group' => $this->buildGroupStep($stepDefinition),
6162
'nested' => $this->buildNestedStep($stepDefinition),
6263
default => throw new RuntimeException("Unknown step type: {$type}")
@@ -213,10 +214,14 @@ private function buildNestedStep(array $stepDefinition): \Grazulex\LaravelFlowpi
213214

214215
private function buildClassStep(array $stepDefinition): string
215216
{
216-
$class = $stepDefinition['class'] ?? $stepDefinition['step'] ?? null;
217+
// Try to get class name from multiple possible fields (maintain compatibility)
218+
$class = $stepDefinition['class']
219+
?? $stepDefinition['step']
220+
?? $stepDefinition['name']
221+
?? null;
217222

218223
if (! $class) {
219-
throw new RuntimeException('Class step must have a "class" or "step" field');
224+
throw new RuntimeException('Class step must have a "class", "step", or "name" field');
220225
}
221226

222227
return $this->buildStepFromClass($class);

0 commit comments

Comments
 (0)