Passed
Push — master ( 1ff9eb...d68e66 )
by PHPinnacle
02:16
created
examples/pcntl.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,11 +2,11 @@
 block discarded – undo
2 2
 
3 3
 require __DIR__ . '/../vendor/autoload.php';
4 4
 
5
-Amp\Loop::run(function () {
5
+Amp\Loop::run(function() {
6 6
     $signals = \pcntl_signal_list(['SIGINT']);
7 7
 
8 8
     foreach ($signals as $signal) {
9
-        \ensign_signal($signal, function ($sigNo) {
9
+        \ensign_signal($signal, function($sigNo) {
10 10
             echo \sprintf('System signal "%d" received.' . \PHP_EOL, $sigNo);
11 11
         });
12 12
     }
Please login to merge, or discard this patch.
src/functions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
             continue;
94 94
         }
95 95
 
96
-        $handler = function (string $watcherId, int $sigNo, $sigInfo = null) use ($dispatcher, $signal) {
96
+        $handler = function(string $watcherId, int $sigNo, $sigInfo = null) use ($dispatcher, $signal) {
97 97
             yield $dispatcher->dispatch($signal, $sigNo, $sigInfo, $watcherId);
98 98
         };
99 99
 
Please login to merge, or discard this patch.
src/Handler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
      */
42 42
     public static function error(\Exception $error): self
43 43
     {
44
-        return new self(function () use ($error) {
44
+        return new self(function() use ($error) {
45 45
             throw $error;
46 46
         });
47 47
     }
Please login to merge, or discard this patch.
examples/emit.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
     }
29 29
 }
30 30
 
31
-Amp\Loop::run(function () {
31
+Amp\Loop::run(function() {
32 32
     $dispatcher = new SignalDispatcher();
33 33
     $dispatcher
34
-        ->register(SimpleCommand::class, function (SimpleCommand $cmd) {
34
+        ->register(SimpleCommand::class, function(SimpleCommand $cmd) {
35 35
             yield new Delayed($cmd->delay); // Just do some heavy calculations
36 36
             yield SimpleEvent::class => new SimpleEvent($cmd->num + $cmd->num);
37 37
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
             return $cmd->num;
42 42
         })
43
-        ->register(SimpleEvent::class, function (SimpleEvent $event) {
43
+        ->register(SimpleEvent::class, function(SimpleEvent $event) {
44 44
             echo \sprintf('Signal dispatched with value: %d at %s' . \PHP_EOL, $event->num, \microtime(true));
45 45
         })
46 46
     ;
Please login to merge, or discard this patch.
examples/process.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@  discard block
 block discarded – undo
6 6
 
7 7
 require __DIR__ . '/../vendor/autoload.php';
8 8
 
9
-Amp\Loop::run(function () {
9
+Amp\Loop::run(function() {
10 10
     $dispatcher = new SignalDispatcher();
11 11
     $dispatcher
12
-        ->register('spawn', function (callable $process) {
12
+        ->register('spawn', function(callable $process) {
13 13
             static $pid = 1;
14 14
 
15 15
             $gen = $process($pid);
@@ -18,35 +18,35 @@  discard block
 block discarded – undo
18 18
 
19 19
             return $pid++;
20 20
         })
21
-        ->register('send', function (int $pid, string $message, ...$arguments) {
21
+        ->register('send', function(int $pid, string $message, ...$arguments) {
22 22
             $signal = sprintf('%s.%d', $message, $pid);
23 23
 
24 24
             return yield $signal => $arguments;
25 25
         })
26
-        ->register('receive', function (int $pid, string $message, callable $handler) use ($dispatcher) {
26
+        ->register('receive', function(int $pid, string $message, callable $handler) use ($dispatcher) {
27 27
             $signal = sprintf('%s.%d', $message, $pid);
28 28
 
29 29
             $dispatcher->register($signal, $handler);
30 30
         })
31 31
     ;
32 32
 
33
-    $receiver = yield $dispatcher->dispatch('spawn', function (int $pid) {
34
-        yield 'receive' => [$pid, 'ping', function () {
33
+    $receiver = yield $dispatcher->dispatch('spawn', function(int $pid) {
34
+        yield 'receive' => [$pid, 'ping', function() {
35 35
             echo 'Ping!' . \PHP_EOL;
36 36
         }];
37 37
 
38
-        yield 'receive' => [$pid, 'pong', function () {
38
+        yield 'receive' => [$pid, 'pong', function() {
39 39
             echo 'Pong!' . \PHP_EOL;
40 40
         }];
41 41
     });
42 42
 
43
-    $senderOne = $dispatcher->dispatch('spawn', function () use ($receiver) {
43
+    $senderOne = $dispatcher->dispatch('spawn', function() use ($receiver) {
44 44
         yield 'send' => [$receiver, 'ping'];
45 45
         yield new Delayed(500);
46 46
         yield 'send' => [$receiver, 'ping'];
47 47
     });
48 48
 
49
-    $senderTwo = $dispatcher->dispatch('spawn', function () use ($receiver) {
49
+    $senderTwo = $dispatcher->dispatch('spawn', function() use ($receiver) {
50 50
         yield 'send' => [$receiver, 'pong'];
51 51
         yield new Delayed(100);
52 52
         yield 'send' => [$receiver, 'pong'];
Please login to merge, or discard this patch.
examples/concurent.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@
 block discarded – undo
6 6
 
7 7
 require __DIR__ . '/../vendor/autoload.php';
8 8
 
9
-Amp\Loop::run(function () {
9
+Amp\Loop::run(function() {
10 10
     $dispatcher = new SignalDispatcher();
11 11
     $dispatcher
12
-        ->register('emit', function (string $string, int $num, int $delay = 100) {
12
+        ->register('emit', function(string $string, int $num, int $delay = 100) {
13 13
             for ($i = 0; $i < $num; $i++) {
14 14
                 echo $string;
15 15
 
Please login to merge, or discard this patch.
src/SignalDispatcher.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
     public function register(string $signal, callable $handler): self
43 43
     {
44 44
         $this->handlers->register($signal, $handler);
45
-        $this->processor->intercept($signal, function (...$arguments) use ($signal) {
45
+        $this->processor->intercept($signal, function(...$arguments) use ($signal) {
46 46
             return $this->dispatch($signal, ...$arguments);
47 47
         });
48 48
 
Please login to merge, or discard this patch.
examples/ping-pong.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 {
24 24
 }
25 25
 
26
-Amp\Loop::run(function () {
26
+Amp\Loop::run(function() {
27 27
     $dispatcher = new SignalDispatcher();
28 28
     $dispatcher
29
-        ->register(Ping::class, function (Ping $cmd) {
29
+        ->register(Ping::class, function(Ping $cmd) {
30 30
             if ($cmd->times > 0) {
31 31
                 $cmd->times--;
32 32
 
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
                 yield new Stop();
38 38
             }
39 39
         })
40
-        ->register(Pong::class, function (Pong $cmd) {
40
+        ->register(Pong::class, function(Pong $cmd) {
41 41
             echo 'Pong!' . \PHP_EOL;
42 42
 
43 43
             yield new Ping($cmd->times);
44 44
         })
45
-        ->register(Stop::class, function () {
45
+        ->register(Stop::class, function() {
46 46
             echo 'Stop!' . \PHP_EOL;
47 47
         })
48 48
     ;
Please login to merge, or discard this patch.
src/TaskProcessor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
         $token     = new TaskToken();
53 53
         $arguments = (new Arguments($arguments))->inject($this->resolver->resolve($callable));
54 54
 
55
-        return new Task(new LazyPromise(function () use ($callable, $arguments, $token) {
55
+        return new Task(new LazyPromise(function() use ($callable, $arguments, $token) {
56 56
             return $this->coroutine($callable(...$arguments), $token);
57 57
         }), $token);
58 58
     }
Please login to merge, or discard this patch.