Passed
Push — master ( 18c542...46352d )
by Kevin
02:34
created
src/Schedule/Task.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
      */
124 124
     final public function when(string $description, $callback): self
125 125
     {
126
-        $callback = \is_callable($callback) ? $callback : function () use ($callback) {
126
+        $callback = \is_callable($callback) ? $callback : function() use ($callback) {
127 127
             return (bool) $callback;
128 128
         };
129 129
 
130
-        return $this->filter(function (BeforeTaskEvent $event) use ($callback, $description) {
130
+        return $this->filter(function(BeforeTaskEvent $event) use ($callback, $description) {
131 131
             if (!$callback($event)) {
132 132
                 throw new SkipTask($description);
133 133
             }
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
      */
143 143
     final public function skip(string $description, $callback): self
144 144
     {
145
-        $callback = \is_callable($callback) ? $callback : function () use ($callback) {
145
+        $callback = \is_callable($callback) ? $callback : function() use ($callback) {
146 146
             return (bool) $callback;
147 147
         };
148 148
 
149
-        return $this->filter(function (BeforeTaskEvent $event) use ($callback, $description) {
149
+        return $this->filter(function(BeforeTaskEvent $event) use ($callback, $description) {
150 150
             if ($callback($event)) {
151 151
                 throw new SkipTask($description);
152 152
             }
Please login to merge, or discard this patch.
src/Schedule/Extension/EmailExtension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
             return "{$this->hook}, email output";
52 52
         }
53 53
 
54
-        $to = \array_map(function (Address $address) { return $address->toString(); }, $to);
54
+        $to = \array_map(function(Address $address) { return $address->toString(); }, $to);
55 55
         $to = \implode('; ', $to);
56 56
 
57 57
         return "{$this->hook}, email output to \"{$to}\"";
Please login to merge, or discard this patch.
src/Command/ScheduleListCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@
 block discarded – undo
147 147
 
148 148
         $io->comment(\sprintf('<info>%d</info> %s Extension%s:', $count, $type, $count > 1 ? 's' : ''));
149 149
         $io->listing(\array_map(
150
-            function (Extension $extension) {
150
+            function(Extension $extension) {
151 151
                 return \sprintf('%s <comment>(%s)</comment>',
152 152
                     \strtr($extension, self::extensionHighlightMap()),
153 153
                     \get_class($extension)
Please login to merge, or discard this patch.
src/Schedule.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     public function getId(): string
32 32
     {
33 33
         $tasks = \array_map(
34
-            function (Task $task) {
34
+            function(Task $task) {
35 35
                 return $task->getId();
36 36
             },
37 37
             $this->all()
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function when(string $description, $callback): self
101 101
     {
102
-        $callback = \is_callable($callback) ? $callback : function () use ($callback) {
102
+        $callback = \is_callable($callback) ? $callback : function() use ($callback) {
103 103
             return (bool) $callback;
104 104
         };
105 105
 
106
-        return $this->filter(function (BeforeScheduleEvent $event) use ($callback, $description) {
106
+        return $this->filter(function(BeforeScheduleEvent $event) use ($callback, $description) {
107 107
             if (!$callback($event)) {
108 108
                 throw new SkipSchedule($description);
109 109
             }
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
      */
119 119
     public function skip(string $description, $callback): self
120 120
     {
121
-        $callback = \is_callable($callback) ? $callback : function () use ($callback) {
121
+        $callback = \is_callable($callback) ? $callback : function() use ($callback) {
122 122
             return (bool) $callback;
123 123
         };
124 124
 
125
-        return $this->filter(function (BeforeScheduleEvent $event) use ($callback, $description) {
125
+        return $this->filter(function(BeforeScheduleEvent $event) use ($callback, $description) {
126 126
             if ($callback($event)) {
127 127
                 throw new SkipSchedule($description);
128 128
             }
Please login to merge, or discard this patch.
tests/Functional/LoggingTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@
 block discarded – undo
112 112
     {
113 113
         $event = $this->createRunnerBuilder()
114 114
             ->addTask(new MockTask())
115
-            ->addExtension(CallbackExtension::scheduleFilter(function () {
115
+            ->addExtension(CallbackExtension::scheduleFilter(function() {
116 116
                 throw new SkipSchedule('the schedule has skipped');
117 117
             }))
118 118
             ->run()
Please login to merge, or discard this patch.
tests/Functional/SelfHandlingExtensionTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -77,19 +77,19 @@
 block discarded – undo
77 77
             public function buildSchedule(Schedule $schedule): void
78 78
             {
79 79
                 $schedule
80
-                    ->filter(function () { $this->calls[] = 'scheduleFilter'; })
81
-                    ->before(function () { $this->calls[] = 'scheduleBefore'; })
82
-                    ->after(function () { $this->calls[] = 'scheduleAfter'; })
83
-                    ->onSuccess(function () { $this->calls[] = 'scheduleSuccess'; })
84
-                    ->onFailure(function () { $this->calls[] = 'scheduleFailure'; })
80
+                    ->filter(function() { $this->calls[] = 'scheduleFilter'; })
81
+                    ->before(function() { $this->calls[] = 'scheduleBefore'; })
82
+                    ->after(function() { $this->calls[] = 'scheduleAfter'; })
83
+                    ->onSuccess(function() { $this->calls[] = 'scheduleSuccess'; })
84
+                    ->onFailure(function() { $this->calls[] = 'scheduleFailure'; })
85 85
                 ;
86 86
 
87 87
                 $schedule->add($this->task)
88
-                    ->filter(function () { $this->calls[] = 'taskFilter'; })
89
-                    ->before(function () { $this->calls[] = 'taskBefore'; })
90
-                    ->after(function () { $this->calls[] = 'taskAfter'; })
91
-                    ->onSuccess(function () { $this->calls[] = 'taskSuccess'; })
92
-                    ->onFailure(function () { $this->calls[] = 'taskFailure'; })
88
+                    ->filter(function() { $this->calls[] = 'taskFilter'; })
89
+                    ->before(function() { $this->calls[] = 'taskBefore'; })
90
+                    ->after(function() { $this->calls[] = 'taskAfter'; })
91
+                    ->onSuccess(function() { $this->calls[] = 'taskSuccess'; })
92
+                    ->onFailure(function() { $this->calls[] = 'taskFailure'; })
93 93
                 ;
94 94
             }
95 95
         };
Please login to merge, or discard this patch.
tests/ScheduleTest.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
     {
29 29
         $schedule = new Schedule();
30 30
 
31
-        $schedule->add(new CallbackTask(function () {}))->description('task1');
32
-        $schedule->addCallback(function () {})->description('task2');
31
+        $schedule->add(new CallbackTask(function() {}))->description('task1');
32
+        $schedule->addCallback(function() {})->description('task2');
33 33
         $schedule->addProcess('php -v')->description('task3');
34 34
         $schedule->addCommand('my:command')->description('task4');
35 35
 
36 36
         $this->assertCount(4, $schedule->all());
37 37
         $this->assertSame(['task1', 'task2', 'task3', 'task4'], \array_map(
38
-            function (Task $task) {
38
+            function(Task $task) {
39 39
                 return $task->getDescription();
40 40
             },
41 41
             $schedule->all()
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         $schedule->addCommand('my:command')->description('task1')->tuesdays();
53 53
         $schedule->addCompound()
54 54
             ->addCommand('another:command', [], 'task2')
55
-            ->addCallback(function () {}, 'task3')
55
+            ->addCallback(function() {}, 'task3')
56 56
             ->addProcess('php -v', 'task4')
57 57
             ->add((new CommandTask('yet:another:command'))
58 58
                 ->description('task5')
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     {
95 95
         $schedule = new Schedule();
96 96
 
97
-        $schedule->addCallback(function () {})->description('task1');
97
+        $schedule->addCallback(function() {})->description('task1');
98 98
         $notDueTask = $schedule->addProcess('php -v')->description('task2')->sundays();
99 99
 
100 100
         if ('Sun' === \date('D')) {
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     {
151 151
         $schedule = new Schedule();
152 152
 
153
-        $schedule->when('callback value', function () { return false; });
153
+        $schedule->when('callback value', function() { return false; });
154 154
 
155 155
         $this->expectException(SkipSchedule::class);
156 156
         $this->expectExceptionMessage('callback value');
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     {
180 180
         $schedule = new Schedule();
181 181
 
182
-        $schedule->when('callback value', function () { return true; });
182
+        $schedule->when('callback value', function() { return true; });
183 183
 
184 184
         $schedule->getExtensions()[0]->filterSchedule(new BeforeScheduleEvent($schedule));
185 185
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
     {
209 209
         $schedule = new Schedule();
210 210
 
211
-        $schedule->skip('callback value', function () { return true; });
211
+        $schedule->skip('callback value', function() { return true; });
212 212
 
213 213
         $this->expectException(SkipSchedule::class);
214 214
         $this->expectExceptionMessage('callback value');
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
     {
238 238
         $schedule = new Schedule();
239 239
 
240
-        $schedule->skip('callback value', function () { return false; });
240
+        $schedule->skip('callback value', function() { return false; });
241 241
 
242 242
         $schedule->getExtensions()[0]->filterSchedule(new BeforeScheduleEvent($schedule));
243 243
 
@@ -252,12 +252,12 @@  discard block
 block discarded – undo
252 252
         $schedule = new Schedule();
253 253
         $calls = [];
254 254
 
255
-        $schedule->filter(function () use (&$calls) { $calls[] = 'filter'; });
256
-        $schedule->before(function () use (&$calls) { $calls[] = 'before'; });
257
-        $schedule->after(function () use (&$calls) { $calls[] = 'after'; });
258
-        $schedule->then(function () use (&$calls) { $calls[] = 'then'; });
259
-        $schedule->onSuccess(function () use (&$calls) { $calls[] = 'onSuccess'; });
260
-        $schedule->onFailure(function () use (&$calls) { $calls[] = 'onFailure'; });
255
+        $schedule->filter(function() use (&$calls) { $calls[] = 'filter'; });
256
+        $schedule->before(function() use (&$calls) { $calls[] = 'before'; });
257
+        $schedule->after(function() use (&$calls) { $calls[] = 'after'; });
258
+        $schedule->then(function() use (&$calls) { $calls[] = 'then'; });
259
+        $schedule->onSuccess(function() use (&$calls) { $calls[] = 'onSuccess'; });
260
+        $schedule->onFailure(function() use (&$calls) { $calls[] = 'onFailure'; });
261 261
 
262 262
         $schedule->getExtensions()[0]->filterSchedule($event = new BeforeScheduleEvent($schedule));
263 263
         $schedule->getExtensions()[1]->beforeSchedule(new BeforeScheduleEvent($schedule));
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
     public function can_add_email_on_failure_extension()
335 335
     {
336 336
         $schedule = new Schedule();
337
-        $schedule->emailOnFailure('[email protected]', 'my subject', function (Email $email) {
337
+        $schedule->emailOnFailure('[email protected]', 'my subject', function(Email $email) {
338 338
             $email->cc('[email protected]');
339 339
         });
340 340
 
Please login to merge, or discard this patch.
tests/Schedule/TaskTest.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -70,40 +70,40 @@  discard block
 block discarded – undo
70 70
     public static function frequencyProvider(): array
71 71
     {
72 72
         return [
73
-            [function () { return self::createTask()->daily(); }, '0 0 * * *'],
74
-            [function () { return self::createTask()->cron('0 0 * * *')->everyMinute(); }, '* 0 * * *'],
75
-            [function () { return self::createTask()->everyFiveMinutes(); }, '*/5 * * * *'],
76
-            [function () { return self::createTask()->everyTenMinutes(); }, '*/10 * * * *'],
77
-            [function () { return self::createTask()->everyFifteenMinutes(); }, '*/15 * * * *'],
78
-            [function () { return self::createTask()->everyThirtyMinutes(); }, '0,30 * * * *'],
79
-            [function () { return self::createTask()->hourly(); }, '0 * * * *'],
80
-            [function () { return self::createTask()->hourlyAt(6); }, '6 * * * *'],
81
-            [function () { return self::createTask()->at('3'); }, '0 3 * * *'],
82
-            [function () { return self::createTask()->at('3:16'); }, '16 3 * * *'],
83
-            [function () { return self::createTask()->dailyAt('3'); }, '0 3 * * *'],
84
-            [function () { return self::createTask()->twiceDaily(); }, '0 1,13 * * *'],
85
-            [function () { return self::createTask()->twiceDaily(2, 14); }, '0 2,14 * * *'],
86
-            [function () { return self::createTask()->weekdays(); }, '* * * * 1-5'],
87
-            [function () { return self::createTask()->weekdays()->at(2); }, '0 2 * * 1-5'],
88
-            [function () { return self::createTask()->weekends(); }, '* * * * 0,6'],
89
-            [function () { return self::createTask()->mondays(); }, '* * * * 1'],
90
-            [function () { return self::createTask()->tuesdays(); }, '* * * * 2'],
91
-            [function () { return self::createTask()->wednesdays(); }, '* * * * 3'],
92
-            [function () { return self::createTask()->thursdays(); }, '* * * * 4'],
93
-            [function () { return self::createTask()->fridays(); }, '* * * * 5'],
94
-            [function () { return self::createTask()->saturdays(); }, '* * * * 6'],
95
-            [function () { return self::createTask()->sundays(); }, '* * * * 0'],
96
-            [function () { return self::createTask()->days(1, 2, 3); }, '* * * * 1,2,3'],
97
-            [function () { return self::createTask()->weekly(); }, '0 0 * * 0'],
98
-            [function () { return self::createTask()->weekly()->at('3:15'); }, '15 3 * * 0'],
99
-            [function () { return self::createTask()->monthly(); }, '0 0 1 * *'],
100
-            [function () { return self::createTask()->monthlyOn(3); }, '0 0 3 * *'],
101
-            [function () { return self::createTask()->monthlyOn(3, '4:15'); }, '15 4 3 * *'],
102
-            [function () { return self::createTask()->twiceMonthly(); }, '0 0 1,16 * *'],
103
-            [function () { return self::createTask()->twiceMonthly(3, 17); }, '0 0 3,17 * *'],
104
-            [function () { return self::createTask()->twiceMonthly()->at('3:15'); }, '15 3 1,16 * *'],
105
-            [function () { return self::createTask()->quarterly(); }, '0 0 1 1-12/3 *'],
106
-            [function () { return self::createTask()->yearly(); }, '0 0 1 1 *'],
73
+            [function() { return self::createTask()->daily(); }, '0 0 * * *'],
74
+            [function() { return self::createTask()->cron('0 0 * * *')->everyMinute(); }, '* 0 * * *'],
75
+            [function() { return self::createTask()->everyFiveMinutes(); }, '*/5 * * * *'],
76
+            [function() { return self::createTask()->everyTenMinutes(); }, '*/10 * * * *'],
77
+            [function() { return self::createTask()->everyFifteenMinutes(); }, '*/15 * * * *'],
78
+            [function() { return self::createTask()->everyThirtyMinutes(); }, '0,30 * * * *'],
79
+            [function() { return self::createTask()->hourly(); }, '0 * * * *'],
80
+            [function() { return self::createTask()->hourlyAt(6); }, '6 * * * *'],
81
+            [function() { return self::createTask()->at('3'); }, '0 3 * * *'],
82
+            [function() { return self::createTask()->at('3:16'); }, '16 3 * * *'],
83
+            [function() { return self::createTask()->dailyAt('3'); }, '0 3 * * *'],
84
+            [function() { return self::createTask()->twiceDaily(); }, '0 1,13 * * *'],
85
+            [function() { return self::createTask()->twiceDaily(2, 14); }, '0 2,14 * * *'],
86
+            [function() { return self::createTask()->weekdays(); }, '* * * * 1-5'],
87
+            [function() { return self::createTask()->weekdays()->at(2); }, '0 2 * * 1-5'],
88
+            [function() { return self::createTask()->weekends(); }, '* * * * 0,6'],
89
+            [function() { return self::createTask()->mondays(); }, '* * * * 1'],
90
+            [function() { return self::createTask()->tuesdays(); }, '* * * * 2'],
91
+            [function() { return self::createTask()->wednesdays(); }, '* * * * 3'],
92
+            [function() { return self::createTask()->thursdays(); }, '* * * * 4'],
93
+            [function() { return self::createTask()->fridays(); }, '* * * * 5'],
94
+            [function() { return self::createTask()->saturdays(); }, '* * * * 6'],
95
+            [function() { return self::createTask()->sundays(); }, '* * * * 0'],
96
+            [function() { return self::createTask()->days(1, 2, 3); }, '* * * * 1,2,3'],
97
+            [function() { return self::createTask()->weekly(); }, '0 0 * * 0'],
98
+            [function() { return self::createTask()->weekly()->at('3:15'); }, '15 3 * * 0'],
99
+            [function() { return self::createTask()->monthly(); }, '0 0 1 * *'],
100
+            [function() { return self::createTask()->monthlyOn(3); }, '0 0 3 * *'],
101
+            [function() { return self::createTask()->monthlyOn(3, '4:15'); }, '15 4 3 * *'],
102
+            [function() { return self::createTask()->twiceMonthly(); }, '0 0 1,16 * *'],
103
+            [function() { return self::createTask()->twiceMonthly(3, 17); }, '0 0 3,17 * *'],
104
+            [function() { return self::createTask()->twiceMonthly()->at('3:15'); }, '15 3 1,16 * *'],
105
+            [function() { return self::createTask()->quarterly(); }, '0 0 1 1-12/3 *'],
106
+            [function() { return self::createTask()->yearly(); }, '0 0 1 1 *'],
107 107
         ];
108 108
     }
109 109
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
     {
153 153
         $task = self::createTask();
154 154
 
155
-        $task->when('callback value', function () { return false; });
155
+        $task->when('callback value', function() { return false; });
156 156
 
157 157
         $this->expectException(SkipTask::class);
158 158
         $this->expectExceptionMessage('callback value');
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     {
182 182
         $task = self::createTask();
183 183
 
184
-        $task->when('callback value', function () { return true; });
184
+        $task->when('callback value', function() { return true; });
185 185
 
186 186
         $task->getExtensions()[0]->filterTask(new BeforeTaskEvent(new BeforeScheduleEvent(new Schedule()), $task));
187 187
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
     {
211 211
         $task = self::createTask();
212 212
 
213
-        $task->skip('callback value', function () { return true; });
213
+        $task->skip('callback value', function() { return true; });
214 214
 
215 215
         $this->expectException(SkipTask::class);
216 216
         $this->expectExceptionMessage('callback value');
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
     {
240 240
         $task = self::createTask();
241 241
 
242
-        $task->skip('callback value', function () { return false; });
242
+        $task->skip('callback value', function() { return false; });
243 243
 
244 244
         $task->getExtensions()[0]->filterTask(new BeforeTaskEvent(new BeforeScheduleEvent(new Schedule()), $task));
245 245
 
@@ -254,12 +254,12 @@  discard block
 block discarded – undo
254 254
         $task = self::createTask();
255 255
         $calls = [];
256 256
 
257
-        $task->filter(function () use (&$calls) { $calls[] = 'filter'; });
258
-        $task->before(function () use (&$calls) { $calls[] = 'before'; });
259
-        $task->after(function () use (&$calls) { $calls[] = 'after'; });
260
-        $task->then(function () use (&$calls) { $calls[] = 'then'; });
261
-        $task->onSuccess(function () use (&$calls) { $calls[] = 'onSuccess'; });
262
-        $task->onFailure(function () use (&$calls) { $calls[] = 'onFailure'; });
257
+        $task->filter(function() use (&$calls) { $calls[] = 'filter'; });
258
+        $task->before(function() use (&$calls) { $calls[] = 'before'; });
259
+        $task->after(function() use (&$calls) { $calls[] = 'after'; });
260
+        $task->then(function() use (&$calls) { $calls[] = 'then'; });
261
+        $task->onSuccess(function() use (&$calls) { $calls[] = 'onSuccess'; });
262
+        $task->onFailure(function() use (&$calls) { $calls[] = 'onFailure'; });
263 263
 
264 264
         $task->getExtensions()[0]->filterTask($event = new BeforeTaskEvent(new BeforeScheduleEvent(new Schedule()), $task));
265 265
         $task->getExtensions()[1]->beforeTask($event);
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
     public function can_add_email_after_extension($method)
315 315
     {
316 316
         $task = self::createTask();
317
-        $task->{$method}('[email protected]', 'my subject', function (Email $email) {
317
+        $task->{$method}('[email protected]', 'my subject', function(Email $email) {
318 318
             $email->cc('[email protected]');
319 319
         });
320 320
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
     public function can_add_email_on_failure_extension()
339 339
     {
340 340
         $task = self::createTask();
341
-        $task->emailOnFailure('[email protected]', 'my subject', function (Email $email) {
341
+        $task->emailOnFailure('[email protected]', 'my subject', function(Email $email) {
342 342
             $email->cc('[email protected]');
343 343
         });
344 344
 
Please login to merge, or discard this patch.
tests/Schedule/Task/CallbackTaskTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      */
16 16
     public function can_create_successful_result()
17 17
     {
18
-        $result = (new CallbackTask(function () {}))();
18
+        $result = (new CallbackTask(function() {}))();
19 19
 
20 20
         $this->assertTrue($result->isSuccessful());
21 21
         $this->assertNull($result->getOutput());
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function stringifies_output($output, $expectedOutput)
29 29
     {
30
-        $result = (new CallbackTask(function () use ($output) { return $output; }))();
30
+        $result = (new CallbackTask(function() use ($output) { return $output; }))();
31 31
 
32 32
         $this->assertTrue($result->isSuccessful());
33 33
         $this->assertSame($expectedOutput, $result->getOutput());
Please login to merge, or discard this patch.