@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | |
34 | 34 | $collection = $this->collectionBuilder(); |
35 | 35 | $taskGenerator = $collection->taskGenDoc("TestedRoboTask.md"); |
36 | - $taskGenerator->filterClasses(function (\ReflectionClass $r) { |
|
36 | + $taskGenerator->filterClasses(function(\ReflectionClass $r) { |
|
37 | 37 | return !($r->isAbstract() || $r->isTrait()) && $r->implementsInterface('Robo\Contract\TaskInterface'); |
38 | 38 | })->prepend("# TestedRoboTask Tasks"); |
39 | 39 | $taskGenerator->docClass('TestedRoboTask'); |
40 | 40 | |
41 | 41 | $taskGenerator->filterMethods( |
42 | - function (\ReflectionMethod $m) { |
|
42 | + function(\ReflectionMethod $m) { |
|
43 | 43 | if ($m->isConstructor() || $m->isDestructor() || $m->isStatic()) { |
44 | 44 | return false; |
45 | 45 | } |
@@ -65,21 +65,21 @@ discard block |
||
65 | 65 | return !in_array($m->name, $undocumentedMethods) && $m->isPublic(); // methods are not documented |
66 | 66 | } |
67 | 67 | )->processClassSignature( |
68 | - function ($c) { |
|
68 | + function($c) { |
|
69 | 69 | return "## " . preg_replace('~Task$~', '', $c->getShortName()) . "\n"; |
70 | 70 | } |
71 | 71 | )->processClassDocBlock( |
72 | - function (\ReflectionClass $c, $doc) { |
|
72 | + function(\ReflectionClass $c, $doc) { |
|
73 | 73 | $doc = preg_replace('~@method .*?(.*?)\)~', '* `$1)` ', $doc); |
74 | - $doc = str_replace('\\'.$c->name, '', $doc); |
|
74 | + $doc = str_replace('\\' . $c->name, '', $doc); |
|
75 | 75 | return $doc; |
76 | 76 | } |
77 | 77 | )->processMethodSignature( |
78 | - function (\ReflectionMethod $m, $text) { |
|
78 | + function(\ReflectionMethod $m, $text) { |
|
79 | 79 | return str_replace('#### *public* ', '* `', $text) . '`'; |
80 | 80 | } |
81 | 81 | )->processMethodDocBlock( |
82 | - function (\ReflectionMethod $m, $text) { |
|
82 | + function(\ReflectionMethod $m, $text) { |
|
83 | 83 | |
84 | 84 | return $text ? ' ' . trim(strtok($text, "\n"), "\n") : ''; |
85 | 85 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $task = $this->taskExec('env | wc -l')->interactive(false); |
69 | 69 | $result = $task->run(); |
70 | 70 | $this->assertTrue($result->wasSuccessful()); |
71 | - $start_count = (int) $result->getMessage(); |
|
71 | + $start_count = (int)$result->getMessage(); |
|
72 | 72 | $this->assertGreaterThan(0, $start_count); |
73 | 73 | |
74 | 74 | // Verify that we get the same amount of environment variables with |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $this->assertTrue($result->wasSuccessful()); |
79 | 79 | $this->assertEquals( |
80 | 80 | $start_count, |
81 | - (int) $result->getMessage()); |
|
81 | + (int)$result->getMessage()); |
|
82 | 82 | |
83 | 83 | // Now run the same command, but this time add another environment |
84 | 84 | // variable, and see if our count increases by one. |
@@ -86,6 +86,6 @@ discard block |
||
86 | 86 | $task->env('FOO', 'BAR'); |
87 | 87 | $result = $task->run(); |
88 | 88 | $this->assertTrue($result->wasSuccessful()); |
89 | - $this->assertEquals($start_count + 1, (int) $result->getMessage()); |
|
89 | + $this->assertEquals($start_count + 1, (int)$result->getMessage()); |
|
90 | 90 | } |
91 | 91 | } |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | // set iterable in the __constructor |
60 | 60 | $result = $this |
61 | 61 | ->taskForEach($items) |
62 | - ->withBuilder(function (CollectionBuilder $builder, $key, $value) use (&$actual) { |
|
63 | - $builder->addCode(function () use ($key, $value, &$actual) { |
|
62 | + ->withBuilder(function(CollectionBuilder $builder, $key, $value) use (&$actual) { |
|
63 | + $builder->addCode(function() use ($key, $value, &$actual) { |
|
64 | 64 | $actual[] = "$key = $value"; |
65 | 65 | |
66 | 66 | return 0; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | // set iterable with deferTaskConfiguration() |
83 | 83 | $result = $this |
84 | 84 | ->collectionBuilder() |
85 | - ->addCode(function (Data $data) use ($items) { |
|
85 | + ->addCode(function(Data $data) use ($items) { |
|
86 | 86 | $data['items'] = $items; |
87 | 87 | |
88 | 88 | return 0; |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | $this |
92 | 92 | ->taskForEach() |
93 | 93 | ->deferTaskConfiguration('setIterable', 'items') |
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[] = "$key = $value"; |
97 | 97 | |
98 | 98 | return 0; |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | // call the __constructor() without argument |
112 | 112 | $result = $this |
113 | 113 | ->taskForEach() |
114 | - ->withBuilder(function (CollectionBuilder $builder, $key, $value) use (&$actual) { |
|
115 | - $builder->addCode(function () use ($key, $value, &$actual) { |
|
114 | + ->withBuilder(function(CollectionBuilder $builder, $key, $value) use (&$actual) { |
|
115 | + $builder->addCode(function() use ($key, $value, &$actual) { |
|
116 | 116 | $actual++; |
117 | 117 | |
118 | 118 | return 0; |
@@ -41,7 +41,7 @@ |
||
41 | 41 | public function testPackExtract($archiveType) |
42 | 42 | { |
43 | 43 | if ((version_compare(PHP_VERSION, '7.4.0') >= 0) && (getenv('TRAVIS'))) { |
44 | - $this->markTestSkipped('Zip libraries apparently not available on Travis CI with PHP 7.4 image.'); |
|
44 | + $this->markTestSkipped('Zip libraries apparently not available on Travis CI with PHP 7.4 image.'); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | // Archive directory and then extract it again with Archive and Extract tasks |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | { |
28 | 28 | // write lines with WriteToFile task |
29 | 29 | $result = $this->taskWriteToFile('blogpost.md') |
30 | - ->line('****') |
|
31 | - ->line('hello world') |
|
32 | - ->line('****') |
|
33 | - ->run(); |
|
30 | + ->line('****') |
|
31 | + ->line('hello world') |
|
32 | + ->line('****') |
|
33 | + ->run(); |
|
34 | 34 | $this->assertTrue($result->wasSuccessful(), $result->getMessage()); |
35 | 35 | $this->assertFileExists('blogpost.md'); |
36 | 36 | $contents = file_get_contents('blogpost.md'); |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | public function appendToFile() |
47 | 47 | { |
48 | 48 | $result = $this->taskWriteToFile('a.txt') |
49 | - ->append() |
|
50 | - ->line('hello world') |
|
51 | - ->run(); |
|
49 | + ->append() |
|
50 | + ->line('hello world') |
|
51 | + ->run(); |
|
52 | 52 | $this->assertTrue($result->wasSuccessful(), $result->getMessage()); |
53 | 53 | $this->assertFileExists('a.txt'); |
54 | 54 | $contents = file_get_contents('a.txt'); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | public function testWouldChange() |
63 | 63 | { |
64 | 64 | $writeTask = $this->taskWriteToFile('a.txt') |
65 | - ->append(); |
|
65 | + ->append(); |
|
66 | 66 | $this->assertEquals(false, $writeTask->wouldChange(), "No changes to test file."); |
67 | 67 | $writeTask->line('hello world'); |
68 | 68 | $this->assertEquals(true, $writeTask->wouldChange(), "Test file would change."); |
@@ -90,15 +90,15 @@ discard block |
||
90 | 90 | { |
91 | 91 | // append lines with WriteToFile task, but only if pattern does not match |
92 | 92 | $result = $this->taskWriteToFile('blogpost.md') |
93 | - ->line('****') |
|
94 | - ->line('hello world') |
|
95 | - ->line('****') |
|
96 | - ->appendUnlessMatches('/hello/', 'Should not add this') |
|
97 | - ->appendUnlessMatches('/goodbye/', 'Should add this') |
|
98 | - ->appendIfMatches('/hello/', ' and should also add this') |
|
99 | - ->appendIfMatches('/goodbye/', ' but should not add this') |
|
100 | - ->appendIfMatches('/should/', '!') |
|
101 | - ->run(); |
|
93 | + ->line('****') |
|
94 | + ->line('hello world') |
|
95 | + ->line('****') |
|
96 | + ->appendUnlessMatches('/hello/', 'Should not add this') |
|
97 | + ->appendUnlessMatches('/goodbye/', 'Should add this') |
|
98 | + ->appendIfMatches('/hello/', ' and should also add this') |
|
99 | + ->appendIfMatches('/goodbye/', ' but should not add this') |
|
100 | + ->appendIfMatches('/should/', '!') |
|
101 | + ->run(); |
|
102 | 102 | $this->assertTrue($result->wasSuccessful(), $result->getMessage()); |
103 | 103 | $this->assertFileExists('blogpost.md'); |
104 | 104 | $contents = file_get_contents('blogpost.md'); |
@@ -44,7 +44,7 @@ |
||
44 | 44 | $this->fixtures->createAndCdToSandbox(); |
45 | 45 | |
46 | 46 | $result = $this->taskFlattenDir('some/deeply/nested/*.re') |
47 | - ->includeParents([1,1]) |
|
47 | + ->includeParents([1, 1]) |
|
48 | 48 | ->parentDir('some') |
49 | 49 | ->to('flattened') |
50 | 50 | ->run(); |
@@ -20,8 +20,8 @@ |
||
20 | 20 | $result = $this->taskGenTask('Symfony\Component\Filesystem\Filesystem', 'FilesystemStack')->run(); |
21 | 21 | $this->assertTrue($result->wasSuccessful(), $result->getMessage()); |
22 | 22 | $this->assertContains( |
23 | - 'protected function _chgrp($files, $group, $recursive = false)', |
|
24 | - $result->getMessage()); |
|
23 | + 'protected function _chgrp($files, $group, $recursive = false)', |
|
24 | + $result->getMessage()); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | } |
@@ -25,29 +25,29 @@ |
||
25 | 25 | public function testCssMinification() |
26 | 26 | { |
27 | 27 | if (version_compare(PHP_VERSION, '7.2.0') >= 0) { |
28 | - $this->markTestSkipped('natxet/cssmin uses deprecated "each()" function (PHP 7.2+)'); |
|
28 | + $this->markTestSkipped('natxet/cssmin uses deprecated "each()" function (PHP 7.2+)'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | $this->fixtures->createAndCdToSandbox(); |
32 | 32 | |
33 | - $sampleCss = $this->fixtures->dataFile('sample.css'); |
|
34 | - $outputCss = 'minifiedSample.css'; |
|
33 | + $sampleCss = $this->fixtures->dataFile('sample.css'); |
|
34 | + $outputCss = 'minifiedSample.css'; |
|
35 | 35 | |
36 | - $initialFileSize = filesize($sampleCss); |
|
36 | + $initialFileSize = filesize($sampleCss); |
|
37 | 37 | |
38 | - $result = $this->taskMinify($sampleCss) |
|
39 | - ->to('minifiedSample.css') |
|
40 | - ->run(); |
|
38 | + $result = $this->taskMinify($sampleCss) |
|
39 | + ->to('minifiedSample.css') |
|
40 | + ->run(); |
|
41 | 41 | $this->assertTrue($result->wasSuccessful(), $result->getMessage()); |
42 | 42 | |
43 | - $this->assertFileExists($outputCss); |
|
44 | - $minifiedFileSize = filesize($outputCss); |
|
45 | - $outputCssContents = file_get_contents($outputCss); |
|
43 | + $this->assertFileExists($outputCss); |
|
44 | + $minifiedFileSize = filesize($outputCss); |
|
45 | + $outputCssContents = file_get_contents($outputCss); |
|
46 | 46 | |
47 | - $this->assertLessThan($initialFileSize, $minifiedFileSize, 'Minified file is smaller than the source file'); |
|
48 | - $this->assertGreaterThan(0, $minifiedFileSize, 'Minified file is not empty'); |
|
49 | - $this->assertContains('body', $outputCssContents, 'Minified file has some content from the source file'); |
|
50 | - $this->assertNotContains('Sample css file', $outputCssContents, 'Minified file does not contain comment from source file'); |
|
47 | + $this->assertLessThan($initialFileSize, $minifiedFileSize, 'Minified file is smaller than the source file'); |
|
48 | + $this->assertGreaterThan(0, $minifiedFileSize, 'Minified file is not empty'); |
|
49 | + $this->assertContains('body', $outputCssContents, 'Minified file has some content from the source file'); |
|
50 | + $this->assertNotContains('Sample css file', $outputCssContents, 'Minified file does not contain comment from source file'); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | ->rollback( |
162 | 162 | $this->taskDeleteDir('j') |
163 | 163 | ) |
164 | - ->rollbackCode(function () { |
|
164 | + ->rollbackCode(function() { |
|
165 | 165 | throw new AbortTasksException('Aborting rollback.'); |
166 | 166 | }) |
167 | 167 | ->taskFilesystemStack() |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | ->mkdir('stuff') |
221 | 221 | ->taskForEach($processList) |
222 | 222 | ->withBuilder( |
223 | - function ($builder, $key, $value) { |
|
223 | + function($builder, $key, $value) { |
|
224 | 224 | return $builder |
225 | 225 | ->taskFilesystemStack() |
226 | 226 | ->touch("stuff/{$value}.txt"); |
@@ -277,32 +277,32 @@ discard block |
||
277 | 277 | |
278 | 278 | public function testRollbackInCorrectOrder() |
279 | 279 | { |
280 | - $expected_order = [6,5,4,3,2,1]; |
|
280 | + $expected_order = [6, 5, 4, 3, 2, 1]; |
|
281 | 281 | $actual_order = []; |
282 | 282 | $collection = $this->collectionBuilder(); |
283 | - $collection->rollbackCode(function () use (&$actual_order) { |
|
283 | + $collection->rollbackCode(function() use (&$actual_order) { |
|
284 | 284 | $actual_order[] = 1; |
285 | 285 | }); |
286 | - $collection->rollbackCode(function () use (&$actual_order) { |
|
286 | + $collection->rollbackCode(function() use (&$actual_order) { |
|
287 | 287 | $actual_order[] = 2; |
288 | 288 | }); |
289 | - $collection->rollbackCode(function () use (&$actual_order) { |
|
289 | + $collection->rollbackCode(function() use (&$actual_order) { |
|
290 | 290 | $actual_order[] = 3; |
291 | 291 | }); |
292 | 292 | // Add a nested collection with rollbacks. |
293 | 293 | $nested_collection = $this->collectionBuilder(); |
294 | - $nested_collection->rollbackCode(function () use (&$actual_order) { |
|
294 | + $nested_collection->rollbackCode(function() use (&$actual_order) { |
|
295 | 295 | $actual_order[] = 4; |
296 | 296 | }); |
297 | - $nested_collection->rollbackCode(function () use (&$actual_order) { |
|
297 | + $nested_collection->rollbackCode(function() use (&$actual_order) { |
|
298 | 298 | $actual_order[] = 5; |
299 | 299 | }); |
300 | 300 | $collection->addTask($nested_collection); |
301 | 301 | |
302 | - $collection->rollbackCode(function () use (&$actual_order) { |
|
302 | + $collection->rollbackCode(function() use (&$actual_order) { |
|
303 | 303 | $actual_order[] = 6; |
304 | 304 | }); |
305 | - $collection->addCode(function () { |
|
305 | + $collection->addCode(function() { |
|
306 | 306 | return Result::EXITCODE_ERROR; |
307 | 307 | }); |
308 | 308 | $result = $collection->run(); |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | $collection = $this->collectionBuilder(); |
506 | 506 | |
507 | 507 | $collection->addCode( |
508 | - function () { |
|
508 | + function() { |
|
509 | 509 | throw new \RuntimeException('Error'); |
510 | 510 | } |
511 | 511 | ); |