From 3182d12b55895a2e71ed6684f9bd5cd13527e94e Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 14 Dec 2022 21:50:11 +0100 Subject: [PATCH] Fix attrGroups/attributes confusion in EnumCase builder Found by staabm in #907. (cherry picked from commit 21a3e8cac52b1d3d0ea0e91c34d112cf53716732) --- lib/PhpParser/Builder/EnumCase.php | 4 ++-- test/PhpParser/Builder/EnumCaseTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/PhpParser/Builder/EnumCase.php b/lib/PhpParser/Builder/EnumCase.php index 02fa83e624..accc5166b1 100644 --- a/lib/PhpParser/Builder/EnumCase.php +++ b/lib/PhpParser/Builder/EnumCase.php @@ -78,8 +78,8 @@ public function getNode(): PhpParser\Node { return new Stmt\EnumCase( $this->name, $this->value, - $this->attributes, - $this->attributeGroups + $this->attributeGroups, + $this->attributes ); } } diff --git a/test/PhpParser/Builder/EnumCaseTest.php b/test/PhpParser/Builder/EnumCaseTest.php index d88343cb77..1a67c56088 100644 --- a/test/PhpParser/Builder/EnumCaseTest.php +++ b/test/PhpParser/Builder/EnumCaseTest.php @@ -27,6 +27,7 @@ public function testDocComment() { new Stmt\EnumCase( "TEST", null, + [], [ 'comments' => [new Comment\Doc('/** Test */')] ] @@ -50,7 +51,6 @@ public function testAddAttribute() { new Stmt\EnumCase( "ATTR_GROUP", null, - [], [$attributeGroup] ), $node