@@ -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; |
@@ -1,8 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | use Robo\Result; |
| 3 | 3 | use Robo\ResultData; |
| 4 | -use Robo\Collection\CollectionBuilder; |
|
| 5 | - |
|
| 6 | 4 | use Consolidation\OutputFormatters\StructuredData\RowsOfFields; |
| 7 | 5 | |
| 8 | 6 | /** |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class RoboFile extends \Robo\Tasks |
| 17 | 17 | { |
| 18 | - /** |
|
| 18 | + /** |
|
| 19 | 19 | * Watch a file. |
| 20 | 20 | * |
| 21 | 21 | * Demonstrates the 'watch' command. Runs 'composer update' any time |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function tryWatch() |
| 25 | 25 | { |
| 26 | - $this->taskWatch()->monitor(['composer.json', 'composer.lock'], function () { |
|
| 26 | + $this->taskWatch()->monitor(['composer.json', 'composer.lock'], function() { |
|
| 27 | 27 | $this->taskComposerUpdate()->run(); |
| 28 | 28 | })->run(); |
| 29 | 29 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | public function tryInput() |
| 35 | 35 | { |
| 36 | 36 | $answer = $this->ask('how are you?'); |
| 37 | - $this->say('You are '.$answer); |
|
| 37 | + $this->say('You are ' . $answer); |
|
| 38 | 38 | $yes = $this->confirm('Do you want one more question?'); |
| 39 | 39 | if (!$yes) { |
| 40 | 40 | return Result::cancelled(); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $lang = $this->askDefault('what is your favorite scripting language?', 'PHP'); |
| 43 | 43 | $this->say($lang); |
| 44 | 44 | $pin = $this->askHidden('Ok, now tell your PIN code (it is hidden)'); |
| 45 | - $this->yell('Ha-ha, your pin code is: '.$pin); |
|
| 45 | + $this->yell('Ha-ha, your pin code is: ' . $pin); |
|
| 46 | 46 | $this->say('Bye!'); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -154,10 +154,10 @@ discard block |
||
| 154 | 154 | public function tryFormatters($options = ['format' => 'table', 'fields' => '']) |
| 155 | 155 | { |
| 156 | 156 | $outputData = [ |
| 157 | - [ 'first' => 'One', 'second' => 'Two', 'third' => 'Three' ], |
|
| 158 | - [ 'first' => 'Eins', 'second' => 'Zwei', 'third' => 'Drei' ], |
|
| 159 | - [ 'first' => 'Ichi', 'second' => 'Ni', 'third' => 'San' ], |
|
| 160 | - [ 'first' => 'Uno', 'second' => 'Dos', 'third' => 'Tres' ], |
|
| 157 | + ['first' => 'One', 'second' => 'Two', 'third' => 'Three'], |
|
| 158 | + ['first' => 'Eins', 'second' => 'Zwei', 'third' => 'Drei'], |
|
| 159 | + ['first' => 'Ichi', 'second' => 'Ni', 'third' => 'San'], |
|
| 160 | + ['first' => 'Uno', 'second' => 'Dos', 'third' => 'Tres'], |
|
| 161 | 161 | ]; |
| 162 | 162 | // Note that we can also simply return the output data array here. |
| 163 | 163 | return ResultData::message(new RowsOfFields($outputData)); |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | ->taskForEach($processList) |
| 313 | 313 | ->iterationMessage('Processing {value}') |
| 314 | 314 | ->call( |
| 315 | - function ($value) use($delay) { |
|
| 315 | + function($value) use($delay) { |
|
| 316 | 316 | // TaskForEach::call should only be used to do |
| 317 | 317 | // non-Robo operations. To use Robo tasks in an |
| 318 | 318 | // iterator, @see TaskForEach::withBuilder. |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | ->taskCleanDir($workdir) |
| 335 | 335 | ->taskForEach($processList) |
| 336 | 336 | ->withBuilder( |
| 337 | - function ($builder, $key, $value) use ($workdir) { |
|
| 337 | + function($builder, $key, $value) use ($workdir) { |
|
| 338 | 338 | return $builder |
| 339 | 339 | ->taskFilesystemStack() |
| 340 | 340 | ->mkdir("$workdir/$value"); |
@@ -1,7 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | use Symfony\Component\Finder\Finder; |
| 3 | -use Robo\Result; |
|
| 4 | -use Robo\Collection\CollectionBuilder; |
|
| 5 | 3 | |
| 6 | 4 | class RoboFile extends \Robo\Tasks |
| 7 | 5 | { |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | return $taskCodecept->run(); |
| 28 | - } |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * Code sniffer. |
@@ -128,12 +128,12 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | if (empty($version)) { |
| 130 | 130 | $versionParts = explode('.', \Robo\Robo::VERSION); |
| 131 | - $versionParts[count($versionParts)-1]++; |
|
| 131 | + $versionParts[count($versionParts) - 1]++; |
|
| 132 | 132 | $version = implode('.', $versionParts); |
| 133 | 133 | } |
| 134 | - return $this->taskReplaceInFile(__DIR__.'/src/Robo.php') |
|
| 135 | - ->from("VERSION = '".\Robo\Robo::VERSION."'") |
|
| 136 | - ->to("VERSION = '".$version."'") |
|
| 134 | + return $this->taskReplaceInFile(__DIR__ . '/src/Robo.php') |
|
| 135 | + ->from("VERSION = '" . \Robo\Robo::VERSION . "'") |
|
| 136 | + ->to("VERSION = '" . $version . "'") |
|
| 137 | 137 | ->run(); |
| 138 | 138 | } |
| 139 | 139 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | foreach ($docs as $ns => $tasks) { |
| 167 | 167 | $taskGenerator = $collection->taskGenDoc("docs/tasks/$ns.md"); |
| 168 | - $taskGenerator->filterClasses(function (\ReflectionClass $r) { |
|
| 168 | + $taskGenerator->filterClasses(function(\ReflectionClass $r) { |
|
| 169 | 169 | return !($r->isAbstract() || $r->isTrait()) && $r->implementsInterface('Robo\Contract\TaskInterface'); |
| 170 | 170 | })->prepend("# $ns Tasks"); |
| 171 | 171 | sort($tasks); |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | $taskGenerator->filterMethods( |
| 177 | - function (\ReflectionMethod $m) { |
|
| 177 | + function(\ReflectionMethod $m) { |
|
| 178 | 178 | if ($m->isConstructor() || $m->isDestructor() || $m->isStatic()) { |
| 179 | 179 | return false; |
| 180 | 180 | } |
@@ -200,21 +200,21 @@ discard block |
||
| 200 | 200 | return !in_array($m->name, $undocumentedMethods) && $m->isPublic(); // methods are not documented |
| 201 | 201 | } |
| 202 | 202 | )->processClassSignature( |
| 203 | - function ($c) { |
|
| 203 | + function($c) { |
|
| 204 | 204 | return "## " . preg_replace('~Task$~', '', $c->getShortName()) . "\n"; |
| 205 | 205 | } |
| 206 | 206 | )->processClassDocBlock( |
| 207 | - function (\ReflectionClass $c, $doc) { |
|
| 207 | + function(\ReflectionClass $c, $doc) { |
|
| 208 | 208 | $doc = preg_replace('~@method .*?(.*?)\)~', '* `$1)` ', $doc); |
| 209 | - $doc = str_replace('\\'.$c->name, '', $doc); |
|
| 209 | + $doc = str_replace('\\' . $c->name, '', $doc); |
|
| 210 | 210 | return $doc; |
| 211 | 211 | } |
| 212 | 212 | )->processMethodSignature( |
| 213 | - function (\ReflectionMethod $m, $text) { |
|
| 213 | + function(\ReflectionMethod $m, $text) { |
|
| 214 | 214 | return str_replace('#### *public* ', '* `', $text) . '`'; |
| 215 | 215 | } |
| 216 | 216 | )->processMethodDocBlock( |
| 217 | - function (\ReflectionMethod $m, $text) { |
|
| 217 | + function(\ReflectionMethod $m, $text) { |
|
| 218 | 218 | |
| 219 | 219 | return $text ? ' ' . trim(strtok($text, "\n"), "\n") : ''; |
| 220 | 220 | } |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | */ |
| 324 | 324 | protected function devDependenciesToRemoveFromPhar() |
| 325 | 325 | { |
| 326 | - $composerInfo = (array) json_decode(file_get_contents(__DIR__ . '/composer.json')); |
|
| 326 | + $composerInfo = (array)json_decode(file_get_contents(__DIR__ . '/composer.json')); |
|
| 327 | 327 | |
| 328 | 328 | $devDependencies = array_keys((array)$composerInfo['require-dev']); |
| 329 | 329 | $suggestedProjects = array_keys((array)$composerInfo['suggest']); |
@@ -92,7 +92,9 @@ discard block |
||
| 92 | 92 | ->push() |
| 93 | 93 | ->run(); |
| 94 | 94 | |
| 95 | - if ($stable) $this->pharPublish(); |
|
| 95 | + if ($stable) { |
|
| 96 | + $this->pharPublish(); |
|
| 97 | + } |
|
| 96 | 98 | $this->publish(); |
| 97 | 99 | |
| 98 | 100 | $this->taskGitStack() |
@@ -100,7 +102,9 @@ discard block |
||
| 100 | 102 | ->push('origin master --tags') |
| 101 | 103 | ->run(); |
| 102 | 104 | |
| 103 | - if ($stable) $this->versionBump(); |
|
| 105 | + if ($stable) { |
|
| 106 | + $this->versionBump(); |
|
| 107 | + } |
|
| 104 | 108 | } |
| 105 | 109 | |
| 106 | 110 | /** |
@@ -171,6 +171,8 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | /** |
| 173 | 173 | * Add either a 'before' or 'after' function or task. |
| 174 | + * @param string $method |
|
| 175 | + * @param integer $nameOfTaskToAdd |
|
| 174 | 176 | */ |
| 175 | 177 | protected function addBeforeOrAfter($method, $name, $task, $nameOfTaskToAdd) |
| 176 | 178 | { |
@@ -276,6 +278,7 @@ discard block |
||
| 276 | 278 | |
| 277 | 279 | /** |
| 278 | 280 | * Add the provided task to our task list. |
| 281 | + * @param integer $name |
|
| 279 | 282 | */ |
| 280 | 283 | protected function addToTaskList($name, TaskInterface $task) |
| 281 | 284 | { |
@@ -548,6 +551,9 @@ discard block |
||
| 548 | 551 | return $taskResult; |
| 549 | 552 | } |
| 550 | 553 | |
| 554 | + /** |
|
| 555 | + * @param CollectionInterface $parentCollection |
|
| 556 | + */ |
|
| 551 | 557 | protected function setParentCollectionForTask($task, $parentCollection) |
| 552 | 558 | { |
| 553 | 559 | if ($task instanceof NestedCollectionInterface) { |
@@ -11,9 +11,6 @@ |
||
| 11 | 11 | use Robo\Exception\TaskException; |
| 12 | 12 | use Robo\Exception\TaskExitException; |
| 13 | 13 | use Robo\Contract\CommandInterface; |
| 14 | - |
|
| 15 | - |
|
| 16 | -use Robo\Common\ProgressIndicatorAwareTrait; |
|
| 17 | 14 | use Robo\Contract\InflectionInterface; |
| 18 | 15 | |
| 19 | 16 | /** |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | $collection = $this; |
| 109 | 109 | $completionRegistrationTask = new CallableTask( |
| 110 | - function () use ($collection, $completionTask) { |
|
| 110 | + function() use ($collection, $completionTask) { |
|
| 111 | 111 | |
| 112 | 112 | $collection->registerCompletion($completionTask); |
| 113 | 113 | }, |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $context += ['name' => 'Progress']; |
| 151 | 151 | $context += TaskInfo::getTaskContext($this); |
| 152 | 152 | return $this->addCode( |
| 153 | - function () use ($level, $text, $context) { |
|
| 153 | + function() use ($level, $text, $context) { |
|
| 154 | 154 | $this->printTaskOutput($level, $text, $context); |
| 155 | 155 | } |
| 156 | 156 | ); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | { |
| 161 | 161 | $collection = $this; |
| 162 | 162 | $rollbackRegistrationTask = new CallableTask( |
| 163 | - function () use ($collection, $rollbackTask) { |
|
| 163 | + function() use ($collection, $rollbackTask) { |
|
| 164 | 164 | $collection->registerRollback($rollbackTask); |
| 165 | 165 | }, |
| 166 | 166 | $this |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | if ($task instanceof StackBasedTask) { |
| 203 | 203 | $task->stopOnFail(false); |
| 204 | 204 | } |
| 205 | - $ignoreErrorsInTask = function () use ($task) { |
|
| 205 | + $ignoreErrorsInTask = function() use ($task) { |
|
| 206 | 206 | $data = []; |
| 207 | 207 | try { |
| 208 | 208 | $result = $this->runSubtask($task); |
@@ -205,7 +205,7 @@ |
||
| 205 | 205 | |
| 206 | 206 | /** |
| 207 | 207 | * Create a new builder with its own task collection |
| 208 | - * @return type |
|
| 208 | + * @return CollectionBuilder |
|
| 209 | 209 | */ |
| 210 | 210 | public function newBuilder() |
| 211 | 211 | { |
@@ -2,7 +2,6 @@ discard block |
||
| 2 | 2 | namespace Robo\Collection; |
| 3 | 3 | |
| 4 | 4 | use Robo\Config; |
| 5 | -use Robo\Common\Timer; |
|
| 6 | 5 | use Psr\Log\LogLevel; |
| 7 | 6 | use Robo\Contract\TaskInterface; |
| 8 | 7 | use Robo\Contract\CompletionInterface; |
@@ -12,13 +11,10 @@ discard block |
||
| 12 | 11 | use Robo\Task\Simulator; |
| 13 | 12 | use Robo\Collection\CompletionWrapper; |
| 14 | 13 | use Robo\Collection\Temporary; |
| 15 | -use Robo\Contract\ConfigAwareInterface; |
|
| 16 | -use Robo\Common\ConfigAwareTrait; |
|
| 17 | 14 | use ReflectionClass; |
| 18 | 15 | use Robo\Task\BaseTask; |
| 19 | 16 | use Robo\Contract\BuilderAwareInterface; |
| 20 | 17 | use Robo\Contract\CommandInterface; |
| 21 | -use Robo\Exception\TaskException; |
|
| 22 | 18 | |
| 23 | 19 | /** |
| 24 | 20 | * Creates a collection, and adds tasks to it. The collection builder |
@@ -2,8 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Robo\Collection; |
| 4 | 4 | |
| 5 | -use Robo\Contract\TaskInterface; |
|
| 6 | - |
|
| 7 | 5 | /** |
| 8 | 6 | * The temporary collection keeps track of the global collection of |
| 9 | 7 | * temporary cleanup tasks in instances where temporary-generating |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | { |
| 37 | 37 | if (!static::$collection) { |
| 38 | 38 | static::$collection = \Robo\Robo::getContainer()->get('collection'); |
| 39 | - register_shutdown_function(function () { |
|
| 39 | + register_shutdown_function(function() { |
|
| 40 | 40 | static::complete(); |
| 41 | 41 | }); |
| 42 | 42 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * Pass argument to executable. Its value will be automatically escaped. |
| 15 | 15 | * |
| 16 | - * @param $arg |
|
| 16 | + * @param string $arg |
|
| 17 | 17 | * @return $this |
| 18 | 18 | */ |
| 19 | 19 | public function arg($arg) |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * Pass multiple options to executable. Value can be a string or array. |
| 87 | 87 | * Option values are automatically escaped. |
| 88 | 88 | * |
| 89 | - * @param $option |
|
| 89 | + * @param string $option |
|
| 90 | 90 | * @param string|array $value |
| 91 | 91 | * @return $this |
| 92 | 92 | */ |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | $args = func_get_args(); |
| 35 | 35 | } |
| 36 | 36 | array_map('static::escape', $args); |
| 37 | - $this->arguments .= " ".implode(' ', $args); |
|
| 37 | + $this->arguments .= " " . implode(' ', $args); |
|
| 38 | 38 | return $this; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | * |
| 43 | 43 | * @param string $resource File or folder. |
| 44 | 44 | * @param string $type "file", "dir", "fileAndDir" |
| 45 | - * @return boolean |
|
| 45 | + * @return boolean|null |
|
| 46 | 46 | */ |
| 47 | 47 | protected function checkResource($resource, $type) |
| 48 | 48 | { |
@@ -89,23 +89,23 @@ |
||
| 89 | 89 | $this->checkResources($targets); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Wrapper method around phps is_dir() |
|
| 94 | - * |
|
| 95 | - * @param string $directory |
|
| 96 | - * @return boolean |
|
| 97 | - */ |
|
| 92 | + /** |
|
| 93 | + * Wrapper method around phps is_dir() |
|
| 94 | + * |
|
| 95 | + * @param string $directory |
|
| 96 | + * @return boolean |
|
| 97 | + */ |
|
| 98 | 98 | protected function isDir($directory) |
| 99 | 99 | { |
| 100 | 100 | return is_dir($directory); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - /** |
|
| 104 | - * Wrapper method around phps file_exists() |
|
| 105 | - * |
|
| 106 | - * @param string $file |
|
| 107 | - * @return boolean |
|
| 108 | - */ |
|
| 103 | + /** |
|
| 104 | + * Wrapper method around phps file_exists() |
|
| 105 | + * |
|
| 106 | + * @param string $file |
|
| 107 | + * @return boolean |
|
| 108 | + */ |
|
| 109 | 109 | protected function isFile($file) |
| 110 | 110 | { |
| 111 | 111 | return file_exists($file); |
@@ -85,6 +85,7 @@ discard block |
||
| 85 | 85 | * execution can continue. |
| 86 | 86 | * |
| 87 | 87 | * Warning messages are displayed at VERBOSITY_NORMAL. |
| 88 | + * @param string $text |
|
| 88 | 89 | */ |
| 89 | 90 | protected function printTaskWarning($text, $context = null) |
| 90 | 91 | { |
@@ -96,6 +97,7 @@ discard block |
||
| 96 | 97 | * and the task cannot continue. |
| 97 | 98 | * |
| 98 | 99 | * Error messages are displayed at VERBOSITY_NORMAL. |
| 100 | + * @param string $text |
|
| 99 | 101 | */ |
| 100 | 102 | protected function printTaskError($text, $context = null) |
| 101 | 103 | { |
@@ -148,6 +150,7 @@ discard block |
||
| 148 | 150 | |
| 149 | 151 | /** |
| 150 | 152 | * Format a quantity of bytes. |
| 153 | + * @param integer $size |
|
| 151 | 154 | */ |
| 152 | 155 | protected function formatBytes($size, $precision = 2) |
| 153 | 156 | { |
@@ -6,7 +6,6 @@ |
||
| 6 | 6 | use Consolidation\Log\ConsoleLogLevel; |
| 7 | 7 | use Robo\Common\ConfigAwareTrait; |
| 8 | 8 | use Psr\Log\LoggerAwareTrait; |
| 9 | -use Psr\Log\LoggerInterface; |
|
| 10 | 9 | use Psr\Log\LogLevel; |
| 11 | 10 | use Robo\Contract\ProgressIndicatorAwareInterface; |
| 12 | 11 | |
@@ -81,6 +81,9 @@ |
||
| 81 | 81 | return false; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | + /** |
|
| 85 | + * @param string $message |
|
| 86 | + */ |
|
| 84 | 87 | protected function printMessage($level, $message, $context = []) |
| 85 | 88 | { |
| 86 | 89 | $inProgress = $this->hideProgressIndicator(); |
@@ -2,13 +2,10 @@ |
||
| 2 | 2 | namespace Robo\Log; |
| 3 | 3 | |
| 4 | 4 | use Robo\Result; |
| 5 | -use Robo\TaskInfo; |
|
| 6 | 5 | use Robo\Contract\PrintedInterface; |
| 7 | 6 | use Robo\Contract\ProgressIndicatorAwareInterface; |
| 8 | 7 | use Robo\Common\ProgressIndicatorAwareTrait; |
| 9 | - |
|
| 10 | 8 | use Psr\Log\LogLevel; |
| 11 | -use Psr\Log\LoggerInterface; |
|
| 12 | 9 | use Psr\Log\LoggerAwareInterface; |
| 13 | 10 | use Psr\Log\LoggerAwareTrait; |
| 14 | 11 | use Consolidation\Log\ConsoleLogLevel; |