Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions packages/core/actions/config/update-workflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@
// Create a virtual file holing the default structure with the parsed code and generate a minimal AST
$ast_temp = $parser->parse("<?php \nclass temp { public static function getWorkflow() {return ".$code_string.";}}");
// Find the getWorkflow node in the AST of the temporary file
$nodeGetWorkflow = $nodeFinder->findFirst($ast_temp, function(Node $node) {return $node->name->name === "getWorkflow";});
$nodeGetWorkflow = $nodeFinder->findFirst(
$ast_temp,
function(Node $node) {
return isset($node->name->name)
&& $node->name->name === "getWorkflow";
}
);

// Add a visitor hijack the getWorkflow method and update its content with new schema
$traverser->addVisitor(
Expand All @@ -71,9 +77,14 @@ public function __construct($node, $target) {
$this->target = $target;
}
public function leaveNode(Node $node) {
if ($node->name->name === $this->target) {
if (
isset($node->name->name)
&& $node->name->name === $this->target
) {
return $this->node;
}

return null;
}
}
);
Expand Down