@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | foreach ($paths as $path) { |
| 60 | 60 | if (preg_match('/\.php$/i', $path)) { |
| 61 | 61 | // Prevent variable leak into deploy.php file |
| 62 | - call_user_func(function () use ($path) { |
|
| 62 | + call_user_func(function() use ($path) { |
|
| 63 | 63 | // Reorder autoload stack |
| 64 | 64 | $originStack = spl_autoload_functions(); |
| 65 | 65 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | } elseif (preg_match('/\.ya?ml$/i', $path)) { |
| 77 | 77 | self::$recipeFilename = basename($path); |
| 78 | 78 | self::$recipeSource = file_get_contents($path, true); |
| 79 | - $root = array_filter(Yaml::parse(self::$recipeSource), static function (string $key) { |
|
| 79 | + $root = array_filter(Yaml::parse(self::$recipeSource), static function(string $key) { |
|
| 80 | 80 | return substr($key, 0, 1) !== '.'; |
| 81 | 81 | }, ARRAY_FILTER_USE_KEY); |
| 82 | 82 | |
@@ -131,17 +131,17 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | protected static function tasks(array $tasks) |
| 133 | 133 | { |
| 134 | - $buildTask = function ($name, $steps) { |
|
| 135 | - $body = function () {}; |
|
| 134 | + $buildTask = function($name, $steps) { |
|
| 135 | + $body = function() {}; |
|
| 136 | 136 | $task = task($name, $body); |
| 137 | 137 | |
| 138 | 138 | foreach ($steps as $step) { |
| 139 | - $buildStep = function ($step) use (&$body, $task) { |
|
| 139 | + $buildStep = function($step) use (&$body, $task) { |
|
| 140 | 140 | extract($step); |
| 141 | 141 | |
| 142 | 142 | if (isset($cd)) { |
| 143 | 143 | $prev = $body; |
| 144 | - $body = function () use ($cd, $prev) { |
|
| 144 | + $body = function() use ($cd, $prev) { |
|
| 145 | 145 | $prev(); |
| 146 | 146 | cd($cd); |
| 147 | 147 | }; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | if (isset($run)) { |
| 151 | 151 | $has = 'run'; |
| 152 | 152 | $prev = $body; |
| 153 | - $body = function () use ($run, $prev) { |
|
| 153 | + $body = function() use ($run, $prev) { |
|
| 154 | 154 | $prev(); |
| 155 | 155 | try { |
| 156 | 156 | run($run); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | $has = 'run_locally'; |
| 170 | 170 | $prev = $body; |
| 171 | - $body = function () use ($run_locally, $prev) { |
|
| 171 | + $body = function() use ($run_locally, $prev) { |
|
| 172 | 172 | $prev(); |
| 173 | 173 | try { |
| 174 | 174 | runLocally($run_locally); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | } |
| 187 | 187 | $has = 'upload'; |
| 188 | 188 | $prev = $body; |
| 189 | - $body = function () use ($upload, $prev) { |
|
| 189 | + $body = function() use ($upload, $prev) { |
|
| 190 | 190 | $prev(); |
| 191 | 191 | upload($upload['src'], $upload['dest']); |
| 192 | 192 | }; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | } |
| 199 | 199 | $has = 'download'; |
| 200 | 200 | $prev = $body; |
| 201 | - $body = function () use ($download, $prev) { |
|
| 201 | + $body = function() use ($download, $prev) { |
|
| 202 | 202 | $prev(); |
| 203 | 203 | download($download['src'], $download['dest']); |
| 204 | 204 | }; |
@@ -120,7 +120,7 @@ |
||
| 120 | 120 | |
| 121 | 121 | usort( |
| 122 | 122 | $updates, |
| 123 | - function (Update $a, Update $b) { |
|
| 123 | + function(Update $a, Update $b) { |
|
| 124 | 124 | return Comparator::isGreaterThan( |
| 125 | 125 | $a->getVersion(), |
| 126 | 126 | $b->getVersion(), |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | ->setTimeout((null === $config['timeout']) ? null : (float) $config['timeout']) |
| 89 | 89 | ->setIdleTimeout((null === $config['idle_timeout']) ? null : (float) $config['idle_timeout']); |
| 90 | 90 | |
| 91 | - $callback = function ($type, $buffer) use ($config, $host) { |
|
| 91 | + $callback = function($type, $buffer) use ($config, $host) { |
|
| 92 | 92 | $this->logger->printBuffer($host, $type, $buffer); |
| 93 | 93 | $this->pop->callback($host, boolval($config['real_time_output']))($type, $buffer); |
| 94 | 94 | }; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $dealersHand = []; |
| 81 | 81 | $playersHand = []; |
| 82 | 82 | shuffle($deck); |
| 83 | - $deal = function () use (&$deck, &$graveyard) { |
|
| 83 | + $deal = function() use (&$deck, &$graveyard) { |
|
| 84 | 84 | if (count($deck) == 0) { |
| 85 | 85 | shuffle($graveyard); |
| 86 | 86 | $deck = $graveyard; |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | } |
| 288 | 288 | $variants = [$value]; |
| 289 | 289 | while ($aces-- > 0) { |
| 290 | - $variants = array_flatten(array_map(function ($v) { |
|
| 290 | + $variants = array_flatten(array_map(function($v) { |
|
| 291 | 291 | return [$v + 1, $v + 11]; |
| 292 | 292 | }, $variants)); |
| 293 | 293 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | function array_flatten(array $array) |
| 20 | 20 | { |
| 21 | 21 | $flatten = []; |
| 22 | - array_walk_recursive($array, function ($value) use (&$flatten) { |
|
| 22 | + array_walk_recursive($array, function($value) use (&$flatten) { |
|
| 23 | 23 | $flatten[] = $value; |
| 24 | 24 | }); |
| 25 | 25 | return $flatten; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | function env_stringify(array $array): string |
| 89 | 89 | { |
| 90 | 90 | return implode(' ', array_map( |
| 91 | - function ($key, $value) { |
|
| 91 | + function($key, $value) { |
|
| 92 | 92 | return sprintf("%s=%s", $key, escapeshellarg((string) $value)); |
| 93 | 93 | }, |
| 94 | 94 | array_keys($array), |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | if (getenv('COLORTERM') === 'truecolor') { |
| 182 | - $hsv = function ($h, $s, $v) { |
|
| 182 | + $hsv = function($h, $s, $v) { |
|
| 183 | 183 | $r = $g = $b = $i = $f = $p = $q = $t = 0; |
| 184 | 184 | $i = floor($h * 6); |
| 185 | 185 | $f = $h * 6 - $i; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $labels = $host->get('labels', []); |
| 54 | 54 | $labels['alias'] = $host->getAlias(); |
| 55 | 55 | $labels['true'] = 'true'; |
| 56 | - $isTrue = function ($value) { |
|
| 56 | + $isTrue = function($value) { |
|
| 57 | 57 | return $value; |
| 58 | 58 | }; |
| 59 | 59 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | private static function compare(string $op, $a, ?string $b): bool |
| 76 | 76 | { |
| 77 | - $matchFunction = function ($a, ?string $b) { |
|
| 77 | + $matchFunction = function($a, ?string $b) { |
|
| 78 | 78 | foreach ((array) $a as $item) { |
| 79 | 79 | if ($item === $b) { |
| 80 | 80 | return true; |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | $this->loop, |
| 60 | 60 | new React\Http\Middleware\StreamingRequestMiddleware(), |
| 61 | 61 | new React\Http\Middleware\RequestBodyBufferMiddleware(16 * 1024 * 1024), // 16 MiB |
| 62 | - function (ServerRequestInterface $request) { |
|
| 62 | + function(ServerRequestInterface $request) { |
|
| 63 | 63 | try { |
| 64 | 64 | return $this->router($request); |
| 65 | 65 | } catch (Throwable $exception) { |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | return 0; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - $callback = function (string $output) { |
|
| 185 | + $callback = function(string $output) { |
|
| 186 | 186 | $output = preg_replace('/\n$/', '', $output); |
| 187 | 187 | if (strlen($output) !== 0) { |
| 188 | 188 | $this->output->writeln($output); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | /** @var Process[] $processes */ |
| 193 | 193 | $processes = []; |
| 194 | 194 | |
| 195 | - $this->server->loop->futureTick(function () use (&$processes, $hosts, $task) { |
|
| 195 | + $this->server->loop->futureTick(function() use (&$processes, $hosts, $task) { |
|
| 196 | 196 | foreach ($hosts as $host) { |
| 197 | 197 | $processes[] = $this->createProcess($host, $task); |
| 198 | 198 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | }); |
| 204 | 204 | |
| 205 | - $this->server->loop->addPeriodicTimer(0.03, function ($timer) use (&$processes, $callback) { |
|
| 205 | + $this->server->loop->addPeriodicTimer(0.03, function($timer) use (&$processes, $callback) { |
|
| 206 | 206 | $this->gatherOutput($processes, $callback); |
| 207 | 207 | if ($this->output->isDecorated() && !getenv('CI')) { |
| 208 | 208 | $this->output->write(spinner()); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | { |
| 52 | 52 | foreach ($this->recipes as $recipe) { |
| 53 | 53 | // $find will try to return DocConfig for a given config $name. |
| 54 | - $findConfig = function (string $name) use ($recipe): ?DocConfig { |
|
| 54 | + $findConfig = function(string $name) use ($recipe): ?DocConfig { |
|
| 55 | 55 | if (array_key_exists($name, $recipe->config)) { |
| 56 | 56 | return $recipe->config[$name]; |
| 57 | 57 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | return null; |
| 71 | 71 | }; |
| 72 | - $findConfigOverride = function (DocRecipe $recipe, string $name) use (&$findConfigOverride): ?DocConfig { |
|
| 72 | + $findConfigOverride = function(DocRecipe $recipe, string $name) use (&$findConfigOverride): ?DocConfig { |
|
| 73 | 73 | foreach ($recipe->require as $r) { |
| 74 | 74 | if (array_key_exists($r, $this->recipes)) { |
| 75 | 75 | if (array_key_exists($name, $this->recipes[$r]->config)) { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | return null; |
| 86 | 86 | }; |
| 87 | 87 | // Replace all {{name}} with link to correct config declaration. |
| 88 | - $replaceLinks = function (string $comment) use ($findConfig): string { |
|
| 88 | + $replaceLinks = function(string $comment) use ($findConfig): string { |
|
| 89 | 89 | $output = ''; |
| 90 | 90 | $code = false; |
| 91 | 91 | foreach (explode("\n", $comment) as $i => $line) { |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $output .= "\n"; |
| 98 | 98 | continue; |
| 99 | 99 | } |
| 100 | - $output .= preg_replace_callback('#(\{\{(?<name>[\w_:\-/]+)\}\})#', function ($m) use ($findConfig) { |
|
| 100 | + $output .= preg_replace_callback('#(\{\{(?<name>[\w_:\-/]+)\}\})#', function($m) use ($findConfig) { |
|
| 101 | 101 | $name = $m['name']; |
| 102 | 102 | $config = $findConfig($name); |
| 103 | 103 | if ($config !== null) { |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | return $output; |
| 113 | 113 | }; |
| 114 | - $findTask = function (string $name, bool $searchOtherRecipes = true) use ($recipe): ?DocTask { |
|
| 114 | + $findTask = function(string $name, bool $searchOtherRecipes = true) use ($recipe): ?DocTask { |
|
| 115 | 115 | if (array_key_exists($name, $recipe->tasks)) { |
| 116 | 116 | return $recipe->tasks[$name]; |
| 117 | 117 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | MARKDOWN; |
| 172 | 172 | |
| 173 | - $map = function (DocTask $task, $ident = '') use (&$map, $findTask, &$intro): void { |
|
| 173 | + $map = function(DocTask $task, $ident = '') use (&$map, $findTask, &$intro): void { |
|
| 174 | 174 | foreach ($task->group as $taskName) { |
| 175 | 175 | $t = $findTask($taskName); |
| 176 | 176 | if ($t !== null) { |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | |
| 357 | 357 | function indent(string $text): string |
| 358 | 358 | { |
| 359 | - return implode("\n", array_map(function ($line) { |
|
| 359 | + return implode("\n", array_map(function($line) { |
|
| 360 | 360 | return " " . $line; |
| 361 | 361 | }, explode("\n", $text))); |
| 362 | 362 | } |