@@ -218,7 +218,7 @@ |
||
218 | 218 | $this->assertSame('value', $result->get('key')); |
219 | 219 | $this->assertSame('zxcv', $result->get('map')->get('name')); |
220 | 220 | $this->assertSame('poiuyt', $result->get('map')->get('other')); |
221 | - $this->assertSame(['value 1', 'value 2', 'value 3', 'value 4', 'value 5',], $result->get('vector')->toArray()); |
|
221 | + $this->assertSame(['value 1', 'value 2', 'value 3', 'value 4', 'value 5', ], $result->get('vector')->toArray()); |
|
222 | 222 | $this->assertSame('is overwritten', $result->get('this')); |
223 | 223 | $this->assertSame('plain string', $result->get('another')); |
224 | 224 | } |
@@ -147,8 +147,8 @@ |
||
147 | 147 | $eventDispatcher = new \Venta\Event\EventDispatcher(); |
148 | 148 | $mailer = new Venta\Mail\Mailer($config, $eventDispatcher); |
149 | 149 | $message = $mailer->getMessageBuilder() |
150 | - ->setTo('[email protected]') |
|
151 | - ->setFrom('[email protected]'); |
|
150 | + ->setTo('[email protected]') |
|
151 | + ->setFrom('[email protected]'); |
|
152 | 152 | |
153 | 153 | $this->assertEquals(['[email protected]' => null], $message->getTo()); |
154 | 154 | $this->assertEquals(['[email protected]' => null], $message->getFrom()); |
@@ -50,13 +50,13 @@ |
||
50 | 50 | { |
51 | 51 | $parameters = $function->getParameters(); |
52 | 52 | |
53 | - return function (array $arguments = []) use ($function, $parameters) { |
|
53 | + return function(array $arguments = []) use ($function, $parameters) { |
|
54 | 54 | // Use passed arguments in place of reflected parameters. |
55 | 55 | $provided = array_intersect_key($arguments, $parameters); |
56 | 56 | |
57 | 57 | // Remaining parameters will be resolved by container. |
58 | 58 | $remaining = array_diff_key($parameters, $arguments); |
59 | - $resolved = array_map(function (ReflectionParameter $parameter) use ($function) { |
|
59 | + $resolved = array_map(function(ReflectionParameter $parameter) use ($function) { |
|
60 | 60 | |
61 | 61 | // Recursively resolve function arguments. |
62 | 62 | $class = $parameter->getClass(); |
@@ -67,7 +67,7 @@ |
||
67 | 67 | $arguments = $callback($inflection); |
68 | 68 | |
69 | 69 | // Wrap calling method with closure to avoid reflecting / resolving each time inflection applied. |
70 | - $this->inflections[$type][$method] = $inflection = function () use ($method, $arguments) { |
|
70 | + $this->inflections[$type][$method] = $inflection = function() use ($method, $arguments) { |
|
71 | 71 | $this->$method(...$arguments); |
72 | 72 | }; |
73 | 73 | } |
@@ -27,13 +27,13 @@ |
||
27 | 27 | |
28 | 28 | // Defining expectations. |
29 | 29 | $resolver->shouldReceive('reflectCallable') |
30 | - ->with([TestClass::class, 'setValue']) |
|
31 | - ->andReturn($reflection) |
|
32 | - ->once(); |
|
30 | + ->with([TestClass::class, 'setValue']) |
|
31 | + ->andReturn($reflection) |
|
32 | + ->once(); |
|
33 | 33 | $resolver->shouldReceive('resolveArguments') |
34 | - ->with($reflection) |
|
35 | - ->andReturn($callback) |
|
36 | - ->once(); |
|
34 | + ->with($reflection) |
|
35 | + ->andReturn($callback) |
|
36 | + ->once(); |
|
37 | 37 | |
38 | 38 | // Creating inflector, setting resolver, adding inflection. |
39 | 39 | $inflector = new ObjectInflector($resolver); |
@@ -18,7 +18,7 @@ |
||
18 | 18 | // Callback to be returned by ArgumentResolver::resolveArguments() method. |
19 | 19 | // Expects $arguments array to contain 'value' key to merge. |
20 | 20 | // Will return array of arguments for TestClass::setValue() method call. |
21 | - $callback = function (array $arguments) { |
|
21 | + $callback = function(array $arguments) { |
|
22 | 22 | return array_values(array_merge(['value' => 'to be replaced'], $arguments)); |
23 | 23 | }; |
24 | 24 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | public function canReflectFunction() |
20 | 20 | { |
21 | 21 | $resolver = new ArgumentResolver(Mockery::mock(Container::class)); |
22 | - $reflection = $resolver->reflectCallable(function () { |
|
22 | + $reflection = $resolver->reflectCallable(function() { |
|
23 | 23 | }); |
24 | 24 | |
25 | 25 | $this->assertInstanceOf(ReflectionFunction::class, $reflection); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | public function canResolveOptionalArguments() |
43 | 43 | { |
44 | 44 | $resolver = new ArgumentResolver(Mockery::mock(Container::class)); |
45 | - $function = function (string $scalar = 'reso') { |
|
45 | + $function = function(string $scalar = 'reso') { |
|
46 | 46 | return $scalar . 'lved'; |
47 | 47 | }; |
48 | 48 | $closure = $resolver->resolveArguments(new ReflectionFunction($function)); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $container->shouldReceive('has')->with(TestClassContract::class)->andReturn(true)->once(); |
63 | 63 | $container->shouldReceive('get')->with(TestClassContract::class)->andReturn($mock)->once(); |
64 | 64 | |
65 | - $function = function (TestClassContract $test) { |
|
65 | + $function = function(TestClassContract $test) { |
|
66 | 66 | return $test; |
67 | 67 | }; |
68 | 68 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | public function canResolveWithPassedArguments() |
82 | 82 | { |
83 | 83 | $resolver = new ArgumentResolver(Mockery::mock(Container::class)); |
84 | - $function = function (string $scalar) { |
|
84 | + $function = function(string $scalar) { |
|
85 | 85 | return $scalar . 'd'; |
86 | 86 | }; |
87 | 87 | $closure = $resolver->resolveArguments(new ReflectionFunction($function)); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | public function canResolveWithoutArguments() |
98 | 98 | { |
99 | 99 | $resolver = new ArgumentResolver(Mockery::mock(Container::class)); |
100 | - $function = function () { |
|
100 | + $function = function() { |
|
101 | 101 | return 'resolved'; |
102 | 102 | }; |
103 | 103 | $closure = $resolver->resolveArguments(new ReflectionFunction($function)); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $container->shouldReceive('has')->with(TestClassContract::class)->andReturn(false)->once(); |
119 | 119 | $container->shouldNotReceive('get'); |
120 | 120 | |
121 | - $function = function (TestClassContract $test) { |
|
121 | + $function = function(TestClassContract $test) { |
|
122 | 122 | return $test; |
123 | 123 | }; |
124 | 124 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | public function failsToResolveMandatoryScalarArguments() |
138 | 138 | { |
139 | 139 | $resolver = new ArgumentResolver(Mockery::mock(Container::class)); |
140 | - $function = function (string $scalar) { |
|
140 | + $function = function(string $scalar) { |
|
141 | 141 | return $scalar . 'd'; |
142 | 142 | }; |
143 | 143 | $closure = $resolver->resolveArguments(new ReflectionFunction($function)); |
@@ -353,11 +353,11 @@ discard block |
||
353 | 353 | public function canResolveFromInvokableObject() |
354 | 354 | { |
355 | 355 | $factory = Mockery::mock(TestClassFactory::class) |
356 | - ->shouldReceive('__invoke') |
|
357 | - ->withNoArgs() |
|
358 | - ->andReturn(Mockery::mock(TestClassContract::class)) |
|
359 | - ->once() |
|
360 | - ->getMock(); |
|
356 | + ->shouldReceive('__invoke') |
|
357 | + ->withNoArgs() |
|
358 | + ->andReturn(Mockery::mock(TestClassContract::class)) |
|
359 | + ->once() |
|
360 | + ->getMock(); |
|
361 | 361 | |
362 | 362 | $container = new Venta\Container\Container; |
363 | 363 | $container->bindFactory(TestClassContract::class, $factory); |
@@ -370,11 +370,11 @@ discard block |
||
370 | 370 | public function canResolveFromObjectMethodArray() |
371 | 371 | { |
372 | 372 | $factory = Mockery::mock(TestClassFactory::class) |
373 | - ->shouldReceive('create') |
|
374 | - ->withNoArgs() |
|
375 | - ->andReturn(Mockery::mock(TestClassContract::class)) |
|
376 | - ->once() |
|
377 | - ->getMock(); |
|
373 | + ->shouldReceive('create') |
|
374 | + ->withNoArgs() |
|
375 | + ->andReturn(Mockery::mock(TestClassContract::class)) |
|
376 | + ->once() |
|
377 | + ->getMock(); |
|
378 | 378 | |
379 | 379 | $container = new Venta\Container\Container; |
380 | 380 | $container->bindFactory(TestClassContract::class, [$factory, 'create']); |
@@ -462,15 +462,15 @@ discard block |
||
462 | 462 | $reflection = new ReflectionFunction($closure); |
463 | 463 | $resolver = Mockery::mock(\Venta\Contracts\Container\ArgumentResolver::class); |
464 | 464 | $resolver->shouldReceive('reflectCallable') |
465 | - ->with($closure) |
|
466 | - ->andReturn($reflection) |
|
467 | - ->once(); |
|
465 | + ->with($closure) |
|
466 | + ->andReturn($reflection) |
|
467 | + ->once(); |
|
468 | 468 | $resolver->shouldReceive('resolveArguments') |
469 | - ->with($reflection) |
|
470 | - ->andReturn(function () { |
|
471 | - return [new stdClass()]; |
|
472 | - }) |
|
473 | - ->once(); |
|
469 | + ->with($reflection) |
|
470 | + ->andReturn(function () { |
|
471 | + return [new stdClass()]; |
|
472 | + }) |
|
473 | + ->once(); |
|
474 | 474 | |
475 | 475 | $inflector = Mockery::mock(ObjectInflector::class); |
476 | 476 | $inflector->shouldReceive('applyInflections'); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $object = new stdClass(); |
96 | 96 | $object->key = 'value'; |
97 | 97 | $container->bindInstance(stdClass::class, $object); |
98 | - $result = $container->call(function (stdClass $dependency) { |
|
98 | + $result = $container->call(function(stdClass $dependency) { |
|
99 | 99 | return $dependency->key; |
100 | 100 | }); |
101 | 101 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | { |
167 | 167 | $container = new Venta\Container\Container; |
168 | 168 | $container->bindInstance(TestClassContract::class, new TestClass(new stdClass)); |
169 | - $container->decorate(TestClassContract::class, function ($previous) { |
|
169 | + $container->decorate(TestClassContract::class, function($previous) { |
|
170 | 170 | return new class($previous) implements TestClassContract |
171 | 171 | { |
172 | 172 | }; |
@@ -184,10 +184,10 @@ discard block |
||
184 | 184 | public function canDecorateFactoryDefinedBinding() |
185 | 185 | { |
186 | 186 | $container = new Venta\Container\Container; |
187 | - $container->bindFactory(TestClassContract::class, function () { |
|
187 | + $container->bindFactory(TestClassContract::class, function() { |
|
188 | 188 | return new TestClass(new stdClass); |
189 | 189 | }); |
190 | - $container->decorate(TestClassContract::class, function ($previous) { |
|
190 | + $container->decorate(TestClassContract::class, function($previous) { |
|
191 | 191 | return new class($previous) implements TestClassContract |
192 | 192 | { |
193 | 193 | }; |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | { |
207 | 207 | $container = new Venta\Container\Container; |
208 | 208 | $container->bindClass(TestClassContract::class, TestClass::class); |
209 | - $container->decorate(TestClassContract::class, function ($previous) { |
|
209 | + $container->decorate(TestClassContract::class, function($previous) { |
|
210 | 210 | return new class($previous) implements TestClassContract |
211 | 211 | { |
212 | 212 | }; |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | public function canResolveFromClosure() |
306 | 306 | { |
307 | 307 | $container = new Venta\Container\Container; |
308 | - $container->bindFactory(stdClass::class, function () { |
|
308 | + $container->bindFactory(stdClass::class, function() { |
|
309 | 309 | return new stdClass; |
310 | 310 | }); |
311 | 311 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | public function canResolveFromClosureWithArguments() |
319 | 319 | { |
320 | 320 | $container = new Venta\Container\Container; |
321 | - $container->bindFactory(TestClassContract::class, function (TestClass $class) { |
|
321 | + $container->bindFactory(TestClassContract::class, function(TestClass $class) { |
|
322 | 322 | return $class; |
323 | 323 | }); |
324 | 324 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | public function canResolveSharedFromClosure() |
403 | 403 | { |
404 | 404 | $container = new Venta\Container\Container; |
405 | - $container->bindFactory(stdClass::class, function () { |
|
405 | + $container->bindFactory(stdClass::class, function() { |
|
406 | 406 | return new stdClass; |
407 | 407 | }, true); |
408 | 408 | |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | */ |
457 | 457 | public function savesReflectionResolveResult() |
458 | 458 | { |
459 | - $closure = function (stdClass $dep) { |
|
459 | + $closure = function(stdClass $dep) { |
|
460 | 460 | return new TestClass($dep); |
461 | 461 | }; |
462 | 462 | $reflection = new ReflectionFunction($closure); |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | ->once(); |
468 | 468 | $resolver->shouldReceive('resolveArguments') |
469 | 469 | ->with($reflection) |
470 | - ->andReturn(function () { |
|
470 | + ->andReturn(function() { |
|
471 | 471 | return [new stdClass()]; |
472 | 472 | }) |
473 | 473 | ->once(); |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | public function throwsContainerExceptionIfCantResolve() |
502 | 502 | { |
503 | 503 | $container = new Venta\Container\Container; |
504 | - $container->bindFactory(TestClassContract::class, function ($someUnresolvableDependency) { |
|
504 | + $container->bindFactory(TestClassContract::class, function($someUnresolvableDependency) { |
|
505 | 505 | }); |
506 | 506 | $container->get(TestClassContract::class); |
507 | 507 | } |
@@ -59,7 +59,7 @@ |
||
59 | 59 | $this->container->bindClass(RoutePathParserContract::class, RoutePathParser::class, true); |
60 | 60 | $this->container->bindClass(FastRouteRouteParser::class, RoutePathParserContract::class); |
61 | 61 | |
62 | - $this->container->bindFactory(RouteCollector::class, function (FastRouteRouteParser $routePathParser) { |
|
62 | + $this->container->bindFactory(RouteCollector::class, function(FastRouteRouteParser $routePathParser) { |
|
63 | 63 | return new RouteCollector($routePathParser, new GroupCountBased); |
64 | 64 | }, true); |
65 | 65 | } |
@@ -25,11 +25,11 @@ |
||
25 | 25 | public function boot() |
26 | 26 | { |
27 | 27 | // todo: refactor along with console package. |
28 | - $this->container->bindFactory(InputInterface::class, function () { |
|
28 | + $this->container->bindFactory(InputInterface::class, function() { |
|
29 | 29 | return new ArgvInput; |
30 | 30 | }, true); |
31 | 31 | |
32 | - $this->container->bindFactory(OutputInterface::class, function () { |
|
32 | + $this->container->bindFactory(OutputInterface::class, function() { |
|
33 | 33 | return new ConsoleOutput; |
34 | 34 | }, true); |
35 | 35 |