From 156de3183195e48de4a98c209a5876e226704e77 Mon Sep 17 00:00:00 2001 From: Flyingmana Date: Mon, 15 Jun 2020 21:01:31 +0200 Subject: [PATCH] codestyle fixes --- .../Deploystrategy/DeploystrategyAbstract.php | 4 ---- .../Composer/Magento/Deploystrategy/Move.php | 6 ++---- src/MagentoHackathon/Composer/Magento/Plugin.php | 12 ++++++------ .../Composer/Magento/ProjectConfig.php | 1 - .../Composer/FullStack/Feature/UpdatePluginTest.php | 2 -- .../Composer/Magento/Deploystrategy/CopyTest.php | 5 ++--- .../Composer/Magento/Event/EventManagerTest.php | 2 -- .../Composer/Magento/FullStack/GlobalPluginTest.php | 8 +++----- .../InstalledFilesFilesystemRepositoryTest.php | 1 - 9 files changed, 13 insertions(+), 28 deletions(-) diff --git a/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php b/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php index 02284472..60ba20da 100644 --- a/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php +++ b/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php @@ -113,7 +113,6 @@ public function deploy() */ protected function beforeDeploy() { - } /** @@ -123,7 +122,6 @@ protected function beforeDeploy() */ protected function afterDeploy() { - } /** @@ -150,7 +148,6 @@ public function clean() */ protected function beforeClean() { - } /** @@ -160,7 +157,6 @@ protected function beforeClean() */ protected function afterClean() { - } /** diff --git a/src/MagentoHackathon/Composer/Magento/Deploystrategy/Move.php b/src/MagentoHackathon/Composer/Magento/Deploystrategy/Move.php index c5ea9220..5cacb02b 100644 --- a/src/MagentoHackathon/Composer/Magento/Deploystrategy/Move.php +++ b/src/MagentoHackathon/Composer/Magento/Deploystrategy/Move.php @@ -30,7 +30,7 @@ protected function transfer($item, $subDestPath) */ protected function afterDeploy() { - if(is_dir($this->sourceDir)) { + if (is_dir($this->sourceDir)) { $this->removeDir($this->sourceDir); } } @@ -50,7 +50,7 @@ private function removeDir($path) ); foreach ($iterator as $fileInfo) { $filename = $fileInfo->getFilename(); - if($filename != '..' || $filename != '.') { + if ($filename != '..' || $filename != '.') { $removeAction = ($fileInfo->isDir() ? 'rmdir' : 'unlink'); try { $removeAction($fileInfo->getRealPath()); @@ -60,11 +60,9 @@ private function removeDir($path) } else { throw new Exception(sprintf('%s could not be removed.', $fileInfo->getRealPath())); } - } } } rmdir($path); } - } diff --git a/src/MagentoHackathon/Composer/Magento/Plugin.php b/src/MagentoHackathon/Composer/Magento/Plugin.php index 13a4d1a8..b6114817 100644 --- a/src/MagentoHackathon/Composer/Magento/Plugin.php +++ b/src/MagentoHackathon/Composer/Magento/Plugin.php @@ -264,20 +264,20 @@ public function onPackageUpdate(PackageEvent $event) $rule = $event->getOperation()->getReason(); if ($rule instanceof Rule) { if ($event->getOperation()->getJobType() === 'update') { - if ($rule->getJob() && $rule->getJob()['packageName'] === 'magento-hackathon/magento-composer-installer') { + if ( + $rule->getJob() + && $rule->getJob()['packageName'] === 'magento-hackathon/magento-composer-installer') { throw new \Exception( - 'Dont update the "magento-hackathon/magento-composer-installer" with active plugins.' . PHP_EOL . + 'Dont update the "magento-hackathon/magento-composer-installer" with active plugins.' + . PHP_EOL . 'Consult the documentation on how to update the Installer' . PHP_EOL . 'https://github.com/Cotya/magento-composer-installer#update-the-installer' . PHP_EOL ); } } - } else { - } - } - + /** * test configured repositories and give message about adding recommended ones */ diff --git a/src/MagentoHackathon/Composer/Magento/ProjectConfig.php b/src/MagentoHackathon/Composer/Magento/ProjectConfig.php index c7e611b0..8893fa55 100644 --- a/src/MagentoHackathon/Composer/Magento/ProjectConfig.php +++ b/src/MagentoHackathon/Composer/Magento/ProjectConfig.php @@ -518,5 +518,4 @@ public function setNoDevMode() { $this->isDevMode = false; } - } diff --git a/tests/MagentoHackathon/Composer/FullStack/Feature/UpdatePluginTest.php b/tests/MagentoHackathon/Composer/FullStack/Feature/UpdatePluginTest.php index d32ec29b..74958409 100644 --- a/tests/MagentoHackathon/Composer/FullStack/Feature/UpdatePluginTest.php +++ b/tests/MagentoHackathon/Composer/FullStack/Feature/UpdatePluginTest.php @@ -80,7 +80,5 @@ public function testDeployOfEarlierInstalledPackages() } catch (\Exception $e) { $this->assertContains('Dont update the', $e->getMessage()); } - - } } diff --git a/tests/MagentoHackathon/Composer/Magento/Deploystrategy/CopyTest.php b/tests/MagentoHackathon/Composer/Magento/Deploystrategy/CopyTest.php index 5ff0b158..d61c0f1d 100644 --- a/tests/MagentoHackathon/Composer/Magento/Deploystrategy/CopyTest.php +++ b/tests/MagentoHackathon/Composer/Magento/Deploystrategy/CopyTest.php @@ -25,7 +25,7 @@ public function getTestDeployStrategyFiletype($isDir = false) return self::TEST_FILETYPE_FILE; } - + public function testCopyDirToDirOfSameName() { $sourceRoot = 'root'; @@ -53,7 +53,7 @@ public function testCopyDirToDirOfSameName() public function testWildcardCopyToExistingDir() { $sourceContents = "app/code/test.php"; - + //create target directory before $this->mkdir(sprintf('%s/app/code', $this->destDir)); $this->mkdir(sprintf('%s/app/code', $this->sourceDir)); @@ -72,7 +72,6 @@ public function testWildcardCopyToExistingDir() $this->strategy->deploy(); $this->assertFileNotExists(sprintf('%s/app/app/code/test.php', $this->destDir)); - } public function testDeployedFilesAreStored() diff --git a/tests/MagentoHackathon/Composer/Magento/Event/EventManagerTest.php b/tests/MagentoHackathon/Composer/Magento/Event/EventManagerTest.php index fd2df98b..86c618a1 100644 --- a/tests/MagentoHackathon/Composer/Magento/Event/EventManagerTest.php +++ b/tests/MagentoHackathon/Composer/Magento/Event/EventManagerTest.php @@ -29,10 +29,8 @@ public function testListenThrowsExceptionIfArgument2NotCallable() public function testAddListener() { $this->eventManager->listen('some-event', function () { - }); $this->eventManager->listen('some-event', function () { - }); } diff --git a/tests/MagentoHackathon/Composer/Magento/FullStack/GlobalPluginTest.php b/tests/MagentoHackathon/Composer/Magento/FullStack/GlobalPluginTest.php index e991bd33..97184271 100644 --- a/tests/MagentoHackathon/Composer/Magento/FullStack/GlobalPluginTest.php +++ b/tests/MagentoHackathon/Composer/Magento/FullStack/GlobalPluginTest.php @@ -7,17 +7,15 @@ class GlobalPluginTest extends AbstractTest { - + protected static $processLogCounter = 1; protected function setUp() { - } - + protected function tearDown() { - } protected function prepareCleanDirectories() @@ -40,7 +38,7 @@ public function testGlobalInstall() $process->run(); $this->assertProcess($process); } - + public function testGlobalUpdate() { $this->markTestSkipped('This has not been implemented yet.'); diff --git a/tests/MagentoHackathon/Composer/Magento/Repository/InstalledFilesFilesystemRepositoryTest.php b/tests/MagentoHackathon/Composer/Magento/Repository/InstalledFilesFilesystemRepositoryTest.php index bbbb727e..da121879 100644 --- a/tests/MagentoHackathon/Composer/Magento/Repository/InstalledFilesFilesystemRepositoryTest.php +++ b/tests/MagentoHackathon/Composer/Magento/Repository/InstalledFilesFilesystemRepositoryTest.php @@ -151,7 +151,6 @@ public function testFindAllPackages() $this->repository->add($package); $this->assertCount(1, $this->repository->findAll()); $this->assertSame(array($package), $this->repository->findAll()); - } public function tearDown()