Passed
Pull Request — master (#736)
by Abdul Malik
07:17 queued 45s
created
src/Core/tests/FactoryTest.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,8 @@  discard block
 block discarded – undo
41 41
         $container = new Container();
42 42
         $this->assertInstanceOf(FactoryInterface::class, $container);
43 43
 
44
-        $container->bind(Bucket::class, function ($data) {
44
+        $container->bind(Bucket::class, function ($data)
45
+        {
45 46
             return new Bucket('via-closure', $data);
46 47
         });
47 48
 
@@ -78,7 +79,8 @@  discard block
 block discarded – undo
78 79
         $sample = new SampleClass();
79 80
 
80 81
         $container->bind(Bucket::class, [self::class, 'makeBucketWithSample']);
81
-        $container->bind(SampleClass::class, function () use ($sample) {
82
+        $container->bind(SampleClass::class, function () use ($sample)
83
+        {
82 84
             return $sample;
83 85
         });
84 86
 
Please login to merge, or discard this patch.
src/Core/tests/ScopesTest.php 1 patch
Braces   +16 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,7 +27,8 @@  discard block
 block discarded – undo
27 27
 
28 28
         $this->assertNull(ContainerScope::getContainer());
29 29
 
30
-        $this->assertTrue(ContainerScope::runScope($container, function () use ($container) {
30
+        $this->assertTrue(ContainerScope::runScope($container, function () use ($container)
31
+        {
31 32
             return $container === ContainerScope::getContainer();
32 33
         }));
33 34
 
@@ -40,11 +41,14 @@  discard block
 block discarded – undo
40 41
 
41 42
         $this->assertNull(ContainerScope::getContainer());
42 43
 
43
-        try {
44
+        try
45
+        {
44 46
             $this->assertTrue(ContainerScope::runScope($container, function () use ($container): void {
45 47
                 throw new RuntimeException('exception');
46 48
             }));
47
-        } catch (\Throwable $e) {
49
+        }
50
+        catch (\Throwable $e)
51
+        {
48 52
         }
49 53
 
50 54
         $this->assertInstanceOf(RuntimeException::class, $e);
@@ -62,7 +66,8 @@  discard block
 block discarded – undo
62 66
         $this->assertTrue($c->runScope([
63 67
             'bucket' => new Bucket('b'),
64 68
             'other'  => new SampleClass()
65
-        ], function () use ($c) {
69
+        ], function () use ($c)
70
+        {
66 71
             $this->assertSame('b', $c->get('bucket')->getName());
67 72
             $this->assertTrue($c->has('other'));
68 73
 
@@ -84,21 +89,25 @@  discard block
 block discarded – undo
84 89
         $this->assertTrue($c->runScope([
85 90
             'bucket' => new Bucket('b'),
86 91
             'other'  => new SampleClass()
87
-        ], function () use ($c) {
92
+        ], function () use ($c)
93
+        {
88 94
             $this->assertSame('b', $c->get('bucket')->getName());
89 95
             $this->assertTrue($c->has('other'));
90 96
 
91 97
             return $c->get('bucket')->getName() == 'b' && $c->has('other');
92 98
         }));
93 99
 
94
-        try {
100
+        try
101
+        {
95 102
             $this->assertTrue($c->runScope([
96 103
                 'bucket' => new Bucket('b'),
97 104
                 'other'  => new SampleClass()
98 105
             ], function () use ($c): void {
99 106
                 throw new RuntimeException('exception');
100 107
             }));
101
-        } catch (\Throwable $e) {
108
+        }
109
+        catch (\Throwable $e)
110
+        {
102 111
         }
103 112
 
104 113
         $this->assertSame('a', $c->get('bucket')->getName());
Please login to merge, or discard this patch.
src/Core/tests/SingletonsTest.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,7 +60,8 @@  discard block
 block discarded – undo
60 60
 
61 61
         $instance = new SampleClass();
62 62
 
63
-        $container->bindSingleton('sampleClass', function () use ($instance) {
63
+        $container->bindSingleton('sampleClass', function () use ($instance)
64
+        {
64 65
             return $instance;
65 66
         });
66 67
 
@@ -71,7 +72,8 @@  discard block
 block discarded – undo
71 72
     {
72 73
         $container = new Container();
73 74
 
74
-        $container->bindSingleton('sampleClass', function () {
75
+        $container->bindSingleton('sampleClass', function ()
76
+        {
75 77
             return new SampleClass();
76 78
         });
77 79
 
@@ -98,7 +100,8 @@  discard block
 block discarded – undo
98 100
         $container = new Container();
99 101
         $container->bindSingleton('singleton', 'sampleClass');
100 102
 
101
-        $container->bind('sampleClass', function () {
103
+        $container->bind('sampleClass', function ()
104
+        {
102 105
             return new SampleClass();
103 106
         });
104 107
 
Please login to merge, or discard this patch.
src/Core/tests/InjectableTest.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -125,7 +125,8 @@  discard block
 block discarded – undo
125 125
         $container->bind(ConfigsInterface::class, $configurator);
126 126
 
127 127
         $configurator->shouldReceive('createInjection')
128
-            ->with(m::on(static function (ReflectionClass $r) {
128
+            ->with(m::on(static function (ReflectionClass $r)
129
+            {
129 130
                 return $r->getName() === TestConfig::class;
130 131
             }), null)
131 132
             ->andReturn($expected)
@@ -143,7 +144,8 @@  discard block
 block discarded – undo
143 144
         $container->bind(ConfigsInterface::class, $configurator);
144 145
 
145 146
         $configurator->shouldReceive('createInjection')
146
-            ->with(m::on(static function (ReflectionClass $r) {
147
+            ->with(m::on(static function (ReflectionClass $r)
148
+            {
147 149
                 return $r->getName() === TestConfig::class;
148 150
             }), 'context')
149 151
             ->andReturn($expected)
@@ -161,7 +163,8 @@  discard block
 block discarded – undo
161 163
         $container->bind(ConfigsInterface::class, $configurator);
162 164
 
163 165
         $configurator->shouldReceive('createInjection')
164
-            ->with(m::on(static function (ReflectionClass $r) {
166
+            ->with(m::on(static function (ReflectionClass $r)
167
+            {
165 168
                 return $r->getName() === TestConfig::class;
166 169
             }), 'contextArgument')
167 170
             ->andReturn($expected)
Please login to merge, or discard this patch.
src/Core/tests/BindingsTest.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,8 @@  discard block
 block discarded – undo
25 25
 
26 26
         $this->assertFalse($container->has('abc'));
27 27
 
28
-        $container->bind('abc', function () {
28
+        $container->bind('abc', function ()
29
+        {
29 30
             return 'hello';
30 31
         });
31 32
 
@@ -38,7 +39,8 @@  discard block
 block discarded – undo
38 39
         $container = new Container();
39 40
 
40 41
         $this->assertFalse($container->has('abc'));
41
-        $container->bind('abc', function () {
42
+        $container->bind('abc', function ()
43
+        {
42 44
             return 'hello';
43 45
         });
44 46
 
Please login to merge, or discard this patch.
src/Core/src/ContainerScope.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,11 +46,16 @@
 block discarded – undo
46 46
     {
47 47
         [$previous, self::$container] = [self::$container, $container];
48 48
 
49
-        try {
49
+        try
50
+        {
50 51
             return $scope();
51
-        } catch (Throwable $e) {
52
+        }
53
+        catch (Throwable $e)
54
+        {
52 55
             throw $e;
53
-        } finally {
56
+        }
57
+        finally
58
+        {
54 59
             self::$container = $previous;
55 60
         }
56 61
     }
Please login to merge, or discard this patch.
src/Core/src/Exception/Container/ArgumentException.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,8 @@
 block discarded – undo
44 44
         $this->context = $context;
45 45
 
46 46
         $name = $context->getName();
47
-        if ($context instanceof ReflectionMethod) {
47
+        if ($context instanceof ReflectionMethod)
48
+        {
48 49
             $name = $context->class . '::' . $name;
49 50
         }
50 51
 
Please login to merge, or discard this patch.
src/Core/src/Container/Autowire.php 1 patch
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,22 +58,26 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public static function wire($definition): Autowire
60 60
     {
61
-        if ($definition instanceof self) {
61
+        if ($definition instanceof self)
62
+        {
62 63
             return $definition;
63 64
         }
64 65
 
65
-        if (is_string($definition)) {
66
+        if (is_string($definition))
67
+        {
66 68
             return new Autowire($definition);
67 69
         }
68 70
 
69
-        if (is_array($definition) && isset($definition['class'])) {
71
+        if (is_array($definition) && isset($definition['class']))
72
+        {
70 73
             return new Autowire(
71 74
                 $definition['class'],
72 75
                 $definition['options'] ?? $definition['params'] ?? []
73 76
             );
74 77
         }
75 78
 
76
-        if (is_object($definition)) {
79
+        if (is_object($definition))
80
+        {
77 81
             $autowire = new self(get_class($definition), []);
78 82
             $autowire->target = $definition;
79 83
             return $autowire;
@@ -92,7 +96,8 @@  discard block
 block discarded – undo
92 96
      */
93 97
     public function resolve(FactoryInterface $factory, array $parameters = [])
94 98
     {
95
-        if ($this->target !== null) {
99
+        if ($this->target !== null)
100
+        {
96 101
             // pre-wired
97 102
             return $this->target;
98 103
         }
Please login to merge, or discard this patch.
src/Framework/Translator/Views/LocaleProcessor.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,8 @@
 block discarded – undo
54 54
         return $source->withCode(
55 55
             preg_replace_callback(
56 56
                 self::REGEXP,
57
-                function ($matches) use ($domain, $context) {
57
+                function ($matches) use ($domain, $context)
58
+                {
58 59
                     return $this->translator->trans(
59 60
                         $matches[1],
60 61
                         [],
Please login to merge, or discard this patch.