Passed
Push — master ( cafdd0...f4a7a1 )
by Alexey
03:53
created
src/Container/src/ArgumentResolver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,13 +50,13 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/Container/src/ObjectInflector.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
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
                 }
Please login to merge, or discard this patch.
src/Container/tests/ObjectInflectorTest.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Container/tests/ArgumentResolverTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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));
Please login to merge, or discard this patch.
src/Container/tests/ContainerTest.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -353,11 +353,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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');
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Framework/ServiceProvider/RoutingServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Framework/ServiceProvider/ConsoleServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Framework/Kernel/Bootstrap/Logging.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     public function boot()
24 24
     {
25 25
         // todo: implement multi-channel configuration.
26
-        $this->container->bindFactory(LoggerInterface::class, function (Config $config) {
26
+        $this->container->bindFactory(LoggerInterface::class, function(Config $config) {
27 27
 
28 28
             $handler = new StreamHandler(
29 29
                 $this->kernel->getRootPath() . '/storage/logs/venta.log',
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
             $handler->pushProcessor(new PsrLogMessageProcessor);
34 34
 
35 35
             if (!$this->kernel->isCli()) {
36
-                $handler->pushProcessor(new WebProcessor(null, [ // todo: make list configurable?
36
+                $handler->pushProcessor(new WebProcessor(null, [// todo: make list configurable?
37 37
                     'url' => 'REQUEST_URI',
38 38
                     'ip' => 'REMOTE_ADDR',
39 39
                     'http_method' => 'REQUEST_METHOD',
Please login to merge, or discard this patch.
src/Framework/tests/HttpApplicationTest.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,8 +70,8 @@
 block discarded – undo
70 70
         $middlewareCollector->shouldReceive('pushMiddleware')->with('name', 'middleware')->once();
71 71
         $strategy->shouldReceive('dispatch')->with($route)->andReturn($response)->once();
72 72
         $pipeline->shouldReceive('handle')
73
-                 ->with($request, Mockery::type(Closure::class)
74
-                 )->andReturnUsing(function ($request, $last) {
73
+                    ->with($request, Mockery::type(Closure::class)
74
+                    )->andReturnUsing(function ($request, $last) {
75 75
                 return $last($request);
76 76
             })->once();
77 77
         $emitter->shouldReceive('emit')->with($response)->once();
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
         $strategy->shouldReceive('dispatch')->with($route)->andReturn($response)->once();
72 72
         $pipeline->shouldReceive('handle')
73 73
                  ->with($request, Mockery::type(Closure::class)
74
-                 )->andReturnUsing(function ($request, $last) {
74
+                 )->andReturnUsing(function($request, $last) {
75 75
                 return $last($request);
76 76
             })->once();
77 77
         $emitter->shouldReceive('emit')->with($response)->once();
Please login to merge, or discard this patch.