Passed
Push — master ( 4be7e4...e88381 )
by butschster
07:01
created
src/Core/src/Container.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
     use DestructorTrait;
45 45
 
46 46
     private Internal\State $state;
47
-    private ResolverInterface|Internal\Resolver $resolver;
48
-    private FactoryInterface|Internal\Factory $factory;
49
-    private ContainerInterface|Internal\Container $container;
50
-    private BinderInterface|Internal\Binder $binder;
51
-    private InvokerInterface|Internal\Invoker $invoker;
47
+    private ResolverInterface | Internal\Resolver $resolver;
48
+    private FactoryInterface | Internal\Factory $factory;
49
+    private ContainerInterface | Internal\Container $container;
50
+    private BinderInterface | Internal\Binder $binder;
51
+    private InvokerInterface | Internal\Invoker $invoker;
52 52
 
53 53
     /**
54 54
      * Container constructor.
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
         $constructor = new Internal\Registry($config, [
59 59
             'state' => new Internal\State(),
60 60
         ]);
61
-        foreach ($config as $property => $class) {
62
-            if (\property_exists($this, $property)) {
61
+        foreach ($config as $property => $class){
62
+            if (\property_exists($this, $property)){
63 63
                 $this->$property = $constructor->get($property, $class);
64 64
             }
65 65
         }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      *
132 132
      * @psalm-suppress PossiblyInvalidArgument, PossiblyInvalidCast
133 133
      */
134
-    public function get(string|Autowire $id, string $context = null): mixed
134
+    public function get(string | Autowire $id, string $context = null): mixed
135 135
     {
136 136
         return $this->container->get($id, $context);
137 137
     }
@@ -145,26 +145,26 @@  discard block
 block discarded – undo
145 145
     {
146 146
         $binds = &$this->state->bindings;
147 147
         $cleanup = $previous = [];
148
-        foreach ($bindings as $alias => $resolver) {
149
-            if (isset($binds[$alias])) {
148
+        foreach ($bindings as $alias => $resolver){
149
+            if (isset($binds[$alias])){
150 150
                 $previous[$alias] = $binds[$alias];
151
-            } else {
151
+            }else{
152 152
                 $cleanup[] = $alias;
153 153
             }
154 154
 
155 155
             $this->binder->bind($alias, $resolver);
156 156
         }
157 157
 
158
-        try {
158
+        try{
159 159
             return ContainerScope::getContainer() !== $this
160 160
                 ? ContainerScope::runScope($this, $scope)
161 161
                 : $scope($this);
162
-        } finally {
163
-            foreach ($previous as $alias => $resolver) {
162
+        }finally{
163
+            foreach ($previous as $alias => $resolver){
164 164
                 $binds[$alias] = $resolver;
165 165
             }
166 166
 
167
-            foreach ($cleanup as $alias) {
167
+            foreach ($cleanup as $alias){
168 168
                 unset($binds[$alias]);
169 169
             }
170 170
         }
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      * for each method call), function array or Closure (executed every call). Only object resolvers
176 176
      * supported by this method.
177 177
      */
178
-    public function bind(string $alias, string|array|callable|object $resolver): void
178
+    public function bind(string $alias, string | array | callable | object $resolver): void
179 179
     {
180 180
         $this->binder->bind($alias, $resolver);
181 181
     }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      *
187 187
      * @psalm-param TResolver $resolver
188 188
      */
189
-    public function bindSingleton(string $alias, string|array|callable|object $resolver): void
189
+    public function bindSingleton(string $alias, string | array | callable | object $resolver): void
190 190
     {
191 191
         $this->binder->bindSingleton($alias, $resolver);
192 192
     }
Please login to merge, or discard this patch.
Braces   +20 added lines, -9 removed lines patch added patch discarded remove patch
@@ -58,8 +58,10 @@  discard block
 block discarded – undo
58 58
         $constructor = new Internal\Registry($config, [
59 59
             'state' => new Internal\State(),
60 60
         ]);
61
-        foreach ($config as $property => $class) {
62
-            if (\property_exists($this, $property)) {
61
+        foreach ($config as $property => $class)
62
+        {
63
+            if (\property_exists($this, $property))
64
+            {
63 65
                 $this->$property = $constructor->get($property, $class);
64 66
             }
65 67
         }
@@ -145,26 +147,35 @@  discard block
 block discarded – undo
145 147
     {
146 148
         $binds = &$this->state->bindings;
147 149
         $cleanup = $previous = [];
148
-        foreach ($bindings as $alias => $resolver) {
149
-            if (isset($binds[$alias])) {
150
+        foreach ($bindings as $alias => $resolver)
151
+        {
152
+            if (isset($binds[$alias]))
153
+            {
150 154
                 $previous[$alias] = $binds[$alias];
151
-            } else {
155
+            }
156
+            else
157
+            {
152 158
                 $cleanup[] = $alias;
153 159
             }
154 160
 
155 161
             $this->binder->bind($alias, $resolver);
156 162
         }
157 163
 
158
-        try {
164
+        try
165
+        {
159 166
             return ContainerScope::getContainer() !== $this
160 167
                 ? ContainerScope::runScope($this, $scope)
161 168
                 : $scope($this);
162
-        } finally {
163
-            foreach ($previous as $alias => $resolver) {
169
+        }
170
+        finally
171
+        {
172
+            foreach ($previous as $alias => $resolver)
173
+            {
164 174
                 $binds[$alias] = $resolver;
165 175
             }
166 176
 
167
-            foreach ($cleanup as $alias) {
177
+            foreach ($cleanup as $alias)
178
+            {
168 179
                 unset($binds[$alias]);
169 180
             }
170 181
         }
Please login to merge, or discard this patch.