Skip to content

Commit

Permalink
Merge pull request #2 from DealerDirect/feature/fix-bug-when-phpcs-mi…
Browse files Browse the repository at this point in the history
…ssing

Bugfix: Plugin fails when PHP_CodeSniffer is not installed
  • Loading branch information
frenck authored Nov 1, 2016
2 parents 771d652 + 415ac94 commit 2a3580b
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -115,18 +115,19 @@ public function onDependenciesChangedEvent()
*/
private function loadInstalledPaths()
{

$output = $this->processBuilder
->setArguments(['--config-show', 'installed_paths'])
->getProcess()
->mustRun()
->getOutput();

$phpcsInstalledPaths = str_replace('installed_paths: ', '', $output);
$phpcsInstalledPaths = trim($phpcsInstalledPaths);

if ($phpcsInstalledPaths !== '') {
$this->installedPaths = explode(',', $phpcsInstalledPaths);
if ($this->isPHPCodeSnifferInstalled() === true) {
$output = $this->processBuilder
->setArguments(['--config-show', 'installed_paths'])
->getProcess()
->mustRun()
->getOutput();

$phpcsInstalledPaths = str_replace('installed_paths: ', '', $output);
$phpcsInstalledPaths = trim($phpcsInstalledPaths);

if ($phpcsInstalledPaths !== '') {
$this->installedPaths = explode(',', $phpcsInstalledPaths);
}
}
}

Expand Down

0 comments on commit 2a3580b

Please sign in to comment.