From c23d45762f2e1d4afc32641a6736b35c7e7d952c Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 1 Nov 2016 15:45:04 +0100 Subject: [PATCH 1/3] Fixes issue where plugin still tries to execute PHP_CodeSniffer, even if it is not installed. In case this plugin was installed globally and PHP_CodeSniffer is not in the repository you are working on. --- src/Plugin.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Plugin.php b/src/Plugin.php index 55fd1974..11bc115f 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -115,18 +115,19 @@ public function onDependenciesChangedEvent() */ private function loadInstalledPaths() { + if ($this->isPHPCodeSnifferInstalled() === true ) { + $output = $this->processBuilder + ->setArguments(['--config-show', 'installed_paths']) + ->getProcess() + ->mustRun() + ->getOutput(); - $output = $this->processBuilder - ->setArguments(['--config-show', 'installed_paths']) - ->getProcess() - ->mustRun() - ->getOutput(); - - $phpcsInstalledPaths = str_replace('installed_paths: ', '', $output); - $phpcsInstalledPaths = trim($phpcsInstalledPaths); + $phpcsInstalledPaths = str_replace('installed_paths: ', '', $output); + $phpcsInstalledPaths = trim($phpcsInstalledPaths); - if ($phpcsInstalledPaths !== '') { - $this->installedPaths = explode(',', $phpcsInstalledPaths); + if ($phpcsInstalledPaths !== '') { + $this->installedPaths = explode(',', $phpcsInstalledPaths); + } } } From 026ad3f966d26cbcbdc4b8a411929f43d062f7f5 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 1 Nov 2016 15:46:33 +0100 Subject: [PATCH 2/3] Code styling fix (removed space). --- src/Plugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Plugin.php b/src/Plugin.php index 11bc115f..bf944804 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -96,7 +96,7 @@ public static function getSubscribedEvents() */ public function onDependenciesChangedEvent() { - if ($this->isPHPCodeSnifferInstalled() === true ) { + if ($this->isPHPCodeSnifferInstalled() === true) { $installPathCleaned = $this->cleanInstalledPaths(); $installPathUpdated = $this->updateInstalledPaths(); From 415ac942e1ed284664a7349f0ef2a7e853456c3d Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 1 Nov 2016 15:48:21 +0100 Subject: [PATCH 3/3] Code styling fix (removed space). --- src/Plugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Plugin.php b/src/Plugin.php index bf944804..f6eaddcd 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -115,7 +115,7 @@ public function onDependenciesChangedEvent() */ private function loadInstalledPaths() { - if ($this->isPHPCodeSnifferInstalled() === true ) { + if ($this->isPHPCodeSnifferInstalled() === true) { $output = $this->processBuilder ->setArguments(['--config-show', 'installed_paths']) ->getProcess()