@@ -28,7 +28,7 @@ |
||
| 28 | 28 | |
| 29 | 29 | if (isset($version)) { |
| 30 | 30 | $project = array_map( |
| 31 | - function ($item) use ($version) { |
|
| 31 | + function($item) use ($version) { |
|
| 32 | 32 | return "$item:$version"; |
| 33 | 33 | }, |
| 34 | 34 | $project |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | $I = new CliGuy($scenario); |
| 3 | 3 | |
| 4 | 4 | $I->wantTo('copy dir recursively with CopyDir task, but exclude a file'); |
| 5 | -$I->amInPath(codecept_data_dir().'sandbox'); |
|
| 5 | +$I->amInPath(codecept_data_dir() . 'sandbox'); |
|
| 6 | 6 | $I->seeDirFound('some/deeply/nested'); |
| 7 | 7 | $I->seeDirFound('some/deeply/nested2'); |
| 8 | 8 | $I->seeDirFound('some/deeply/nested3'); |
@@ -235,7 +235,7 @@ |
||
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | $this->version = array_intersect_key($matches, $this->version); |
| 238 | - $this->version = array_map(function ($item) { |
|
| 238 | + $this->version = array_map(function($item) { |
|
| 239 | 239 | return $item[0]; |
| 240 | 240 | }, $this->version); |
| 241 | 241 | } |
@@ -73,9 +73,9 @@ |
||
| 73 | 73 | */ |
| 74 | 74 | private static function getClassKey($key) |
| 75 | 75 | { |
| 76 | - $configPrefix = static::configPrefix(); // task. |
|
| 77 | - $configClass = static::configClassIdentifier(get_called_class()); // PARTIAL_NAMESPACE.CLASSNAME |
|
| 78 | - $configPostFix = static::configPostfix(); // .settings |
|
| 76 | + $configPrefix = static::configPrefix(); // task. |
|
| 77 | + $configClass = static::configClassIdentifier(get_called_class()); // PARTIAL_NAMESPACE.CLASSNAME |
|
| 78 | + $configPostFix = static::configPostfix(); // .settings |
|
| 79 | 79 | |
| 80 | 80 | return sprintf('%s%s%s.%s', $configPrefix, $configClass, $configPostFix, $key); |
| 81 | 81 | } |
@@ -1,6 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | use Robo\Robo; |
| 3 | - |
|
| 4 | 3 | use Consolidation\Config\Loader\ConfigProcessor; |
| 5 | 4 | use Consolidation\Config\Loader\YamlConfigLoader; |
| 6 | 5 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | public function __construct($roboClass = null, $roboFile = null) |
| 48 | 48 | { |
| 49 | 49 | // set the const as class properties to allow overwriting in child classes |
| 50 | - $this->roboClass = $roboClass ? $roboClass : self::ROBOCLASS ; |
|
| 50 | + $this->roboClass = $roboClass ? $roboClass : self::ROBOCLASS; |
|
| 51 | 51 | $this->roboFile = $roboFile ? $roboFile : self::ROBOFILE; |
| 52 | 52 | $this->dir = getcwd(); |
| 53 | 53 | } |
@@ -371,9 +371,9 @@ discard block |
||
| 371 | 371 | |
| 372 | 372 | if (substr($argv[$pos], 0, 12) == '--load-from=') { |
| 373 | 373 | $this->dir = substr($argv[$pos], 12); |
| 374 | - } elseif (isset($argv[$pos +1])) { |
|
| 375 | - $this->dir = $argv[$pos +1]; |
|
| 376 | - unset($argv[$pos +1]); |
|
| 374 | + } elseif (isset($argv[$pos + 1])) { |
|
| 375 | + $this->dir = $argv[$pos + 1]; |
|
| 376 | + unset($argv[$pos + 1]); |
|
| 377 | 377 | } |
| 378 | 378 | unset($argv[$pos]); |
| 379 | 379 | // Make adjustments if '--load-from' points at a file. |
@@ -63,6 +63,9 @@ discard block |
||
| 63 | 63 | $this->dir = getcwd(); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | + /** |
|
| 67 | + * @param string $errorType |
|
| 68 | + */ |
|
| 66 | 69 | protected function errorCondtion($msg, $errorType) |
| 67 | 70 | { |
| 68 | 71 | $this->errorConditions[$msg] = $errorType; |
@@ -110,7 +113,7 @@ discard block |
||
| 110 | 113 | } |
| 111 | 114 | |
| 112 | 115 | /** |
| 113 | - * @param array $argv |
|
| 116 | + * @param string[] $argv |
|
| 114 | 117 | * @param null|string $appName |
| 115 | 118 | * @param null|string $appVersion |
| 116 | 119 | * @param null|\Symfony\Component\Console\Output\OutputInterface $output |
@@ -133,7 +136,7 @@ discard block |
||
| 133 | 136 | * @param null|\Symfony\Component\Console\Input\InputInterface $input |
| 134 | 137 | * @param null|\Symfony\Component\Console\Output\OutputInterface $output |
| 135 | 138 | * @param null|\Robo\Application $app |
| 136 | - * @param array[] $commandFiles |
|
| 139 | + * @param null|string $commandFiles |
|
| 137 | 140 | * @param null|ClassLoader $classLoader |
| 138 | 141 | * |
| 139 | 142 | * @return int |
@@ -83,7 +83,7 @@ |
||
| 83 | 83 | * the input string contains no '=' character, then the value will be 'true'. |
| 84 | 84 | * |
| 85 | 85 | * @param string $value |
| 86 | - * @return array |
|
| 86 | + * @return boolean[] |
|
| 87 | 87 | */ |
| 88 | 88 | protected function splitConfigKeyValue($value) |
| 89 | 89 | { |
@@ -24,6 +24,11 @@ |
||
| 24 | 24 | |
| 25 | 25 | protected $applicationName; |
| 26 | 26 | |
| 27 | + /** |
|
| 28 | + * @param string $applicationName |
|
| 29 | + * @param string $currentVersion |
|
| 30 | + * @param string $gitHubRepository |
|
| 31 | + */ |
|
| 27 | 32 | public function __construct($applicationName = null, $currentVersion = null, $gitHubRepository = null) |
| 28 | 33 | { |
| 29 | 34 | parent::__construct(self::SELF_UPDATE_COMMAND_NAME); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | 'http' => [ |
| 56 | 56 | 'method' => 'GET', |
| 57 | 57 | 'header' => [ |
| 58 | - 'User-Agent: ' . $this->applicationName . ' (' . $this->gitHubRepository . ')' . ' Self-Update (PHP)' |
|
| 58 | + 'User-Agent: ' . $this->applicationName . ' (' . $this->gitHubRepository . ')' . ' Self-Update (PHP)' |
|
| 59 | 59 | ] |
| 60 | 60 | ] |
| 61 | 61 | ]; |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | $releases = file_get_contents('https://api.github.com/repos/' . $this->gitHubRepository . '/releases', false, $context); |
| 66 | 66 | $releases = json_decode($releases); |
| 67 | 67 | |
| 68 | - if (! isset($releases[0])) { |
|
| 68 | + if (!isset($releases[0])) { |
|
| 69 | 69 | throw new \Exception('API error - no release found at GitHub repository ' . $this->gitHubRepository); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $version = $releases[0]->tag_name; |
| 73 | 73 | $url = $releases[0]->assets[0]->browser_download_url; |
| 74 | 74 | |
| 75 | - return [ $version, $url ]; |
|
| 75 | + return [$version, $url]; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -89,20 +89,20 @@ discard block |
||
| 89 | 89 | $tempFilename = dirname($localFilename) . '/' . basename($localFilename, '.phar') . '-temp.phar'; |
| 90 | 90 | |
| 91 | 91 | // check for permissions in local filesystem before start connection process |
| 92 | - if (! is_writable($tempDirectory = dirname($tempFilename))) { |
|
| 92 | + if (!is_writable($tempDirectory = dirname($tempFilename))) { |
|
| 93 | 93 | throw new \Exception( |
| 94 | 94 | $programName . ' update failed: the "' . $tempDirectory . |
| 95 | 95 | '" directory used to download the temp file could not be written' |
| 96 | 96 | ); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - if (! is_writable($localFilename)) { |
|
| 99 | + if (!is_writable($localFilename)) { |
|
| 100 | 100 | throw new \Exception( |
| 101 | 101 | $programName . ' update failed: the "' . $localFilename . '" file could not be written (execute with sudo)' |
| 102 | 102 | ); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - list( $latest, $downloadUrl ) = $this->getLatestReleaseFromGithub(); |
|
| 105 | + list($latest, $downloadUrl) = $this->getLatestReleaseFromGithub(); |
|
| 106 | 106 | |
| 107 | 107 | |
| 108 | 108 | if ($this->currentVersion == $latest) { |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $this->_exit(); |
| 132 | 132 | } catch (\Exception $e) { |
| 133 | 133 | @unlink($tempFilename); |
| 134 | - if (! $e instanceof \UnexpectedValueException && ! $e instanceof \PharException) { |
|
| 134 | + if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) { |
|
| 135 | 135 | throw $e; |
| 136 | 136 | } |
| 137 | 137 | $output->writeln('<error>The download is corrupted (' . $e->getMessage() . ').</error>'); |
@@ -7,8 +7,6 @@ |
||
| 7 | 7 | |
| 8 | 8 | namespace Robo\Common; |
| 9 | 9 | |
| 10 | -use Symfony\Component\Process\Exception\InvalidArgumentException; |
|
| 11 | - |
|
| 12 | 10 | /** |
| 13 | 11 | * ProcessUtils is a bunch of utility methods. We want to allow Robo 1.x |
| 14 | 12 | * to work with Symfony 4.x while remaining backwards compatibility. This |
@@ -72,6 +72,9 @@ |
||
| 72 | 72 | return "'".str_replace("'", "'\\''", $argument)."'"; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | + /** |
|
| 76 | + * @param string $char |
|
| 77 | + */ |
|
| 75 | 78 | private static function isSurroundedBy($arg, $char) |
| 76 | 79 | { |
| 77 | 80 | return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1]; |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public static function escapeArgument($argument) |
| 36 | 36 | { |
| 37 | - @trigger_error('The '.__METHOD__.'() method is a copy of a method that was deprecated by Symfony 3.3 and removed in Symfony 4; it will be removed in Robo 2.0.', E_USER_DEPRECATED); |
|
| 37 | + @trigger_error('The ' . __METHOD__ . '() method is a copy of a method that was deprecated by Symfony 3.3 and removed in Symfony 4; it will be removed in Robo 2.0.', E_USER_DEPRECATED); |
|
| 38 | 38 | |
| 39 | 39 | //Fix for PHP bug #43784 escapeshellarg removes % from given string |
| 40 | 40 | //Fix for PHP bug #49446 escapeshellarg doesn't work on Windows |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $escapedArgument .= '\\"'; |
| 53 | 53 | } elseif (self::isSurroundedBy($part, '%')) { |
| 54 | 54 | // Avoid environment variable expansion |
| 55 | - $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%'; |
|
| 55 | + $escapedArgument .= '^%"' . substr($part, 1, -1) . '"^%'; |
|
| 56 | 56 | } else { |
| 57 | 57 | // escape trailing backslash |
| 58 | 58 | if ('\\' === substr($part, -1)) { |
@@ -63,13 +63,13 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | if ($quote) { |
| 66 | - $escapedArgument = '"'.$escapedArgument.'"'; |
|
| 66 | + $escapedArgument = '"' . $escapedArgument . '"'; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | return $escapedArgument; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - return "'".str_replace("'", "'\\''", $argument)."'"; |
|
| 72 | + return "'" . str_replace("'", "'\\''", $argument) . "'"; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | private static function isSurroundedBy($arg, $char) |