From f05acacd75618b66626559056c419bdc11184854 Mon Sep 17 00:00:00 2001 From: Sergey Romankov Date: Tue, 24 Oct 2023 15:48:46 +0300 Subject: [PATCH 1/5] SDK-2585 update wire plugin logic --- src/Builder/Visitor/AddPluginToPluginListVisitor.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Builder/Visitor/AddPluginToPluginListVisitor.php b/src/Builder/Visitor/AddPluginToPluginListVisitor.php index 84c48370..b3f566af 100644 --- a/src/Builder/Visitor/AddPluginToPluginListVisitor.php +++ b/src/Builder/Visitor/AddPluginToPluginListVisitor.php @@ -211,7 +211,9 @@ protected function addNewPluginWithConditionIntoList(ClassMethod $node): Node $newStmts[] = $this->createNewConditionStatement($returnStmt->expr); } if ($returnStmt->expr instanceof FuncCall || $returnStmt->expr instanceof Array_) { - $newStmts[] = $this->createAssignEmptyArray(static::PLUGINS_VARIBLE); + $initialArray = $returnStmt->expr instanceof Array_ ? $returnStmt->expr : null; + + $newStmts[] = $this->createAssignArray(static::PLUGINS_VARIBLE, $initialArray); $newStmts[] = $this->createNewConditionStatement((new BuilderFactory())->var(static::PLUGINS_VARIBLE)); $returnStmt->expr = (new BuilderFactory())->var(static::PLUGINS_VARIBLE); } @@ -223,15 +225,16 @@ protected function addNewPluginWithConditionIntoList(ClassMethod $node): Node /** * @param string $varName + * @param \PhpParser\Node\Expr\Array_|null $initialArray * * @return \PhpParser\Node\Stmt\Expression */ - protected function createAssignEmptyArray(string $varName): Expression + protected function createAssignArray(string $varName, ?Array_ $initialArray = null): Expression { return new Expression( new Assign( (new BuilderFactory())->var($varName), - new Array_(), + $initialArray ?? new Array_(), ), ); } From 06fce2be773c614c6e757ea634e3b5539bce538a Mon Sep 17 00:00:00 2001 From: Sergey Romankov Date: Tue, 24 Oct 2023 15:51:24 +0300 Subject: [PATCH 2/5] SDK-2585 update data provider --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index c8b80147..3b77e31e 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "ext-zip": "*", "phpstan/phpstan": "^1.0.0", "phpunit/phpunit": "^9.5.0", - "spryker-sdk/manifest-test-data-provider": "dev-master", + "spryker-sdk/manifest-test-data-provider": "dev-feature/sdk-2855-add-missed-plugin-classes", "spryker/code-sniffer": "dev-master", "symfony/filesystem": "^5.3.0 || ^6.0" }, From 494d26bc211b02c7f6ed1b3c2d9277b2a75a6d42 Mon Sep 17 00:00:00 2001 From: Sergey Romankov Date: Tue, 24 Oct 2023 17:33:12 +0300 Subject: [PATCH 3/5] SDK-2585 update visitor --- src/Builder/Visitor/AddPluginToPluginListVisitor.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Builder/Visitor/AddPluginToPluginListVisitor.php b/src/Builder/Visitor/AddPluginToPluginListVisitor.php index b3f566af..ef1090c1 100644 --- a/src/Builder/Visitor/AddPluginToPluginListVisitor.php +++ b/src/Builder/Visitor/AddPluginToPluginListVisitor.php @@ -211,9 +211,10 @@ protected function addNewPluginWithConditionIntoList(ClassMethod $node): Node $newStmts[] = $this->createNewConditionStatement($returnStmt->expr); } if ($returnStmt->expr instanceof FuncCall || $returnStmt->expr instanceof Array_) { - $initialArray = $returnStmt->expr instanceof Array_ ? $returnStmt->expr : null; - - $newStmts[] = $this->createAssignArray(static::PLUGINS_VARIBLE, $initialArray); + $newStmts[] = $this->createAssignArray( + static::PLUGINS_VARIBLE, + $returnStmt->expr instanceof Array_ ? $returnStmt->expr : null + ); $newStmts[] = $this->createNewConditionStatement((new BuilderFactory())->var(static::PLUGINS_VARIBLE)); $returnStmt->expr = (new BuilderFactory())->var(static::PLUGINS_VARIBLE); } From 318e745eaaec9aad19044b659cb814b54920bc1f Mon Sep 17 00:00:00 2001 From: Sergey Romankov Date: Tue, 24 Oct 2023 17:33:21 +0300 Subject: [PATCH 4/5] SDK-2585 update visitor --- src/Builder/Visitor/AddPluginToPluginListVisitor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Builder/Visitor/AddPluginToPluginListVisitor.php b/src/Builder/Visitor/AddPluginToPluginListVisitor.php index ef1090c1..38bad1dd 100644 --- a/src/Builder/Visitor/AddPluginToPluginListVisitor.php +++ b/src/Builder/Visitor/AddPluginToPluginListVisitor.php @@ -213,7 +213,7 @@ protected function addNewPluginWithConditionIntoList(ClassMethod $node): Node if ($returnStmt->expr instanceof FuncCall || $returnStmt->expr instanceof Array_) { $newStmts[] = $this->createAssignArray( static::PLUGINS_VARIBLE, - $returnStmt->expr instanceof Array_ ? $returnStmt->expr : null + $returnStmt->expr instanceof Array_ ? $returnStmt->expr : null, ); $newStmts[] = $this->createNewConditionStatement((new BuilderFactory())->var(static::PLUGINS_VARIBLE)); $returnStmt->expr = (new BuilderFactory())->var(static::PLUGINS_VARIBLE); From 3e188eded4f71c0840fb068cb8c835b8c11d8404 Mon Sep 17 00:00:00 2001 From: Pavel Maksimov <82393959+pavelmaksimov25@users.noreply.github.com> Date: Fri, 27 Oct 2023 10:32:17 +0200 Subject: [PATCH 5/5] SDK-2546: Updated dev(testing) dependency. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3b77e31e..c8b80147 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "ext-zip": "*", "phpstan/phpstan": "^1.0.0", "phpunit/phpunit": "^9.5.0", - "spryker-sdk/manifest-test-data-provider": "dev-feature/sdk-2855-add-missed-plugin-classes", + "spryker-sdk/manifest-test-data-provider": "dev-master", "spryker/code-sniffer": "dev-master", "symfony/filesystem": "^5.3.0 || ^6.0" },