Completed
Pull Request — 6.0 (#1895)
by nhzex
04:53
created
tests/ContainerTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
         Container::setInstance($container);
59 59
 
60
-        $container->bind('name', function () {
60
+        $container->bind('name', function() {
61 61
             return 'Taylor';
62 62
         });
63 63
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $this->expectExceptionMessage('class not exists: name');
75 75
         $container->get('name');
76 76
 
77
-        $container->bind('name', function () {
77
+        $container->bind('name', function() {
78 78
             return 'Taylor';
79 79
         });
80 80
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     {
86 86
         $container = new Container;
87 87
 
88
-        $container->bind('name', function () {
88
+        $container->bind('name', function() {
89 89
             return 'Taylor';
90 90
         });
91 91
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     {
101 101
         $container = new Container;
102 102
 
103
-        $container->bind('name', function () {
103
+        $container->bind('name', function() {
104 104
             return 'Taylor';
105 105
         });
106 106
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
         $this->assertSame($object, Container::getInstance());
194 194
 
195
-        Container::setInstance(function () {
195
+        Container::setInstance(function() {
196 196
             return $this;
197 197
         });
198 198
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         $this->expectException(Exception::class);
213 213
         $this->expectExceptionMessageRegExp('/function not exists: {Closure}@.+#L\d+-\d+/');
214 214
         $container = new Container;
215
-        $container->invokeFunction(function () {
215
+        $container->invokeFunction(function() {
216 216
             throw new \ReflectionException('test exception');
217 217
         });
218 218
     }
@@ -231,17 +231,17 @@  discard block
 block discarded – undo
231 231
 
232 232
         $container->invokeMethod([$stub, 'some']);
233 233
 
234
-        $this->assertSame($container, $container->invokeMethod(Taylor::class . '::static'));
234
+        $this->assertSame($container, $container->invokeMethod(Taylor::class.'::static'));
235 235
 
236 236
         $reflect = new ReflectionMethod($container, 'exists');
237 237
 
238 238
         $this->assertTrue($container->invokeReflectMethod($container, $reflect, [Container::class]));
239 239
 
240
-        $this->assertSame($container, $container->invoke(function (Container $container) {
240
+        $this->assertSame($container, $container->invoke(function(Container $container) {
241 241
             return $container;
242 242
         }));
243 243
 
244
-        $this->assertSame($container, $container->invoke(Taylor::class . '::static'));
244
+        $this->assertSame($container, $container->invoke(Taylor::class.'::static'));
245 245
 
246 246
         $object = $container->invokeClass(SomeClass::class);
247 247
         $this->assertInstanceOf(SomeClass::class, $object);
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 
250 250
         $stdClass = new stdClass();
251 251
 
252
-        $container->invoke(function (Container $container, stdClass $stdObject, $key1, $lowKey, $key2 = 'default') use ($stdClass) {
252
+        $container->invoke(function(Container $container, stdClass $stdObject, $key1, $lowKey, $key2 = 'default') use ($stdClass) {
253 253
             $this->assertEquals('value1', $key1);
254 254
             $this->assertEquals('default', $key2);
255 255
             $this->assertEquals('value2', $lowKey);
Please login to merge, or discard this patch.
src/think/Container.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think;
14 14
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
             return $this->make($abstract);
172 172
         }
173 173
 
174
-        throw new ClassNotFoundException('class not exists: ' . $abstract, $abstract);
174
+        throw new ClassNotFoundException('class not exists: '.$abstract, $abstract);
175 175
     }
176 176
 
177 177
     /**
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
             } else {
337 337
                 $function .= '()';
338 338
             }
339
-            throw new Exception('function not exists: ' . $function, 0, $e);
339
+            throw new Exception('function not exists: '.$function, 0, $e);
340 340
         }
341 341
     }
342 342
 
@@ -364,12 +364,12 @@  discard block
 block discarded – undo
364 364
         } catch (ReflectionException $e) {
365 365
             if (is_array($method)) {
366 366
                 $class    = is_object($method[0]) ? get_class($method[0]) : $method[0];
367
-                $callback = $class . '::' . $method[1];
367
+                $callback = $class.'::'.$method[1];
368 368
             } else {
369 369
                 $callback = $method;
370 370
             }
371 371
 
372
-            throw new Exception('method not exists: ' . $callback . '()', 0, $e);
372
+            throw new Exception('method not exists: '.$callback.'()', 0, $e);
373 373
         }
374 374
     }
375 375
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 
436 436
             return $object;
437 437
         } catch (ReflectionException $e) {
438
-            throw new ClassNotFoundException('class not exists: ' . $class, $class, $e);
438
+            throw new ClassNotFoundException('class not exists: '.$class, $class, $e);
439 439
         }
440 440
     }
441 441
 
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
             } elseif ($param->isDefaultValueAvailable()) {
497 497
                 $args[] = $param->getDefaultValue();
498 498
             } else {
499
-                throw new InvalidArgumentException('method param miss:' . $name);
499
+                throw new InvalidArgumentException('method param miss:'.$name);
500 500
             }
501 501
         }
502 502
 
Please login to merge, or discard this patch.