Skip to content

Commit

Permalink
Merge pull request #39 from GaryJones/5.3-compatibility
Browse files Browse the repository at this point in the history
CS: Add PHP 5.3 compatibility
  • Loading branch information
Potherca authored Sep 18, 2017
2 parents 692daae + ba30774 commit 63c0ec0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*"
},
Expand Down
26 changes: 13 additions & 13 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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),
),
);
}

/**
Expand Down Expand Up @@ -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();
Expand All @@ -204,15 +204,15 @@ 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 <info>%s</info> <comment>set to</comment> <info>%s</info>',
self::PHPCS_CONFIG_KEY,
$paths
);
} 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 <info>%s</info> <comment>delete</comment>',
self::PHPCS_CONFIG_KEY
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 63c0ec0

Please sign in to comment.