From 2e3c4f29c00f75feb8a7ae2a396df4b8b5ff02bd Mon Sep 17 00:00:00 2001 From: Lucas Laurent Date: Fri, 26 Jan 2024 11:20:10 +0100 Subject: [PATCH] fix: trying to get name of non object warning when update workflow --- packages/core/actions/config/update-workflow.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/core/actions/config/update-workflow.php b/packages/core/actions/config/update-workflow.php index a7620c52d..82dec5fa3 100644 --- a/packages/core/actions/config/update-workflow.php +++ b/packages/core/actions/config/update-workflow.php @@ -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("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( @@ -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; } } );