Skip to content

Commit 2a3580b

Browse files
authored
Merge pull request #2 from DealerDirect/feature/fix-bug-when-phpcs-missing
Bugfix: Plugin fails when PHP_CodeSniffer is not installed
2 parents 771d652 + 415ac94 commit 2a3580b

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/Plugin.php

+14-13
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public static function getSubscribedEvents()
9696
*/
9797
public function onDependenciesChangedEvent()
9898
{
99-
if ($this->isPHPCodeSnifferInstalled() === true ) {
99+
if ($this->isPHPCodeSnifferInstalled() === true) {
100100
$installPathCleaned = $this->cleanInstalledPaths();
101101
$installPathUpdated = $this->updateInstalledPaths();
102102

@@ -115,18 +115,19 @@ public function onDependenciesChangedEvent()
115115
*/
116116
private function loadInstalledPaths()
117117
{
118-
119-
$output = $this->processBuilder
120-
->setArguments(['--config-show', 'installed_paths'])
121-
->getProcess()
122-
->mustRun()
123-
->getOutput();
124-
125-
$phpcsInstalledPaths = str_replace('installed_paths: ', '', $output);
126-
$phpcsInstalledPaths = trim($phpcsInstalledPaths);
127-
128-
if ($phpcsInstalledPaths !== '') {
129-
$this->installedPaths = explode(',', $phpcsInstalledPaths);
118+
if ($this->isPHPCodeSnifferInstalled() === true) {
119+
$output = $this->processBuilder
120+
->setArguments(['--config-show', 'installed_paths'])
121+
->getProcess()
122+
->mustRun()
123+
->getOutput();
124+
125+
$phpcsInstalledPaths = str_replace('installed_paths: ', '', $output);
126+
$phpcsInstalledPaths = trim($phpcsInstalledPaths);
127+
128+
if ($phpcsInstalledPaths !== '') {
129+
$this->installedPaths = explode(',', $phpcsInstalledPaths);
130+
}
130131
}
131132
}
132133

0 commit comments

Comments
 (0)