diff --git a/composer.json b/composer.json index 835e40f7..e7fdf1b7 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,7 @@ "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" }, "require": { + "php": "^5.3|^7", "composer-plugin-api": "^1.0", "squizlabs/php_codesniffer": "*" }, diff --git a/src/Plugin.php b/src/Plugin.php index a1727b4e..b12a6ccd 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -113,7 +113,7 @@ public function activate(Composer $composer, IOInterface $io) */ private function init() { - $this->installedPaths = []; + $this->installedPaths = array(); $this->processBuilder = new ProcessBuilder(); $this->processBuilder->setPrefix($this->composer->getConfig()->get('bin-dir') . DIRECTORY_SEPARATOR . 'phpcs'); @@ -126,14 +126,14 @@ private function init() */ public static function getSubscribedEvents() { - return [ - ScriptEvents::POST_INSTALL_CMD => [ - ['onDependenciesChangedEvent', 0], - ], - ScriptEvents::POST_UPDATE_CMD => [ - ['onDependenciesChangedEvent', 0], - ], - ]; + return array( + ScriptEvents::POST_INSTALL_CMD => array( + array('onDependenciesChangedEvent', 0), + ), + ScriptEvents::POST_UPDATE_CMD => array( + array('onDependenciesChangedEvent', 0), + ), + ); } /** @@ -178,7 +178,7 @@ private function loadInstalledPaths() { if ($this->isPHPCodeSnifferInstalled() === true) { $output = $this->processBuilder - ->setArguments(['--config-show', self::PHPCS_CONFIG_KEY]) + ->setArguments(array('--config-show', self::PHPCS_CONFIG_KEY)) ->getProcess() ->mustRun() ->getOutput(); @@ -204,7 +204,7 @@ private function saveInstalledPaths() // Check if we found installed paths to set. if (count($this->installedPaths) !== 0) { $paths = implode(',', $this->installedPaths); - $arguments = ['--config-set', self::PHPCS_CONFIG_KEY, $paths]; + $arguments = array('--config-set', self::PHPCS_CONFIG_KEY, $paths); $configMessage = sprintf( 'PHP CodeSniffer Config %s set to %s', self::PHPCS_CONFIG_KEY, @@ -212,7 +212,7 @@ private function saveInstalledPaths() ); } else { // Delete the installed paths if none were found. - $arguments = ['--config-delete', self::PHPCS_CONFIG_KEY]; + $arguments = array('--config-delete', self::PHPCS_CONFIG_KEY); $configMessage = sprintf( 'PHP CodeSniffer Config %s delete', self::PHPCS_CONFIG_KEY @@ -271,7 +271,7 @@ private function updateInstalledPaths() { $changes = false; - $searchPaths = [getcwd()]; + $searchPaths = array(getcwd()); $codingStandardPackages = $this->getPHPCodingStandardPackages(); foreach ($codingStandardPackages as $package) { $searchPaths[] = $this->composer->getInstallationManager()->getInstallPath($package);