Completed
Push — 6.0 ( bcbae5...1124c5 )
by liu
05:09 queued 11s
created
tests/ContainerTest.php 1 patch
Spacing   +9 added lines, -9 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
 
@@ -221,17 +221,17 @@  discard block
 block discarded – undo
221 221
 
222 222
         $container->invokeMethod([$stub, 'some']);
223 223
 
224
-        $this->assertSame($container, $container->invokeMethod(Taylor::class . '::test'));
224
+        $this->assertSame($container, $container->invokeMethod(Taylor::class.'::test'));
225 225
 
226 226
         $reflect = new ReflectionMethod($container, 'exists');
227 227
 
228 228
         $this->assertTrue($container->invokeReflectMethod($container, $reflect, [Container::class]));
229 229
 
230
-        $this->assertSame($container, $container->invoke(function (Container $container) {
230
+        $this->assertSame($container, $container->invoke(function(Container $container) {
231 231
             return $container;
232 232
         }));
233 233
 
234
-        $this->assertSame($container, $container->invoke(Taylor::class . '::test'));
234
+        $this->assertSame($container, $container->invoke(Taylor::class.'::test'));
235 235
 
236 236
         $object = $container->invokeClass(SomeClass::class);
237 237
         $this->assertInstanceOf(SomeClass::class, $object);
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 
240 240
         $stdClass = new stdClass();
241 241
 
242
-        $container->invoke(function (Container $container, stdClass $stdObject, $key1, $lowKey, $key2 = 'default') use ($stdClass) {
242
+        $container->invoke(function(Container $container, stdClass $stdObject, $key1, $lowKey, $key2 = 'default') use ($stdClass) {
243 243
             $this->assertEquals('value1', $key1);
244 244
             $this->assertEquals('default', $key2);
245 245
             $this->assertEquals('value2', $lowKey);
Please login to merge, or discard this patch.
src/think/Container.php 1 patch
Spacing   +10 added lines, -10 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
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             return $this->make($abstract);
131 131
         }
132 132
 
133
-        throw new ClassNotFoundException('class not exists: ' . $abstract, $abstract);
133
+        throw new ClassNotFoundException('class not exists: '.$abstract, $abstract);
134 134
     }
135 135
 
136 136
     /**
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 
289 289
             return call_user_func_array($function, $args);
290 290
         } catch (ReflectionException $e) {
291
-            throw new Exception('function not exists: ' . $function . '()');
291
+            throw new Exception('function not exists: '.$function.'()');
292 292
         }
293 293
     }
294 294
 
@@ -316,12 +316,12 @@  discard block
 block discarded – undo
316 316
         } catch (ReflectionException $e) {
317 317
             if (is_array($method)) {
318 318
                 $class    = is_object($method[0]) ? get_class($method[0]) : $method[0];
319
-                $callback = $class . '::' . $method[1];
319
+                $callback = $class.'::'.$method[1];
320 320
             } else {
321 321
                 $callback = $method;
322 322
             }
323 323
 
324
-            throw new Exception('method not exists: ' . $callback . '()');
324
+            throw new Exception('method not exists: '.$callback.'()');
325 325
         }
326 326
     }
327 327
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 
388 388
             return $object;
389 389
         } catch (ReflectionException $e) {
390
-            throw new ClassNotFoundException('class not exists: ' . $class, $class);
390
+            throw new ClassNotFoundException('class not exists: '.$class, $class);
391 391
         }
392 392
     }
393 393
 
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
             } elseif ($param->isDefaultValueAvailable()) {
449 449
                 $args[] = $param->getDefaultValue();
450 450
             } else {
451
-                throw new InvalidArgumentException('method param miss:' . $name);
451
+                throw new InvalidArgumentException('method param miss:'.$name);
452 452
             }
453 453
         }
454 454
 
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
     public static function parseName(string $name = null, int $type = 0, bool $ucfirst = true): string
468 468
     {
469 469
         if ($type) {
470
-            $name = preg_replace_callback('/_([a-zA-Z])/', function ($match) {
470
+            $name = preg_replace_callback('/_([a-zA-Z])/', function($match) {
471 471
                 return strtoupper($match[1]);
472 472
             }, $name);
473 473
             return $ucfirst ? ucfirst($name) : lcfirst($name);
@@ -498,13 +498,13 @@  discard block
 block discarded – undo
498 498
      */
499 499
     public static function factory(string $name, string $namespace = '', ...$args)
500 500
     {
501
-        $class = false !== strpos($name, '\\') ? $name : $namespace . ucwords($name);
501
+        $class = false !== strpos($name, '\\') ? $name : $namespace.ucwords($name);
502 502
 
503 503
         if (class_exists($class)) {
504 504
             return Container::getInstance()->invokeClass($class, $args);
505 505
         }
506 506
 
507
-        throw new ClassNotFoundException('class not exists:' . $class, $class);
507
+        throw new ClassNotFoundException('class not exists:'.$class, $class);
508 508
     }
509 509
 
510 510
     /**
Please login to merge, or discard this patch.