From dc6cda85d5712a45899b4c2778bc3f6851b8b0c8 Mon Sep 17 00:00:00 2001 From: Daniel Scherzer Date: Wed, 20 Aug 2025 11:17:36 -0700 Subject: [PATCH 1/2] Extractor: Account for function attribute changes --- extractor/extract.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/extractor/extract.php b/extractor/extract.php index 7d1a6031..6732187a 100755 --- a/extractor/extract.php +++ b/extractor/extract.php @@ -551,6 +551,44 @@ private function compareFunctions(Node\FunctionLike $old, Node\FunctionLike $new if (count($old->getParams()) !== count($new->getParams())) { return $this->stmtDiff($old, $new, $updateTo); } + $oldAttribGroups = $old->getAttrGroups(); + $newAttribGroups = $new->getAttrGroups(); + if (count($oldAttribGroups) !== count($newAttribGroups)) { + return $this->stmtDiff($old, $new, $updateTo); + } + foreach ($oldAttribGroups as $groupN => $oldGroups) { + $oldAttribs = $oldGroup->attrs; + $newAttribs = $newAttribGroups[$groupN]->attrs; + if (count($oldAttribs) !== count($newAttribs)) { + return $this->stmtDiff($old, $new, $updateTo); + } + foreach ($oldAttribs as $attribIdx => $oldAttrib) { + $newAttrib = $newAttribs[$attribIdx]; + if ($oldAttrib->name->name !== $newAttrib->name->name) { + return $this->stmtDiff($old, $new, $updateTo); + } + $oldArgs = $oldAttrib->args; + $newArgs = $newAttrib->args; + if (count($oldArgs) !== count($newArgs)) { + return $this->stmtDiff($old, $new, $updateTo); + } + foreach ($oldArgs as $argIdx => $oldArg) { + $newArg = $newArgs[$argIdx]; + if ($oldArg->name !== null && $newArg->name !== null) { + if ($oldArg->name->name !== $newArg->name->name) { + return $this->stmtDiff($old, $new, $updateTo); + } + } elseif ($oldArg->name !== null || $newArg->name !== null) { + return $this->stmtDiff($old, $new, $updateTo); + } + $oldArgValue = $this->printer->prettyPrintExpr($oldArg->expr); + $newArgValue = $this->printer->prettyPrintExpr($newArg->expr); + if ($oldArgValue !== $newArgValue) { + return $this->stmtDiff($old, $new, $updateTo); + } + } + } + } foreach ($old->getParams() as $i => $oldParam) { $newParam = $new->getParams()[$i]; From 78be3c131e8e037db1f5614a5fe50c039d7c72ad Mon Sep 17 00:00:00 2001 From: Daniel Scherzer Date: Wed, 20 Aug 2025 11:38:33 -0700 Subject: [PATCH 2/2] Extractor: Fix a typo in variable name --- extractor/extract.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extractor/extract.php b/extractor/extract.php index 6732187a..9e82073a 100755 --- a/extractor/extract.php +++ b/extractor/extract.php @@ -556,7 +556,7 @@ private function compareFunctions(Node\FunctionLike $old, Node\FunctionLike $new if (count($oldAttribGroups) !== count($newAttribGroups)) { return $this->stmtDiff($old, $new, $updateTo); } - foreach ($oldAttribGroups as $groupN => $oldGroups) { + foreach ($oldAttribGroups as $groupN => $oldGroup) { $oldAttribs = $oldGroup->attrs; $newAttribs = $newAttribGroups[$groupN]->attrs; if (count($oldAttribs) !== count($newAttribs)) {