Passed
Push — master ( ac7767...ce6fb4 )
by PHPinnacle
06:06 queued 03:22
created
examples/concurent.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@
 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
     $handlers = new HandlerRegistry();
11
-    $handlers->register('emit', function (string $string, int $num, int $delay = 100) {
11
+    $handlers->register('emit', function(string $string, int $num, int $delay = 100) {
12 12
         for ($i = 0; $i < $num; $i++) {
13 13
             echo $string;
14 14
 
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
     $handlers = new HandlerRegistry();
28 28
     $handlers
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 Stop::class => 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 Ping::class => 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.
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
     $handlers = new HandlerRegistry();
33 33
     $handlers
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
     $handlers = new HandlerRegistry();
11 11
     $handlers
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,12 +18,12 @@  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 ($handlers) {
26
+        ->register('receive', function(int $pid, string $message, callable $handler) use ($handlers) {
27 27
             $signal = sprintf('%s.%d', $message, $pid);
28 28
 
29 29
             $handlers->register($signal, $handler);
@@ -32,23 +32,23 @@  discard block
 block discarded – undo
32 32
 
33 33
     $dispatcher = new SignalDispatcher($handlers);
34 34
 
35
-    $receiver = yield $dispatcher->dispatch('spawn', function (int $pid) {
36
-        yield 'receive' => [$pid, 'ping', function () {
35
+    $receiver = yield $dispatcher->dispatch('spawn', function(int $pid) {
36
+        yield 'receive' => [$pid, 'ping', function() {
37 37
             echo 'Ping!' . \PHP_EOL;
38 38
         }];
39 39
 
40
-        yield 'receive' => [$pid, 'pong', function () {
40
+        yield 'receive' => [$pid, 'pong', function() {
41 41
             echo 'Pong!' . \PHP_EOL;
42 42
         }];
43 43
     });
44 44
 
45
-    $senderOne = $dispatcher->dispatch('spawn', function () use ($receiver) {
45
+    $senderOne = $dispatcher->dispatch('spawn', function() use ($receiver) {
46 46
         yield 'send' => [$receiver, 'ping'];
47 47
         yield new Delayed(500);
48 48
         yield 'send' => [$receiver, 'ping'];
49 49
     });
50 50
 
51
-    $senderTwo = $dispatcher->dispatch('spawn', function () use ($receiver) {
51
+    $senderTwo = $dispatcher->dispatch('spawn', function() use ($receiver) {
52 52
         yield 'send' => [$receiver, 'pong'];
53 53
         yield new Delayed(100);
54 54
         yield 'send' => [$receiver, 'pong'];
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.
src/SignalDispatcher.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
             $signal = Signal::create($signal, $arguments);
41 41
         }
42 42
 
43
-        return new LazyPromise(function () use ($signal) {
43
+        return new LazyPromise(function() use ($signal) {
44 44
             $handler = $this->handler($signal);
45 45
             $result  = $handler(...$signal->arguments());
46 46
 
Please login to merge, or discard this patch.