@@ -40,7 +40,7 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | public function handle($message, callable $next) |
| 42 | 42 | { |
| 43 | - $this->queue[] = Delegate::fromClosure(function () use ($message, $next) { |
|
| 43 | + $this->queue[] = Delegate::fromClosure(function() use ($message, $next) { |
|
| 44 | 44 | return $next($message); |
| 45 | 45 | }); |
| 46 | 46 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - $next = Delegate::fromClosure(function ($message) { |
|
| 157 | + $next = Delegate::fromClosure(function($message) { |
|
| 158 | 158 | // the final middleware return the same message |
| 159 | 159 | return $message; |
| 160 | 160 | }); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | // reverse iteration over middlewares |
| 163 | 163 | /** @var MiddlewareInterface $middleware */ |
| 164 | 164 | while ($middleware = array_pop($middlewares)) { |
| 165 | - $next = Delegate::fromClosure(function ($message) use ($middleware, $next) { |
|
| 165 | + $next = Delegate::fromClosure(function($message) use ($middleware, $next) { |
|
| 166 | 166 | return $middleware->handle($message, $next); |
| 167 | 167 | }); |
| 168 | 168 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | ) |
| 60 | 60 | ->and($resolver->addHandler(LoginUserCommand::class, new LoginUserCommandHandler())) |
| 61 | 61 | ->then() |
| 62 | - ->exception(function () use ($resolver) { |
|
| 62 | + ->exception(function() use ($resolver) { |
|
| 63 | 63 | $resolver->resolve(new LogoutUserCommand('[email protected]')); |
| 64 | 64 | }) |
| 65 | 65 | ->isInstanceOf(NotFoundException::class) |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | ) |
| 75 | 75 | ) |
| 76 | 76 | ->then() |
| 77 | - ->exception(function () use ($resolver) { |
|
| 77 | + ->exception(function() use ($resolver) { |
|
| 78 | 78 | $resolver->resolve(new LoginUserCommand('[email protected]', 'plainpassword')); |
| 79 | 79 | }) |
| 80 | 80 | ->isInstanceOf(NotFoundException::class) |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $this |
| 35 | 35 | ->given($resolver1 = new \StdClass()) |
| 36 | 36 | ->then() |
| 37 | - ->exception(function () use ($resolver1) { |
|
| 37 | + ->exception(function() use ($resolver1) { |
|
| 38 | 38 | new ChainResolver([$resolver1]); |
| 39 | 39 | }) |
| 40 | 40 | ->isInstanceOf(InvalidResolverException::class) |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $this |
| 65 | 65 | ->given($resolver = new ChainResolver([])) |
| 66 | 66 | ->then() |
| 67 | - ->exception(function () use ($resolver) { |
|
| 67 | + ->exception(function() use ($resolver) { |
|
| 68 | 68 | $resolver->resolve(new LogoutUserCommand('[email protected]')); |
| 69 | 69 | }) |
| 70 | 70 | ->isInstanceOf(NotFoundException::class) |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | $this |
| 39 | 39 | ->given($resolver = new FromCommandNamedResolver()) |
| 40 | 40 | ->then() |
| 41 | - ->exception(function () use ($resolver) { |
|
| 41 | + ->exception(function() use ($resolver) { |
|
| 42 | 42 | $resolver->resolve(new LoginUserCommand('[email protected]', 'plainpassword')); |
| 43 | 43 | }) |
| 44 | 44 | ->isInstanceOf(\InvalidArgumentException::class) |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | $this |
| 41 | 41 | ->given($handler = new LoginUserCommandHandler()) |
| 42 | 42 | ->then() |
| 43 | - ->exception(function () use ($handler) { |
|
| 43 | + ->exception(function() use ($handler) { |
|
| 44 | 44 | new InMemoryLocator([255 => $handler]); |
| 45 | 45 | }) |
| 46 | 46 | ->isInstanceOf(\InvalidArgumentException::class) |
| 47 | - ->exception(function () use ($handler) { |
|
| 47 | + ->exception(function() use ($handler) { |
|
| 48 | 48 | new InMemoryLocator([LoginUserCommand::class => 255]); |
| 49 | 49 | }) |
| 50 | 50 | ->isInstanceOf(\InvalidArgumentException::class) |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | ->then() |
| 65 | 65 | ->object($result) |
| 66 | 66 | ->isEqualTo($handler) |
| 67 | - ->exception(function () use ($locator) { |
|
| 67 | + ->exception(function() use ($locator) { |
|
| 68 | 68 | $locator->locate('Foo'); |
| 69 | 69 | }) |
| 70 | 70 | ->isInstanceOf(NotFoundException::class) |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | ->and($query = new NearByVenuesQuery($this->faker->latitude(), $this->faker->longitude())) |
| 44 | 44 | ->and($queryHandler = new VenuesQueryHandler()) |
| 45 | 45 | ->and($resolver->addHandler(NearByVenuesQuery::class, $queryHandler)) |
| 46 | - ->and($callable = function (array $result) { |
|
| 46 | + ->and($callable = function(array $result) { |
|
| 47 | 47 | return json_encode($result); |
| 48 | 48 | }) |
| 49 | 49 | ->when($result = $middleware->handle($query, $callable)) |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | ->string($result) |
| 52 | 52 | ->isNotEmpty() |
| 53 | 53 | ->isEqualTo(json_encode($queryHandler->nearbyVenues($query))) |
| 54 | - ->exception(function () use ($middleware, $callable) { |
|
| 54 | + ->exception(function() use ($middleware, $callable) { |
|
| 55 | 55 | $middleware->handle(new \StdClass(), $callable); |
| 56 | 56 | })->isInstanceOf(\InvalidArgumentException::class) |
| 57 | 57 | ; |
@@ -41,14 +41,14 @@ |
||
| 41 | 41 | ) |
| 42 | 42 | ->and($middleware = new CommandHandlerMiddleware($resolver)) |
| 43 | 43 | ->and($command = new LoginUserCommand('[email protected]', 'plainpassword')) |
| 44 | - ->and($callable = function (LoginUserCommand $command) { |
|
| 44 | + ->and($callable = function(LoginUserCommand $command) { |
|
| 45 | 45 | $command->setEmail('[email protected]'); |
| 46 | 46 | }) |
| 47 | 47 | ->when($middleware->handle($command, $callable)) |
| 48 | 48 | ->then() |
| 49 | 49 | ->string($command->email()) |
| 50 | 50 | ->isEqualTo('[email protected]') |
| 51 | - ->exception(function () use ($middleware, $callable) { |
|
| 51 | + ->exception(function() use ($middleware, $callable) { |
|
| 52 | 52 | $middleware->handle(new \StdClass(), $callable); |
| 53 | 53 | })->isInstanceOf(\InvalidArgumentException::class) |
| 54 | 54 | ; |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $this |
| 34 | 34 | ->given($middleware = new LockingMiddleware()) |
| 35 | 35 | ->and($command = new LoginUserCommand('[email protected]', 'plainpassword')) |
| 36 | - ->and($callable = function (LoginUserCommand $command) { |
|
| 36 | + ->and($callable = function(LoginUserCommand $command) { |
|
| 37 | 37 | $command->setEmail('[email protected]'); |
| 38 | 38 | }) |
| 39 | 39 | ->when($middleware->handle($command, $callable)) |
@@ -45,12 +45,12 @@ discard block |
||
| 45 | 45 | $this |
| 46 | 46 | ->given($middleware = new LockingMiddleware()) |
| 47 | 47 | ->and($command = new LoginUserCommand('[email protected]', 'plainpassword')) |
| 48 | - ->and($callable = function (LoginUserCommand $command) { |
|
| 48 | + ->and($callable = function(LoginUserCommand $command) { |
|
| 49 | 49 | $command->setEmail('[email protected]'); |
| 50 | 50 | throw new \InvalidArgumentException(); |
| 51 | 51 | }) |
| 52 | 52 | ->then() |
| 53 | - ->exception(function () use ($middleware, $command, $callable) { |
|
| 53 | + ->exception(function() use ($middleware, $command, $callable) { |
|
| 54 | 54 | $middleware->handle($command, $callable); |
| 55 | 55 | }) |
| 56 | 56 | ->isInstanceOf(\InvalidArgumentException::class) |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | $this |
| 60 | 60 | ->given($middleware = new LockingMiddleware()) |
| 61 | - ->and($callable = function (LoginUserCommand $command) { |
|
| 61 | + ->and($callable = function(LoginUserCommand $command) { |
|
| 62 | 62 | $command->setPassword(md5($command->password())); |
| 63 | 63 | }) |
| 64 | 64 | ->and($handler = new TriggerCommandOnHandle($middleware, $callable)) |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $this |
| 79 | 79 | ->given($middleware = new LockingMiddleware()) |
| 80 | 80 | ->and($event = new LoginUserEvent('[email protected]')) |
| 81 | - ->and($callable = function (LoginUserEvent $event) { |
|
| 81 | + ->and($callable = function(LoginUserEvent $event) { |
|
| 82 | 82 | $event->setEmail('[email protected]'); |
| 83 | 83 | }) |
| 84 | 84 | ->when($middleware->handle($event, $callable)) |
@@ -90,13 +90,13 @@ discard block |
||
| 90 | 90 | $this |
| 91 | 91 | ->given($middleware = new LockingMiddleware()) |
| 92 | 92 | ->and($event = new LoginUserEvent('[email protected]')) |
| 93 | - ->and($callable = function (LoginUserEvent $event) { |
|
| 93 | + ->and($callable = function(LoginUserEvent $event) { |
|
| 94 | 94 | $event->setEmail('[email protected]'); |
| 95 | 95 | |
| 96 | 96 | throw new \InvalidArgumentException(); |
| 97 | 97 | }) |
| 98 | 98 | ->then() |
| 99 | - ->exception(function () use ($middleware, $event, $callable) { |
|
| 99 | + ->exception(function() use ($middleware, $event, $callable) { |
|
| 100 | 100 | $middleware->handle($event, $callable); |
| 101 | 101 | }) |
| 102 | 102 | ->isInstanceOf(\InvalidArgumentException::class) |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | $this |
| 106 | 106 | ->given($middleware = new LockingMiddleware()) |
| 107 | - ->and($callable = function (LoginUserEvent $event) { |
|
| 107 | + ->and($callable = function(LoginUserEvent $event) { |
|
| 108 | 108 | $event->setEmail(md5($event->email())); |
| 109 | 109 | }) |
| 110 | 110 | ->and($listener = new TriggerEventOnListener($middleware, $callable)) |