@@ -36,13 +36,13 @@ |
||
36 | 36 | */ |
37 | 37 | function craft($command, $options = []) |
38 | 38 | { |
39 | - return function () use ($command, $options) { |
|
40 | - if (! test('[ -s {{release_path}}/.env ]')) { |
|
39 | + return function() use ($command, $options) { |
|
40 | + if (!test('[ -s {{release_path}}/.env ]')) { |
|
41 | 41 | throw new \Exception('Your .env file is empty! Cannot proceed.'); |
42 | 42 | } |
43 | 43 | |
44 | 44 | // By default we don't want any command to be interactive |
45 | - if (! in_array('interactive', $options)) { |
|
45 | + if (!in_array('interactive', $options)) { |
|
46 | 46 | $command .= ' --interactive=0'; |
47 | 47 | } |
48 | 48 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | // Update using: `set('static_content_jobs', '1');` |
65 | 65 | set('static_content_jobs', '1'); |
66 | 66 | |
67 | -set('content_version', function () { |
|
67 | +set('content_version', function() { |
|
68 | 68 | return time(); |
69 | 69 | }); |
70 | 70 | |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | |
110 | 110 | set('bin/magento', '{{release_or_current_path}}/{{magento_dir}}/bin/magento'); |
111 | 111 | |
112 | -set('magento_version', function () { |
|
112 | +set('magento_version', function() { |
|
113 | 113 | // detect version |
114 | 114 | $versionOutput = run('{{bin/php}} {{bin/magento}} --version'); |
115 | 115 | preg_match('/(\d+\.?)+(-p\d+)?$/', $versionOutput, $matches); |
116 | 116 | return $matches[0] ?? '2.0'; |
117 | 117 | }); |
118 | 118 | |
119 | -set('config_import_needed', function () { |
|
119 | +set('config_import_needed', function() { |
|
120 | 120 | // detect if app:config:import is needed |
121 | 121 | try { |
122 | 122 | run('{{bin/php}} {{bin/magento}} app:config:status'); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | return false; |
131 | 131 | }); |
132 | 132 | |
133 | -set('database_upgrade_needed', function () { |
|
133 | +set('database_upgrade_needed', function() { |
|
134 | 134 | // detect if setup:upgrade is needed |
135 | 135 | try { |
136 | 136 | run('{{bin/php}} {{bin/magento}} setup:db:status'); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | // 'MAGE_MODE' => 'production' |
166 | 166 | // ``` |
167 | 167 | desc('Compiles magento di'); |
168 | -task('magento:compile', function () { |
|
168 | +task('magento:compile', function() { |
|
169 | 169 | run("{{bin/php}} {{bin/magento}} setup:di:compile"); |
170 | 170 | run('cd {{release_or_current_path}}/{{magento_dir}} && {{bin/composer}} dump-autoload -o'); |
171 | 171 | }); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | // ] |
192 | 192 | // ``` |
193 | 193 | desc('Deploys assets'); |
194 | -task('magento:deploy:assets', function () { |
|
194 | +task('magento:deploy:assets', function() { |
|
195 | 195 | $themesToCompile = ''; |
196 | 196 | if (get('split_static_deployment')) { |
197 | 197 | invoke('magento:deploy:assets:adminhtml'); |
@@ -208,12 +208,12 @@ discard block |
||
208 | 208 | }); |
209 | 209 | |
210 | 210 | desc('Deploys assets for backend only'); |
211 | -task('magento:deploy:assets:adminhtml', function () { |
|
211 | +task('magento:deploy:assets:adminhtml', function() { |
|
212 | 212 | magentoDeployAssetsSplit('backend'); |
213 | 213 | }); |
214 | 214 | |
215 | 215 | desc('Deploys assets for frontend only'); |
216 | -task('magento:deploy:assets:frontend', function () { |
|
216 | +task('magento:deploy:assets:frontend', function() { |
|
217 | 217 | magentoDeployAssetsSplit('frontend'); |
218 | 218 | }); |
219 | 219 | |
@@ -261,9 +261,9 @@ discard block |
||
261 | 261 | } |
262 | 262 | |
263 | 263 | desc('Syncs content version'); |
264 | -task('magento:sync:content_version', function () { |
|
264 | +task('magento:sync:content_version', function() { |
|
265 | 265 | $timestamp = time(); |
266 | - on(select('all'), function (Host $host) use ($timestamp) { |
|
266 | + on(select('all'), function(Host $host) use ($timestamp) { |
|
267 | 267 | $host->set('content_version', $timestamp); |
268 | 268 | }); |
269 | 269 | })->once(); |
@@ -271,26 +271,25 @@ discard block |
||
271 | 271 | before('magento:deploy:assets', 'magento:sync:content_version'); |
272 | 272 | |
273 | 273 | desc('Enables maintenance mode'); |
274 | -task('magento:maintenance:enable', function () { |
|
274 | +task('magento:maintenance:enable', function() { |
|
275 | 275 | // do not use {{bin/magento}} because it would be in "release" but the maintenance mode must be set in "current" |
276 | 276 | run("if [ -d $(echo {{current_path}}) ]; then {{bin/php}} {{current_path}}/{{magento_dir}}/bin/magento maintenance:enable; fi"); |
277 | 277 | }); |
278 | 278 | |
279 | 279 | desc('Disables maintenance mode'); |
280 | -task('magento:maintenance:disable', function () { |
|
280 | +task('magento:maintenance:disable', function() { |
|
281 | 281 | // do not use {{bin/magento}} because it would be in "release" but the maintenance mode must be set in "current" |
282 | 282 | run("if [ -d $(echo {{current_path}}) ]; then {{bin/php}} {{current_path}}/{{magento_dir}}/bin/magento maintenance:disable; fi"); |
283 | 283 | }); |
284 | 284 | |
285 | 285 | desc('Set maintenance mode if needed'); |
286 | -task('magento:maintenance:enable-if-needed', function () { |
|
287 | - ! get('enable_zerodowntime') || get('database_upgrade_needed') || get('config_import_needed') ? |
|
288 | - invoke('magento:maintenance:enable') : |
|
289 | - writeln('Config and database up to date => no maintenance mode'); |
|
286 | +task('magento:maintenance:enable-if-needed', function() { |
|
287 | + !get('enable_zerodowntime') || get('database_upgrade_needed') || get('config_import_needed') ? |
|
288 | + invoke('magento:maintenance:enable') : writeln('Config and database up to date => no maintenance mode'); |
|
290 | 289 | }); |
291 | 290 | |
292 | 291 | desc('Config Import'); |
293 | -task('magento:config:import', function () { |
|
292 | +task('magento:config:import', function() { |
|
294 | 293 | if (get('config_import_needed')) { |
295 | 294 | run('{{bin/php}} {{bin/magento}} app:config:import --no-interaction'); |
296 | 295 | } else { |
@@ -299,7 +298,7 @@ discard block |
||
299 | 298 | }); |
300 | 299 | |
301 | 300 | desc('Upgrades magento database'); |
302 | -task('magento:upgrade:db', function () { |
|
301 | +task('magento:upgrade:db', function() { |
|
303 | 302 | if (get('database_upgrade_needed')) { |
304 | 303 | run("{{bin/php}} {{bin/magento}} setup:db-schema:upgrade --no-interaction"); |
305 | 304 | run("{{bin/php}} {{bin/magento}} setup:db-data:upgrade --no-interaction"); |
@@ -309,7 +308,7 @@ discard block |
||
309 | 308 | })->once(); |
310 | 309 | |
311 | 310 | desc('Flushes Magento Cache'); |
312 | -task('magento:cache:flush', function () { |
|
311 | +task('magento:cache:flush', function() { |
|
313 | 312 | run("{{bin/php}} {{bin/magento}} cache:flush"); |
314 | 313 | }); |
315 | 314 | |
@@ -360,7 +359,7 @@ discard block |
||
360 | 359 | set('repository', null); |
361 | 360 | |
362 | 361 | // The relative path to the artifact file. If the directory does not exist, it will be created |
363 | -set('artifact_path', function () { |
|
362 | +set('artifact_path', function() { |
|
364 | 363 | if (!testLocally('[ -d {{artifact_dir}} ]')) { |
365 | 364 | runLocally('mkdir -p {{artifact_dir}}'); |
366 | 365 | } |
@@ -368,7 +367,7 @@ discard block |
||
368 | 367 | }); |
369 | 368 | |
370 | 369 | // The location of the tar command. On MacOS you should have installed gtar, as it supports the required settings |
371 | -set('bin/tar', function () { |
|
370 | +set('bin/tar', function() { |
|
372 | 371 | if (commandExist('gtar')) { |
373 | 372 | return which('gtar'); |
374 | 373 | } else { |
@@ -379,7 +378,7 @@ discard block |
||
379 | 378 | // tasks section |
380 | 379 | |
381 | 380 | desc('Packages all relevant files in an artifact.'); |
382 | -task('artifact:package', function () { |
|
381 | +task('artifact:package', function() { |
|
383 | 382 | if (!test('[ -f {{artifact_excludes_file}} ]')) { |
384 | 383 | throw new GracefulShutdownException( |
385 | 384 | "No artifact excludes file provided, provide one at artifacts/excludes or change location", |
@@ -389,23 +388,23 @@ discard block |
||
389 | 388 | }); |
390 | 389 | |
391 | 390 | desc('Uploads artifact in release folder for extraction.'); |
392 | -task('artifact:upload', function () { |
|
391 | +task('artifact:upload', function() { |
|
393 | 392 | upload(get('artifact_path'), '{{release_path}}'); |
394 | 393 | }); |
395 | 394 | |
396 | 395 | desc('Extracts artifact in release path.'); |
397 | -task('artifact:extract', function () { |
|
396 | +task('artifact:extract', function() { |
|
398 | 397 | run('{{bin/tar}} -xzpf {{release_path}}/{{artifact_file}} -C {{release_path}}'); |
399 | 398 | run('rm -rf {{release_path}}/{{artifact_file}}'); |
400 | 399 | }); |
401 | 400 | |
402 | 401 | desc('Clears generated files prior to building.'); |
403 | -task('build:remove-generated', function () { |
|
402 | +task('build:remove-generated', function() { |
|
404 | 403 | run('rm -rf generated/*'); |
405 | 404 | }); |
406 | 405 | |
407 | 406 | desc('Prepare local artifact build'); |
408 | -task('build:prepare', function () { |
|
407 | +task('build:prepare', function() { |
|
409 | 408 | if (!currentHost()->get('local')) { |
410 | 409 | throw new GracefulShutdownException('Artifact can only be built locally, you provided a non local host'); |
411 | 410 | } |
@@ -446,7 +445,7 @@ discard block |
||
446 | 445 | |
447 | 446 | |
448 | 447 | desc('Adds additional files and dirs to the list of shared files and dirs'); |
449 | -task('deploy:additional-shared', function () { |
|
448 | +task('deploy:additional-shared', function() { |
|
450 | 449 | add('shared_files', get('additional_shared_files')); |
451 | 450 | add('shared_dirs', get('additional_shared_dirs')); |
452 | 451 | }); |
@@ -461,7 +460,7 @@ discard block |
||
461 | 460 | * ``` |
462 | 461 | **/ |
463 | 462 | desc('Update cache id_prefix'); |
464 | -task('magento:set_cache_prefix', function () { |
|
463 | +task('magento:set_cache_prefix', function() { |
|
465 | 464 | //download current env config |
466 | 465 | $tmpConfigFile = tempnam(sys_get_temp_dir(), 'deployer_config'); |
467 | 466 | download('{{deploy_path}}/shared/' . ENV_CONFIG_FILE_PATH, $tmpConfigFile); |
@@ -501,7 +500,7 @@ discard block |
||
501 | 500 | * After successful deployment, move the tmp_env.php file to env.php ready for next deployment |
502 | 501 | */ |
503 | 502 | desc('Cleanup cache id_prefix env files'); |
504 | -task('magento:cleanup_cache_prefix', function () { |
|
503 | +task('magento:cleanup_cache_prefix', function() { |
|
505 | 504 | run('rm {{deploy_path}}/shared/' . ENV_CONFIG_FILE_PATH); |
506 | 505 | run('rm {{release_or_current_path}}/' . ENV_CONFIG_FILE_PATH); |
507 | 506 | run('mv {{deploy_path}}/shared/' . TMP_ENV_CONFIG_FILE_PATH . ' {{deploy_path}}/shared/' . ENV_CONFIG_FILE_PATH); |
@@ -517,7 +516,7 @@ discard block |
||
517 | 516 | * ``` |
518 | 517 | */ |
519 | 518 | desc('Remove cron from crontab and kill running cron jobs'); |
520 | -task('magento:cron:stop', function () { |
|
519 | +task('magento:cron:stop', function() { |
|
521 | 520 | if (has('previous_release')) { |
522 | 521 | run('{{bin/php}} {{previous_release}}/{{magento_dir}}/bin/magento cron:remove'); |
523 | 522 | } |
@@ -533,7 +532,7 @@ discard block |
||
533 | 532 | * ``` |
534 | 533 | */ |
535 | 534 | desc('Install cron in crontab'); |
536 | -task('magento:cron:install', function () { |
|
535 | +task('magento:cron:install', function() { |
|
537 | 536 | run('cd {{release_or_current_path}}'); |
538 | 537 | run('{{bin/php}} {{bin/magento}} cron:install'); |
539 | 538 | }); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | public function testTask() |
72 | 72 | { |
73 | - task('task', function () {}); |
|
73 | + task('task', function() {}); |
|
74 | 74 | |
75 | 75 | $task = $this->deployer->tasks->get('task'); |
76 | 76 | self::assertInstanceOf(Task::class, $task); |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | |
86 | 86 | public function testBefore() |
87 | 87 | { |
88 | - task('main', function () {}); |
|
89 | - task('before', function () {}); |
|
88 | + task('main', function() {}); |
|
89 | + task('before', function() {}); |
|
90 | 90 | before('main', 'before'); |
91 | - before('before', function () {}); |
|
91 | + before('before', function() {}); |
|
92 | 92 | |
93 | 93 | $names = $this->taskToNames($this->deployer->scriptManager->getTasks('main')); |
94 | 94 | self::assertEquals(['before:before', 'before', 'main'], $names); |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | |
97 | 97 | public function testAfter() |
98 | 98 | { |
99 | - task('main', function () {}); |
|
100 | - task('after', function () {}); |
|
99 | + task('main', function() {}); |
|
100 | + task('after', function() {}); |
|
101 | 101 | after('main', 'after'); |
102 | - after('after', function () {}); |
|
102 | + after('after', function() {}); |
|
103 | 103 | |
104 | 104 | $names = $this->taskToNames($this->deployer->scriptManager->getTasks('main')); |
105 | 105 | self::assertEquals(['main', 'after', 'after:after'], $names); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | { |
131 | 131 | Context::get()->getConfig()->set('working_path', '/foo'); |
132 | 132 | |
133 | - within('/bar', function () { |
|
133 | + within('/bar', function() { |
|
134 | 134 | $withinWorkingPath = Context::get()->getConfig()->get('working_path'); |
135 | 135 | self::assertEquals('/bar', $withinWorkingPath); |
136 | 136 | }); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | Context::get()->getConfig()->set('working_path', '/foo'); |
145 | 145 | |
146 | 146 | try { |
147 | - within('/bar', function () { |
|
147 | + within('/bar', function() { |
|
148 | 148 | throw new \Exception('Dummy exception'); |
149 | 149 | }); |
150 | 150 | } catch (\Exception $exception) { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | public function testWithinReturningValue() |
159 | 159 | { |
160 | - $output = within('/foo', function () { |
|
160 | + $output = within('/foo', function() { |
|
161 | 161 | return 'bar'; |
162 | 162 | }); |
163 | 163 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | public function testWithinWithVoidFunction() |
168 | 168 | { |
169 | - $output = within('/foo', function () { |
|
169 | + $output = within('/foo', function() { |
|
170 | 170 | // noop |
171 | 171 | }); |
172 | 172 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | private function taskToNames($tasks) |
177 | 177 | { |
178 | - return array_map(function (Task $task) { |
|
178 | + return array_map(function(Task $task) { |
|
179 | 179 | return $task->getName(); |
180 | 180 | }, $tasks); |
181 | 181 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function testWithClosure() |
33 | 33 | { |
34 | 34 | $pimple = new Container(); |
35 | - $pimple['service'] = function () { |
|
35 | + $pimple['service'] = function() { |
|
36 | 36 | return new Service(); |
37 | 37 | }; |
38 | 38 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | public function testServicesShouldBeDifferent() |
43 | 43 | { |
44 | 44 | $pimple = new Container(); |
45 | - $pimple['service'] = $pimple->factory(function () { |
|
45 | + $pimple['service'] = $pimple->factory(function() { |
|
46 | 46 | return new Service(); |
47 | 47 | }); |
48 | 48 | |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | public function testShouldPassContainerAsParameter() |
59 | 59 | { |
60 | 60 | $pimple = new Container(); |
61 | - $pimple['service'] = function () { |
|
61 | + $pimple['service'] = function() { |
|
62 | 62 | return new Service(); |
63 | 63 | }; |
64 | - $pimple['container'] = function ($container) { |
|
64 | + $pimple['container'] = function($container) { |
|
65 | 65 | return $container; |
66 | 66 | }; |
67 | 67 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | $pimple = new Container(); |
75 | 75 | $pimple['param'] = 'value'; |
76 | - $pimple['service'] = function () { |
|
76 | + $pimple['service'] = function() { |
|
77 | 77 | return new Service(); |
78 | 78 | }; |
79 | 79 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | { |
126 | 126 | $pimple = new Container(); |
127 | 127 | $pimple['param'] = 'value'; |
128 | - $pimple['service'] = function () { |
|
128 | + $pimple['service'] = function() { |
|
129 | 129 | return new Service(); |
130 | 130 | }; |
131 | 131 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | public function testRaw() |
173 | 173 | { |
174 | 174 | $pimple = new Container(); |
175 | - $pimple['service'] = $definition = $pimple->factory(function () { |
|
175 | + $pimple['service'] = $definition = $pimple->factory(function() { |
|
176 | 176 | return 'foo'; |
177 | 177 | }); |
178 | 178 | $this->assertSame($definition, $pimple->raw('service')); |
@@ -212,10 +212,10 @@ discard block |
||
212 | 212 | public function testExtend($service) |
213 | 213 | { |
214 | 214 | $pimple = new Container(); |
215 | - $pimple['shared_service'] = function () { |
|
215 | + $pimple['shared_service'] = function() { |
|
216 | 216 | return new Service(); |
217 | 217 | }; |
218 | - $pimple['factory_service'] = $pimple->factory(function () { |
|
218 | + $pimple['factory_service'] = $pimple->factory(function() { |
|
219 | 219 | return new Service(); |
220 | 220 | }); |
221 | 221 | |
@@ -243,10 +243,10 @@ discard block |
||
243 | 243 | } |
244 | 244 | $pimple = new Container(); |
245 | 245 | |
246 | - $pimple['foo'] = $pimple->factory(function () { |
|
246 | + $pimple['foo'] = $pimple->factory(function() { |
|
247 | 247 | return; |
248 | 248 | }); |
249 | - $pimple['foo'] = $pimple->extend('foo', function ($foo, $pimple) { |
|
249 | + $pimple['foo'] = $pimple->extend('foo', function($foo, $pimple) { |
|
250 | 250 | return; |
251 | 251 | }); |
252 | 252 | unset($pimple['foo']); |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $this->expectExceptionMessage('Identifier "foo" is not defined.'); |
267 | 267 | |
268 | 268 | $pimple = new Container(); |
269 | - $pimple->extend('foo', function () {}); |
|
269 | + $pimple->extend('foo', function() {}); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $this->expectExceptionMessage('Identifier "foo" is not defined.'); |
279 | 279 | |
280 | 280 | $pimple = new Container(); |
281 | - $pimple->extend('foo', function () {}); |
|
281 | + $pimple->extend('foo', function() {}); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | public function testKeys() |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | |
361 | 361 | $pimple = new Container(); |
362 | 362 | $pimple['foo'] = $service; |
363 | - $pimple->extend('foo', function () {}); |
|
363 | + $pimple->extend('foo', function() {}); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | /** |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | |
375 | 375 | $pimple = new Container(); |
376 | 376 | $pimple['foo'] = $service; |
377 | - $pimple->extend('foo', function () {}); |
|
377 | + $pimple->extend('foo', function() {}); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | /** |
@@ -384,11 +384,11 @@ discard block |
||
384 | 384 | public function testExtendingProtectedClosureDeprecation() |
385 | 385 | { |
386 | 386 | $pimple = new Container(); |
387 | - $pimple['foo'] = $pimple->protect(function () { |
|
387 | + $pimple['foo'] = $pimple->protect(function() { |
|
388 | 388 | return 'bar'; |
389 | 389 | }); |
390 | 390 | |
391 | - $pimple->extend('foo', function ($value) { |
|
391 | + $pimple->extend('foo', function($value) { |
|
392 | 392 | return $value . '-baz'; |
393 | 393 | }); |
394 | 394 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | { |
403 | 403 | $this->expectException(\TypeError::class); |
404 | 404 | $pimple = new Container(); |
405 | - $pimple['foo'] = function () {}; |
|
405 | + $pimple['foo'] = function() {}; |
|
406 | 406 | $pimple->extend('foo', $service); |
407 | 407 | } |
408 | 408 | |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | { |
415 | 415 | $this->expectException(\TypeError::class); |
416 | 416 | $pimple = new Container(); |
417 | - $pimple['foo'] = function () {}; |
|
417 | + $pimple['foo'] = function() {}; |
|
418 | 418 | $pimple->extend('foo', $service); |
419 | 419 | } |
420 | 420 | |
@@ -424,12 +424,12 @@ discard block |
||
424 | 424 | $this->expectExceptionMessage('Cannot override frozen service "foo".'); |
425 | 425 | |
426 | 426 | $pimple = new Container(); |
427 | - $pimple['foo'] = function () { |
|
427 | + $pimple['foo'] = function() { |
|
428 | 428 | return new NonInvokable(); |
429 | 429 | }; |
430 | 430 | $foo = $pimple['foo']; |
431 | 431 | |
432 | - $pimple->extend('foo', function () {}); |
|
432 | + $pimple->extend('foo', function() {}); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | public function testExtendFailsIfFrozenServiceIsInvokable() |
@@ -438,12 +438,12 @@ discard block |
||
438 | 438 | $this->expectExceptionMessage('Cannot override frozen service "foo".'); |
439 | 439 | |
440 | 440 | $pimple = new Container(); |
441 | - $pimple['foo'] = function () { |
|
441 | + $pimple['foo'] = function() { |
|
442 | 442 | return new Invokable(); |
443 | 443 | }; |
444 | 444 | $foo = $pimple['foo']; |
445 | 445 | |
446 | - $pimple->extend('foo', function () {}); |
|
446 | + $pimple->extend('foo', function() {}); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | public static function serviceDefinitionProvider() |
464 | 464 | { |
465 | 465 | return [ |
466 | - [function ($value) { |
|
466 | + [function($value) { |
|
467 | 467 | $service = new Service(); |
468 | 468 | $service->value = $value; |
469 | 469 | |
@@ -476,12 +476,12 @@ discard block |
||
476 | 476 | public function testDefiningNewServiceAfterFreeze() |
477 | 477 | { |
478 | 478 | $pimple = new Container(); |
479 | - $pimple['foo'] = function () { |
|
479 | + $pimple['foo'] = function() { |
|
480 | 480 | return 'foo'; |
481 | 481 | }; |
482 | 482 | $foo = $pimple['foo']; |
483 | 483 | |
484 | - $pimple['bar'] = function () { |
|
484 | + $pimple['bar'] = function() { |
|
485 | 485 | return 'bar'; |
486 | 486 | }; |
487 | 487 | $this->assertSame('bar', $pimple['bar']); |
@@ -493,12 +493,12 @@ discard block |
||
493 | 493 | $this->expectExceptionMessage('Cannot override frozen service "foo".'); |
494 | 494 | |
495 | 495 | $pimple = new Container(); |
496 | - $pimple['foo'] = function () { |
|
496 | + $pimple['foo'] = function() { |
|
497 | 497 | return 'foo'; |
498 | 498 | }; |
499 | 499 | $foo = $pimple['foo']; |
500 | 500 | |
501 | - $pimple['foo'] = function () { |
|
501 | + $pimple['foo'] = function() { |
|
502 | 502 | return 'bar'; |
503 | 503 | }; |
504 | 504 | } |
@@ -512,12 +512,12 @@ discard block |
||
512 | 512 | $this->expectExceptionMessage('Cannot override frozen service "foo".'); |
513 | 513 | |
514 | 514 | $pimple = new Container(); |
515 | - $pimple['foo'] = function () { |
|
515 | + $pimple['foo'] = function() { |
|
516 | 516 | return 'foo'; |
517 | 517 | }; |
518 | 518 | $foo = $pimple['foo']; |
519 | 519 | |
520 | - $pimple['foo'] = function () { |
|
520 | + $pimple['foo'] = function() { |
|
521 | 521 | return 'bar'; |
522 | 522 | }; |
523 | 523 | } |
@@ -525,13 +525,13 @@ discard block |
||
525 | 525 | public function testRemovingServiceAfterFreeze() |
526 | 526 | { |
527 | 527 | $pimple = new Container(); |
528 | - $pimple['foo'] = function () { |
|
528 | + $pimple['foo'] = function() { |
|
529 | 529 | return 'foo'; |
530 | 530 | }; |
531 | 531 | $foo = $pimple['foo']; |
532 | 532 | |
533 | 533 | unset($pimple['foo']); |
534 | - $pimple['foo'] = function () { |
|
534 | + $pimple['foo'] = function() { |
|
535 | 535 | return 'bar'; |
536 | 536 | }; |
537 | 537 | $this->assertSame('bar', $pimple['foo']); |
@@ -540,13 +540,13 @@ discard block |
||
540 | 540 | public function testExtendingService() |
541 | 541 | { |
542 | 542 | $pimple = new Container(); |
543 | - $pimple['foo'] = function () { |
|
543 | + $pimple['foo'] = function() { |
|
544 | 544 | return 'foo'; |
545 | 545 | }; |
546 | - $pimple['foo'] = $pimple->extend('foo', function ($foo, $app) { |
|
546 | + $pimple['foo'] = $pimple->extend('foo', function($foo, $app) { |
|
547 | 547 | return "$foo.bar"; |
548 | 548 | }); |
549 | - $pimple['foo'] = $pimple->extend('foo', function ($foo, $app) { |
|
549 | + $pimple['foo'] = $pimple->extend('foo', function($foo, $app) { |
|
550 | 550 | return "$foo.baz"; |
551 | 551 | }); |
552 | 552 | $this->assertSame('foo.bar.baz', $pimple['foo']); |
@@ -555,15 +555,15 @@ discard block |
||
555 | 555 | public function testExtendingServiceAfterOtherServiceFreeze() |
556 | 556 | { |
557 | 557 | $pimple = new Container(); |
558 | - $pimple['foo'] = function () { |
|
558 | + $pimple['foo'] = function() { |
|
559 | 559 | return 'foo'; |
560 | 560 | }; |
561 | - $pimple['bar'] = function () { |
|
561 | + $pimple['bar'] = function() { |
|
562 | 562 | return 'bar'; |
563 | 563 | }; |
564 | 564 | $foo = $pimple['foo']; |
565 | 565 | |
566 | - $pimple['bar'] = $pimple->extend('bar', function ($bar, $app) { |
|
566 | + $pimple['bar'] = $pimple->extend('bar', function($bar, $app) { |
|
567 | 567 | return "$bar.baz"; |
568 | 568 | }); |
569 | 569 | $this->assertSame('bar.baz', $pimple['bar']); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | ]); |
28 | 28 | |
29 | 29 | // Mock vendors installation to speed up tests. |
30 | -task('deploy:vendors', function () { |
|
30 | +task('deploy:vendors', function() { |
|
31 | 31 | if (!commandExist('unzip')) { |
32 | 32 | warning('To speed up composer installation setup "unzip" command with PHP zip extension.'); |
33 | 33 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | 'deploy:publish', |
41 | 41 | ]); |
42 | 42 | |
43 | -task('fail', function () { |
|
43 | +task('fail', function() { |
|
44 | 44 | run('false'); |
45 | 45 | }); |
46 | 46 |
@@ -4,13 +4,13 @@ discard block |
||
4 | 4 | |
5 | 5 | localhost('prod'); |
6 | 6 | localhost('beta') |
7 | - ->set('host_level_callback_config', function () { |
|
7 | + ->set('host_level_callback_config', function() { |
|
8 | 8 | return 'from callback'; |
9 | 9 | }); |
10 | 10 | |
11 | 11 | // testServer: |
12 | 12 | |
13 | -task('ask', function () { |
|
13 | +task('ask', function() { |
|
14 | 14 | $answer = ask('Question: What kind of bear is best?'); |
15 | 15 | writeln($answer); |
16 | 16 | }); |
@@ -19,23 +19,23 @@ discard block |
||
19 | 19 | |
20 | 20 | set('greet', '_'); |
21 | 21 | |
22 | -task('echo', function () { |
|
22 | +task('echo', function() { |
|
23 | 23 | $alias = currentHost()->getAlias(); |
24 | 24 | run("echo {{greet}}, $alias!"); |
25 | 25 | }); |
26 | 26 | |
27 | 27 | // testCachedHostConfig: |
28 | 28 | |
29 | -set('upper_host', function () { |
|
29 | +set('upper_host', function() { |
|
30 | 30 | writeln('running ' . (Deployer::isWorker() ? 'worker' : 'master') . ' on ' . currentHost()->getAlias()); |
31 | 31 | return strtoupper(currentHost()->getAlias()); |
32 | 32 | }); |
33 | 33 | |
34 | -task('cache_config_test', function () { |
|
34 | +task('cache_config_test', function() { |
|
35 | 35 | writeln('echo 1: {{upper_host}}'); |
36 | 36 | }); |
37 | 37 | |
38 | -after('cache_config_test', function () { |
|
38 | +after('cache_config_test', function() { |
|
39 | 39 | writeln('echo 2: {{upper_host}}'); |
40 | 40 | }); |
41 | 41 | |
@@ -43,6 +43,6 @@ discard block |
||
43 | 43 | |
44 | 44 | set('host_level_callback_config', 'from global'); |
45 | 45 | |
46 | -task('host_config_from_callback', function () { |
|
46 | +task('host_config_from_callback', function() { |
|
47 | 47 | writeln('config value is {{host_level_callback_config}}'); |
48 | 48 | }); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | set('rsync_src', __DIR__); |
137 | 137 | set('rsync_dest', '{{release_path}}'); |
138 | 138 | |
139 | -set('rsync_excludes', function () { |
|
139 | +set('rsync_excludes', function() { |
|
140 | 140 | $config = get('rsync'); |
141 | 141 | $excludes = $config['exclude']; |
142 | 142 | $excludeFile = $config['exclude-file']; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | return $excludesRsync; |
152 | 152 | }); |
153 | 153 | |
154 | -set('rsync_includes', function () { |
|
154 | +set('rsync_includes', function() { |
|
155 | 155 | $config = get('rsync'); |
156 | 156 | $includes = $config['include']; |
157 | 157 | $includeFile = $config['include-file']; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | return $includesRsync; |
167 | 167 | }); |
168 | 168 | |
169 | -set('rsync_filter', function () { |
|
169 | +set('rsync_filter', function() { |
|
170 | 170 | $config = get('rsync'); |
171 | 171 | $filters = $config['filter']; |
172 | 172 | $filterFile = $config['filter-file']; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | return $filtersRsync; |
185 | 185 | }); |
186 | 186 | |
187 | -set('rsync_options', function () { |
|
187 | +set('rsync_options', function() { |
|
188 | 188 | $config = get('rsync'); |
189 | 189 | $options = $config['options']; |
190 | 190 | $optionsRsync = []; |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | |
198 | 198 | desc('Warmups remote Rsync target'); |
199 | -task('rsync:warmup', function () { |
|
199 | +task('rsync:warmup', function() { |
|
200 | 200 | $config = get('rsync'); |
201 | 201 | |
202 | 202 | $source = "{{current_path}}"; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | |
212 | 212 | |
213 | 213 | desc('Rsync local->remote'); |
214 | -task('rsync', function () { |
|
214 | +task('rsync', function() { |
|
215 | 215 | $config = get('rsync'); |
216 | 216 | |
217 | 217 | $src = get('rsync_src'); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | return $stopResponseInfo['http_code'] === 200; |
132 | 132 | } |
133 | 133 | |
134 | -task('supervisord-monitor:restart', function () { |
|
134 | +task('supervisord-monitor:restart', function() { |
|
135 | 135 | if (supervisordIsAuthenticated()) { |
136 | 136 | $names = explode(',', get('supervisord_process_name')); |
137 | 137 | foreach ($names as $name) { |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | }); |
150 | 150 | |
151 | -task('supervisord-monitor:stop', function () { |
|
151 | +task('supervisord-monitor:stop', function() { |
|
152 | 152 | if (supervisordIsAuthenticated()) { |
153 | 153 | $names = explode(',', get('supervisord_process_name')); |
154 | 154 | foreach ($names as $name) { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | }); |
164 | 164 | |
165 | -task('supervisord-monitor:start', function () { |
|
165 | +task('supervisord-monitor:start', function() { |
|
166 | 166 | if (supervisordIsAuthenticated()) { |
167 | 167 | $names = explode(',', get('supervisord_process_name')); |
168 | 168 | foreach ($names as $name) { |
@@ -55,7 +55,7 @@ |
||
55 | 55 | use PhpAmqpLib\Message\AMQPMessage; |
56 | 56 | |
57 | 57 | desc('Notifies RabbitMQ channel about deployment'); |
58 | -task('deploy:rabbit', function () { |
|
58 | +task('deploy:rabbit', function() { |
|
59 | 59 | |
60 | 60 | if (!class_exists('PhpAmqpLib\Connection\AMQPConnection')) { |
61 | 61 | throw new \RuntimeException("<comment>Please install php package</comment> <info>videlalvaro/php-amqplib</info> <comment>to use rabbitmq</comment>"); |