@@ -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 | |
@@ -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 | { |
@@ -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) |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | $I->wantTo('set iterable in the __constructor'); |
| 42 | 42 | $I |
| 43 | 43 | ->taskForEach($example['items']) |
| 44 | - ->withBuilder(function (CollectionBuilder $builder, $key, $value) use (&$actual) { |
|
| 45 | - $builder->addCode(function () use ($key, $value, &$actual) { |
|
| 44 | + ->withBuilder(function(CollectionBuilder $builder, $key, $value) use (&$actual) { |
|
| 45 | + $builder->addCode(function() use ($key, $value, &$actual) { |
|
| 46 | 46 | $actual[] = "$key = $value"; |
| 47 | 47 | |
| 48 | 48 | return 0; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $I->wantTo('set iterable with deferTaskConfiguration()'); |
| 64 | 64 | $I |
| 65 | 65 | ->collectionBuilder() |
| 66 | - ->addCode(function (Data $data) use ($example) { |
|
| 66 | + ->addCode(function(Data $data) use ($example) { |
|
| 67 | 67 | $data['items'] = $example['items']; |
| 68 | 68 | |
| 69 | 69 | return 0; |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | $I |
| 73 | 73 | ->taskForEach() |
| 74 | 74 | ->deferTaskConfiguration('setIterable', 'items') |
| 75 | - ->withBuilder(function (CollectionBuilder $builder, $key, $value) use (&$actual) { |
|
| 76 | - $builder->addCode(function () use ($key, $value, &$actual) { |
|
| 75 | + ->withBuilder(function(CollectionBuilder $builder, $key, $value) use (&$actual) { |
|
| 76 | + $builder->addCode(function() use ($key, $value, &$actual) { |
|
| 77 | 77 | $actual[] = "$key = $value"; |
| 78 | 78 | |
| 79 | 79 | return 0; |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | $I->wantTo('call the __constructor() without argument'); |
| 92 | 92 | $I |
| 93 | 93 | ->taskForEach() |
| 94 | - ->withBuilder(function (CollectionBuilder $builder, $key, $value) use (&$actual) { |
|
| 95 | - $builder->addCode(function () use ($key, $value, &$actual) { |
|
| 94 | + ->withBuilder(function(CollectionBuilder $builder, $key, $value) use (&$actual) { |
|
| 95 | + $builder->addCode(function() use ($key, $value, &$actual) { |
|
| 96 | 96 | $actual++; |
| 97 | 97 | |
| 98 | 98 | return 0; |
@@ -91,8 +91,8 @@ |
||
| 91 | 91 | { |
| 92 | 92 | $finder = new Finder(); |
| 93 | 93 | $finder->files() |
| 94 | - ->name($pattern) |
|
| 95 | - ->in($directories); |
|
| 94 | + ->name($pattern) |
|
| 95 | + ->in($directories); |
|
| 96 | 96 | |
| 97 | 97 | return $finder; |
| 98 | 98 | } |
@@ -62,6 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * {@inheritdoc} |
| 65 | + * @param string $class |
|
| 65 | 66 | */ |
| 66 | 67 | public function getFile($class) |
| 67 | 68 | { |
@@ -70,7 +71,7 @@ discard block |
||
| 70 | 71 | |
| 71 | 72 | /** |
| 72 | 73 | * @param $directories |
| 73 | - * @param $pattern |
|
| 74 | + * @param string $pattern |
|
| 74 | 75 | * |
| 75 | 76 | * @return \Symfony\Component\Finder\Finder |
| 76 | 77 | */ |
@@ -85,9 +86,9 @@ discard block |
||
| 85 | 86 | } |
| 86 | 87 | |
| 87 | 88 | /** |
| 88 | - * @param $path |
|
| 89 | + * @param string $path |
|
| 89 | 90 | * |
| 90 | - * @return mixed |
|
| 91 | + * @return string |
|
| 91 | 92 | */ |
| 92 | 93 | protected function convertPathToNamespace($path) |
| 93 | 94 | { |
@@ -95,6 +96,7 @@ discard block |
||
| 95 | 96 | } |
| 96 | 97 | |
| 97 | 98 | /** |
| 99 | + * @param string $namespace |
|
| 98 | 100 | * @return string |
| 99 | 101 | */ |
| 100 | 102 | public function convertNamespaceToPath($namespace) |
@@ -53,14 +53,14 @@ discard block |
||
| 53 | 53 | $relativePath = $this->convertNamespaceToPath($this->relativeNamespace); |
| 54 | 54 | |
| 55 | 55 | foreach ($this->classLoader->getPrefixesPsr4() as $baseNamespace => $directories) { |
| 56 | - $directories = array_filter(array_map(function ($directory) use ($relativePath) { |
|
| 57 | - return $directory.$relativePath; |
|
| 56 | + $directories = array_filter(array_map(function($directory) use ($relativePath) { |
|
| 57 | + return $directory . $relativePath; |
|
| 58 | 58 | }, $directories), 'is_dir'); |
| 59 | 59 | |
| 60 | 60 | if ($directories) { |
| 61 | 61 | foreach ($this->search($directories, $this->searchPattern) as $file) { |
| 62 | 62 | $relativePathName = $file->getRelativePathname(); |
| 63 | - $classes[] = $baseNamespace.$this->convertPathToNamespace($relativePath.'/'.$relativePathName); |
|
| 63 | + $classes[] = $baseNamespace . $this->convertPathToNamespace($relativePath . '/' . $relativePathName); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -107,6 +107,6 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function convertNamespaceToPath($namespace) |
| 109 | 109 | { |
| 110 | - return '/'.str_replace("\\", '/', trim($namespace, '\\')); |
|
| 110 | + return '/' . str_replace("\\", '/', trim($namespace, '\\')); |
|
| 111 | 111 | } |
| 112 | 112 | } |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | public function testConvertPathToNamespaceData() |
| 39 | 39 | { |
| 40 | 40 | return [ |
| 41 | - ['/A/B/C', 'A\B\C'], |
|
| 42 | - ['A/B/C', 'A\B\C'], |
|
| 43 | - ['A/B/C', 'A\B\C'], |
|
| 44 | - ['A/B/C.php', 'A\B\C'], |
|
| 41 | + ['/A/B/C', 'A\B\C'], |
|
| 42 | + ['A/B/C', 'A\B\C'], |
|
| 43 | + ['A/B/C', 'A\B\C'], |
|
| 44 | + ['A/B/C.php', 'A\B\C'], |
|
| 45 | 45 | ]; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | public function testConvertNamespaceToPathData() |
| 62 | 62 | { |
| 63 | 63 | return [ |
| 64 | - ['A\B\C', '/A/B/C'], |
|
| 65 | - ['\A\B\C\\', '/A/B/C'], |
|
| 66 | - ['A\B\C\\', '/A/B/C'], |
|
| 64 | + ['A\B\C', '/A/B/C'], |
|
| 65 | + ['\A\B\C\\', '/A/B/C'], |
|
| 66 | + ['A\B\C\\', '/A/B/C'], |
|
| 67 | 67 | ]; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | public function testGetClasses() |
| 12 | 12 | { |
| 13 | 13 | $classLoader = new ClassLoader(); |
| 14 | - $classLoader->addPsr4('\\Robo\\PluginTest\\', [realpath(__DIR__.'/../../plugins')]); |
|
| 14 | + $classLoader->addPsr4('\\Robo\\PluginTest\\', [realpath(__DIR__ . '/../../plugins')]); |
|
| 15 | 15 | $service = new RelativeNamespaceDiscovery($classLoader); |
| 16 | 16 | $service->setRelativeNamespace('Robo\Plugin'); |
| 17 | 17 | $service->setSearchPattern('*Commands.php'); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | public function testGetFile() |
| 26 | 26 | { |
| 27 | 27 | $classLoader = new ClassLoader(); |
| 28 | - $classLoader->addPsr4('\\Robo\\PluginTest\\', [realpath(__DIR__.'/../../plugins')]); |
|
| 28 | + $classLoader->addPsr4('\\Robo\\PluginTest\\', [realpath(__DIR__ . '/../../plugins')]); |
|
| 29 | 29 | $service = new RelativeNamespaceDiscovery($classLoader); |
| 30 | 30 | $service->setRelativeNamespace('Robo\Plugin'); |
| 31 | 31 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | public function __construct($roboClass = null, $roboFile = null) |
| 64 | 64 | { |
| 65 | 65 | // set the const as class properties to allow overwriting in child classes |
| 66 | - $this->roboClass = $roboClass ? $roboClass : self::ROBOCLASS ; |
|
| 66 | + $this->roboClass = $roboClass ? $roboClass : self::ROBOCLASS; |
|
| 67 | 67 | $this->roboFile = $roboFile ? $roboFile : self::ROBOFILE; |
| 68 | 68 | $this->dir = getcwd(); |
| 69 | 69 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | { |
| 240 | 240 | /** @var \Robo\ClassDiscovery\RelativeNamespaceDiscovery $discovery */ |
| 241 | 241 | $discovery = Robo::service('relativeNamespaceDiscovery'); |
| 242 | - $discovery->setRelativeNamespace($relativeNamespace.'\Commands') |
|
| 242 | + $discovery->setRelativeNamespace($relativeNamespace . '\Commands') |
|
| 243 | 243 | ->setSearchPattern('*Commands.php'); |
| 244 | 244 | return $discovery->getClasses(); |
| 245 | 245 | } |
@@ -413,9 +413,9 @@ discard block |
||
| 413 | 413 | |
| 414 | 414 | if (substr($argv[$pos], 0, 12) == '--load-from=') { |
| 415 | 415 | $this->dir = substr($argv[$pos], 12); |
| 416 | - } elseif (isset($argv[$pos +1])) { |
|
| 417 | - $this->dir = $argv[$pos +1]; |
|
| 418 | - unset($argv[$pos +1]); |
|
| 416 | + } elseif (isset($argv[$pos + 1])) { |
|
| 417 | + $this->dir = $argv[$pos + 1]; |
|
| 418 | + unset($argv[$pos + 1]); |
|
| 419 | 419 | } |
| 420 | 420 | unset($argv[$pos]); |
| 421 | 421 | // Make adjustments if '--load-from' points at a file. |
@@ -79,6 +79,9 @@ discard block |
||
| 79 | 79 | $this->dir = getcwd(); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | + /** |
|
| 83 | + * @param string $errorType |
|
| 84 | + */ |
|
| 82 | 85 | protected function errorCondition($msg, $errorType) |
| 83 | 86 | { |
| 84 | 87 | $this->errorConditions[$msg] = $errorType; |
@@ -126,7 +129,7 @@ discard block |
||
| 126 | 129 | } |
| 127 | 130 | |
| 128 | 131 | /** |
| 129 | - * @param array $argv |
|
| 132 | + * @param string[] $argv |
|
| 130 | 133 | * @param null|string $appName |
| 131 | 134 | * @param null|string $appVersion |
| 132 | 135 | * @param null|\Symfony\Component\Console\Output\OutputInterface $output |
@@ -147,6 +150,7 @@ discard block |
||
| 147 | 150 | |
| 148 | 151 | /** |
| 149 | 152 | * Get a list of locations where config files may be loaded |
| 153 | + * @param string $userConfig |
|
| 150 | 154 | * @return string[] |
| 151 | 155 | */ |
| 152 | 156 | protected function getConfigFilePaths($userConfig) |
@@ -162,7 +166,7 @@ discard block |
||
| 162 | 166 | * @param null|\Symfony\Component\Console\Input\InputInterface $input |
| 163 | 167 | * @param null|\Symfony\Component\Console\Output\OutputInterface $output |
| 164 | 168 | * @param null|\Robo\Application $app |
| 165 | - * @param array[] $commandFiles |
|
| 169 | + * @param null|string $commandFiles |
|
| 166 | 170 | * @param null|ClassLoader $classLoader |
| 167 | 171 | * |
| 168 | 172 | * @return int |
@@ -258,9 +262,9 @@ discard block |
||
| 258 | 262 | } |
| 259 | 263 | |
| 260 | 264 | /** |
| 261 | - * @param $relativeNamespace |
|
| 265 | + * @param string $relativeNamespace |
|
| 262 | 266 | * |
| 263 | - * @return array|string[] |
|
| 267 | + * @return string[] |
|
| 264 | 268 | */ |
| 265 | 269 | protected function discoverCommandClasses($relativeNamespace) |
| 266 | 270 | { |
@@ -348,6 +348,9 @@ |
||
| 348 | 348 | { |
| 349 | 349 | protected $message; |
| 350 | 350 | |
| 351 | + /** |
|
| 352 | + * @param string $message |
|
| 353 | + */ |
|
| 351 | 354 | public function __construct($message) |
| 352 | 355 | { |
| 353 | 356 | $this->message = $message; |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | namespace RoboExample\Robo\Plugin\Commands; |
| 3 | 3 | |
| 4 | 4 | use Robo\Result; |
| 5 | - |
|
| 6 | 5 | use Consolidation\AnnotatedCommand\CommandData; |
| 7 | 6 | use Consolidation\OutputFormatters\Options\FormatterOptions; |
| 8 | 7 | use Consolidation\OutputFormatters\StructuredData\RowsOfFields; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function tryWatch() |
| 31 | 31 | { |
| 32 | - $this->taskWatch()->monitor(['composer.json', 'composer.lock'], function () { |
|
| 32 | + $this->taskWatch()->monitor(['composer.json', 'composer.lock'], function() { |
|
| 33 | 33 | $this->taskComposerUpdate()->run(); |
| 34 | 34 | })->run(); |
| 35 | 35 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | $this->say('The <b>expression</b> <bogus>is</bogus> <info>a < b</> it even works'); |
| 43 | 43 | $answer = $this->ask('how are you?'); |
| 44 | - $this->say('You are '.$answer); |
|
| 44 | + $this->say('You are ' . $answer); |
|
| 45 | 45 | $yes = $this->confirm('Do you want one more question?'); |
| 46 | 46 | if (!$yes) { |
| 47 | 47 | return Result::cancelled(); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $lang = $this->askDefault('what is your favorite scripting language?', 'PHP'); |
| 50 | 50 | $this->say($lang); |
| 51 | 51 | $pin = $this->askHidden('Ok, now tell your PIN code (it is hidden)'); |
| 52 | - $this->yell('Ha-ha, your pin code is: '.$pin); |
|
| 52 | + $this->yell('Ha-ha, your pin code is: ' . $pin); |
|
| 53 | 53 | $this->say('Bye!'); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | // using yaml or json output formats. |
| 174 | 174 | $data->addRendererFunction( |
| 175 | 175 | // n.b. There is a fourth parameter $rowData that may be added here. |
| 176 | - function ($key, $cellData, FormatterOptions $options) { |
|
| 176 | + function($key, $cellData, FormatterOptions $options) { |
|
| 177 | 177 | if ($key == 'name') { |
| 178 | 178 | return "<info>$cellData</>"; |
| 179 | 179 | } |
@@ -203,10 +203,10 @@ discard block |
||
| 203 | 203 | public function tryFormatters($somthing = 'default', $options = ['format' => 'table', 'fields' => '']) |
| 204 | 204 | { |
| 205 | 205 | $outputData = [ |
| 206 | - 'en' => [ 'first' => 'One', 'second' => 'Two', 'third' => 'Three' ], |
|
| 207 | - 'de' => [ 'first' => 'Eins', 'second' => 'Zwei', 'third' => 'Drei' ], |
|
| 208 | - 'jp' => [ 'first' => 'Ichi', 'second' => 'Ni', 'third' => 'San' ], |
|
| 209 | - 'es' => [ 'first' => 'Uno', 'second' => 'Dos', 'third' => 'Tres' ], |
|
| 206 | + 'en' => ['first' => 'One', 'second' => 'Two', 'third' => 'Three'], |
|
| 207 | + 'de' => ['first' => 'Eins', 'second' => 'Zwei', 'third' => 'Drei'], |
|
| 208 | + 'jp' => ['first' => 'Ichi', 'second' => 'Ni', 'third' => 'San'], |
|
| 209 | + 'es' => ['first' => 'Uno', 'second' => 'Dos', 'third' => 'Tres'], |
|
| 210 | 210 | ]; |
| 211 | 211 | return new RowsOfFields($outputData); |
| 212 | 212 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | public function alterFormatters($result, CommandData $commandData) |
| 242 | 242 | { |
| 243 | 243 | if ($commandData->input()->getOption('french')) { |
| 244 | - $result['fr'] = [ 'first' => 'Un', 'second' => 'Deux', 'third' => 'Trois' ]; |
|
| 244 | + $result['fr'] = ['first' => 'Un', 'second' => 'Deux', 'third' => 'Trois']; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | return $result; |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | ->taskForEach($processList) |
| 397 | 397 | ->iterationMessage('Processing {value}') |
| 398 | 398 | ->call( |
| 399 | - function ($value) use($delay) { |
|
| 399 | + function($value) use($delay) { |
|
| 400 | 400 | // TaskForEach::call should only be used to do |
| 401 | 401 | // non-Robo operations. To use Robo tasks in an |
| 402 | 402 | // iterator, @see TaskForEach::withBuilder. |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | ->taskCleanDir($workdir) |
| 419 | 419 | ->taskForEach($processList) |
| 420 | 420 | ->withBuilder( |
| 421 | - function ($builder, $key, $value) use ($workdir) { |
|
| 421 | + function($builder, $key, $value) use ($workdir) { |
|
| 422 | 422 | return $builder |
| 423 | 423 | ->taskFilesystemStack() |
| 424 | 424 | ->mkdir("$workdir/$value"); |