| @@ -3,6 +3,10 @@ | ||
| 3 | 3 |  if (!class_exists('N98_Magerun_Bootstrap')) { | 
| 4 | 4 | class N98_Magerun_Bootstrap | 
| 5 | 5 |      { | 
| 6 | + | |
| 7 | + /** | |
| 8 | + * @param string $file | |
| 9 | + */ | |
| 6 | 10 | public static function includeIfExists($file) | 
| 7 | 11 |          { | 
| 8 | 12 |              if (file_exists($file)) { | 
| @@ -16,11 +16,11 @@ | ||
| 16 | 16 | */ | 
| 17 | 17 | public static function getLoader() | 
| 18 | 18 |          { | 
| 19 | - if ((!$loader = \N98_Magerun_Bootstrap::includeIfExists(__DIR__.'/../vendor/autoload.php')) | |
| 20 | -                && (!$loader = \N98_Magerun_Bootstrap::includeIfExists(__DIR__.'/../../../autoload.php'))) { | |
| 21 | -                throw new \ErrorException('You must set up the project dependencies, run the following commands:'.PHP_EOL. | |
| 22 | - 'curl -s http://getcomposer.org/installer | php'.PHP_EOL. | |
| 23 | - 'php composer.phar install'.PHP_EOL); | |
| 19 | + if ((!$loader = \N98_Magerun_Bootstrap::includeIfExists(__DIR__ . '/../vendor/autoload.php')) | |
| 20 | +                && (!$loader = \N98_Magerun_Bootstrap::includeIfExists(__DIR__ . '/../../../autoload.php'))) { | |
| 21 | +                throw new \ErrorException('You must set up the project dependencies, run the following commands:' . PHP_EOL . | |
| 22 | + 'curl -s http://getcomposer.org/installer | php' . PHP_EOL . | |
| 23 | + 'php composer.phar install' . PHP_EOL); | |
| 24 | 24 | } | 
| 25 | 25 | |
| 26 | 26 | return $loader; | 
| @@ -147,7 +147,7 @@ discard block | ||
| 147 | 147 | } | 
| 148 | 148 | |
| 149 | 149 | /** | 
| 150 | - * @return \Symfony\Component\Console\Input\InputDefinition|void | |
| 150 | + * @return \Symfony\Component\Console\Input\InputDefinition | |
| 151 | 151 | */ | 
| 152 | 152 | protected function getDefaultInputDefinition() | 
| 153 | 153 |      { | 
| @@ -387,7 +387,7 @@ discard block | ||
| 387 | 387 | * @TODO Move logic into "EventSubscriber" | 
| 388 | 388 | * | 
| 389 | 389 | * @param OutputInterface $output | 
| 390 | - * @return bool | |
| 390 | + * @return null|false | |
| 391 | 391 | */ | 
| 392 | 392 | public function checkVarDir(OutputInterface $output) | 
| 393 | 393 |      { | 
| @@ -407,7 +407,7 @@ | ||
| 407 | 407 | $this->initMagento(); | 
| 408 | 408 |                  } catch (\Exception $e) { | 
| 409 | 409 | $message = 'Cannot initialize Magento. Please check your configuration. ' | 
| 410 | - . 'Some n98-magerun command will not work. Got message: '; | |
| 410 | + . 'Some n98-magerun command will not work. Got message: '; | |
| 411 | 411 |                      if (OutputInterface::VERBOSITY_VERY_VERBOSE <= $output->getVerbosity()) { | 
| 412 | 412 | $message .= $e->getTraceAsString(); | 
| 413 | 413 |                      } else { | 
| @@ -392,7 +392,7 @@ discard block | ||
| 392 | 392 | public function checkVarDir(OutputInterface $output) | 
| 393 | 393 |      { | 
| 394 | 394 |          if (OutputInterface::VERBOSITY_NORMAL <= $output->getVerbosity()) { | 
| 395 | - $tempVarDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'magento' . DIRECTORY_SEPARATOR . 'var'; | |
| 395 | + $tempVarDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'magento' . DIRECTORY_SEPARATOR . 'var'; | |
| 396 | 396 | |
| 397 | 397 |              if (is_dir($tempVarDir)) { | 
| 398 | 398 | $this->detectMagento(null, $output); | 
| @@ -659,7 +659,7 @@ discard block | ||
| 659 | 659 | $this->partialConfig = $configLoader->getPartialConfig($loadExternalConfig); | 
| 660 | 660 | $this->detectMagento($input, $output); | 
| 661 | 661 | $configLoader->loadStageTwo($this->_magentoRootFolder, $loadExternalConfig, $this->_magerunStopFileFolder); | 
| 662 | - $this->config = $configLoader->toArray();; | |
| 662 | + $this->config = $configLoader->toArray(); ; | |
| 663 | 663 | $this->dispatcher = new EventDispatcher(); | 
| 664 | 664 | $this->setDispatcher($this->dispatcher); | 
| 665 | 665 |              if ($this->autoloader) { | 
| @@ -83,7 +83,7 @@ discard block | ||
| 83 | 83 | /** | 
| 84 | 84 | * @param array $codeArgument | 
| 85 | 85 | * @param bool $status | 
| 86 | - * @return bool | |
| 86 | + * @return boolean|null | |
| 87 | 87 | */ | 
| 88 | 88 | protected function saveCacheStatus($codeArgument, $status) | 
| 89 | 89 |      { | 
| @@ -288,8 +288,8 @@ discard block | ||
| 288 | 288 | /** | 
| 289 | 289 | * brings locally cached repository up to date if it is missing the requested tag | 
| 290 | 290 | * | 
| 291 | - * @param $package | |
| 292 | - * @param $targetFolder | |
| 291 | + * @param PackageInterface $package | |
| 292 | + * @param string $targetFolder | |
| 293 | 293 | */ | 
| 294 | 294 | protected function checkRepository($package, $targetFolder) | 
| 295 | 295 |      { | 
| @@ -202,7 +202,7 @@ discard block | ||
| 202 | 202 | |
| 203 | 203 |          if (!$silent) { | 
| 204 | 204 | $editionString = ($this->_magentoEnterprise ? ' (Enterprise Edition) ' : ''); | 
| 205 | -            $output->writeln('<info>Found Magento '. $editionString . 'in folder "' . $this->_magentoRootFolder . '"</info>'); | |
| 205 | +            $output->writeln('<info>Found Magento ' . $editionString . 'in folder "' . $this->_magentoRootFolder . '"</info>'); | |
| 206 | 206 | } | 
| 207 | 207 | |
| 208 | 208 |          if (!empty($this->_magentoRootFolder)) { | 
| @@ -266,7 +266,7 @@ discard block | ||
| 266 | 266 | $preferSource = true | 
| 267 | 267 |      ) { | 
| 268 | 268 | $dm = $this->getComposerDownloadManager($input, $output); | 
| 269 | -        if (! $config instanceof PackageInterface) { | |
| 269 | +        if (!$config instanceof PackageInterface) { | |
| 270 | 270 | $package = $this->createComposerPackageByConfig($config); | 
| 271 | 271 |          } else { | 
| 272 | 272 | $package = $config; | 
| @@ -310,7 +310,7 @@ discard block | ||
| 310 | 310 | escapeshellarg($targetFolder), | 
| 311 | 311 | escapeshellarg($package->getSourceReference()) | 
| 312 | 312 | ); | 
| 313 | - $existingTag = shell_exec($command); | |
| 313 | + $existingTag = shell_exec($command); | |
| 314 | 314 |              if ($existingTag === $package->getSourceReference()) { | 
| 315 | 315 |                  $command = sprintf('cd %s && hg pull', escapeshellarg($targetFolder)); | 
| 316 | 316 | shell_exec($command); | 
| @@ -143,7 +143,7 @@ | ||
| 143 | 143 | } | 
| 144 | 144 | |
| 145 | 145 | /** | 
| 146 | - * @param $configBag | |
| 146 | + * @param ConfigBag $configBag | |
| 147 | 147 | */ | 
| 148 | 148 | private function initConfigBagDefaultValues($configBag) | 
| 149 | 149 |      { | 
| @@ -252,7 +252,7 @@ | ||
| 252 | 252 | } | 
| 253 | 253 | |
| 254 | 254 | /** | 
| 255 | - * @param array $installArgs | |
| 255 | + * @param string $installArgs | |
| 256 | 256 | * | 
| 257 | 257 | * @throws \Exception | 
| 258 | 258 | */ | 
| @@ -120,7 +120,7 @@ discard block | ||
| 120 | 120 |              if (!preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url)) { | 
| 121 | 121 |                  throw new \InvalidArgumentException('Please enter a valid URL'); | 
| 122 | 122 | } | 
| 123 | -            if (parse_url($url, \PHP_URL_HOST) ==  'localhost') { | |
| 123 | +            if (parse_url($url, \PHP_URL_HOST) == 'localhost') { | |
| 124 | 124 |                  throw new \InvalidArgumentException('localhost cause problems! Please use 127.0.0.1 or another hostname'); | 
| 125 | 125 | } | 
| 126 | 126 | |
| @@ -211,7 +211,7 @@ discard block | ||
| 211 | 211 | */ | 
| 212 | 212 | protected function getInstallScriptPath() | 
| 213 | 213 |      { | 
| 214 | -        $installerScript  = $this->config->getString('installationFolder') . DIRECTORY_SEPARATOR . 'bin/magento'; | |
| 214 | +        $installerScript = $this->config->getString('installationFolder') . DIRECTORY_SEPARATOR . 'bin/magento'; | |
| 215 | 215 |          if (!file_exists($installerScript)) { | 
| 216 | 216 |              throw new \RuntimeException('Installation script was not found.', 1); | 
| 217 | 217 | } | 
| @@ -9,7 +9,7 @@ | ||
| 9 | 9 | class InstallSampleData extends AbstractSubCommand | 
| 10 | 10 |  { | 
| 11 | 11 | /** | 
| 12 | - * @return bool | |
| 12 | + * @return false|null | |
| 13 | 13 | */ | 
| 14 | 14 | public function execute() | 
| 15 | 15 |      { | 
| @@ -50,7 +50,7 @@ discard block | ||
| 50 | 50 | $process = $processBuilder->getProcess(); | 
| 51 | 51 | $process->setTimeout(86400); | 
| 52 | 52 | $process->start(); | 
| 53 | -        $process->wait(function ($type, $buffer) { | |
| 53 | +        $process->wait(function($type, $buffer) { | |
| 54 | 54 | $this->output->write($buffer, false); | 
| 55 | 55 | }); | 
| 56 | 56 | |
| @@ -70,7 +70,7 @@ discard block | ||
| 70 | 70 | $process = $processBuilder->getProcess(); | 
| 71 | 71 | $process->setTimeout(86400); | 
| 72 | 72 | $process->start(); | 
| 73 | -        $process->wait(function ($type, $buffer) { | |
| 73 | +        $process->wait(function($type, $buffer) { | |
| 74 | 74 | $this->output->write($buffer, false); | 
| 75 | 75 | }); | 
| 76 | 76 | } | 
| @@ -7,7 +7,7 @@ discard block | ||
| 7 | 7 | class RewriteHtaccessFile extends AbstractSubCommand | 
| 8 | 8 |  { | 
| 9 | 9 | /** | 
| 10 | - * @return bool | |
| 10 | + * @return boolean|null | |
| 11 | 11 | */ | 
| 12 | 12 | public function execute() | 
| 13 | 13 |      { | 
| @@ -53,6 +53,9 @@ discard block | ||
| 53 | 53 | $this->_replaceContent($htaccessFile, $baseUrl); | 
| 54 | 54 | } | 
| 55 | 55 | |
| 56 | + /** | |
| 57 | + * @param string $htaccesFile | |
| 58 | + */ | |
| 56 | 59 | protected function _backupOriginalFile($htaccesFile) | 
| 57 | 60 |      { | 
| 58 | 61 | copy( | 
| @@ -44,10 +44,10 @@ | ||
| 44 | 44 | protected function replaceHtaccessFile($baseUrl) | 
| 45 | 45 |      { | 
| 46 | 46 |          $htaccessFile = $this->config->getString('installationFolder') | 
| 47 | - . DIRECTORY_SEPARATOR | |
| 48 | - . 'pub' | |
| 49 | - . DIRECTORY_SEPARATOR | |
| 50 | - . '.htaccess'; | |
| 47 | + . DIRECTORY_SEPARATOR | |
| 48 | + . 'pub' | |
| 49 | + . DIRECTORY_SEPARATOR | |
| 50 | + . '.htaccess'; | |
| 51 | 51 | |
| 52 | 52 | $this->_backupOriginalFile($htaccessFile); | 
| 53 | 53 | $this->_replaceContent($htaccessFile, $baseUrl); | 
| @@ -78,7 +78,7 @@ | ||
| 78 | 78 | /** | 
| 79 | 79 | * Reads the first line. If it's a comment return it. | 
| 80 | 80 | * | 
| 81 | - * @param $file | |
| 81 | + * @param string $file | |
| 82 | 82 | * | 
| 83 | 83 | * @return string | 
| 84 | 84 | */ | 
| @@ -254,7 +254,7 @@ discard block | ||
| 254 | 254 | /** | 
| 255 | 255 | * @param InputInterface $input | 
| 256 | 256 | * @param OutputInterface $output | 
| 257 | - * @param $commandString | |
| 257 | + * @param string $commandString | |
| 258 | 258 | * @throws \RuntimeException | 
| 259 | 259 | */ | 
| 260 | 260 | protected function runMagerunCommand(InputInterface $input, OutputInterface $output, $commandString) | 
| @@ -270,7 +270,7 @@ discard block | ||
| 270 | 270 | |
| 271 | 271 | /** | 
| 272 | 272 | * @param string $commandString | 
| 273 | - * @return mixed|string | |
| 273 | + * @return string | |
| 274 | 274 | */ | 
| 275 | 275 | protected function _prepareShellCommand($commandString) | 
| 276 | 276 |      { | 
| @@ -320,7 +320,7 @@ discard block | ||
| 320 | 320 | |
| 321 | 321 | /** | 
| 322 | 322 | * @param $commandString | 
| 323 | - * @return mixed | |
| 323 | + * @return string | |
| 324 | 324 | */ | 
| 325 | 325 | protected function _replaceScriptVars($commandString) | 
| 326 | 326 |      { | 
| @@ -171,7 +171,7 @@ | ||
| 171 | 171 |                  if (isset($parts[1])) { | 
| 172 | 172 | $value = $parts[1]; | 
| 173 | 173 | } | 
| 174 | -                $this->scriptVars['${' . $variable. '}'] = $value; | |
| 174 | +                $this->scriptVars['${' . $variable . '}'] = $value; | |
| 175 | 175 | } | 
| 176 | 176 | } | 
| 177 | 177 | } |