Completed
Branch master (947d3c)
by Taosikai
02:32
created
Container.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     /**
60 60
      * 设置指定类的实例化代理
61 61
      * @param string $name
62
-     * @param mixed $creation 闭包及其它合法可调用的语法结构
62
+     * @param callable $creation 闭包及其它合法可调用的语法结构
63 63
      * @throws ConfigException
64 64
      * @return $this
65 65
      */
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      * $container->instance($user);
81 81
      *
82 82
      * ```
83
-     * @param $name
83
+     * @param string $name
84 84
      * @param $instance
85 85
      * @throws ConfigException
86 86
      * @return $this
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 
315 315
     /**
316 316
      * 获取参数
317
-     * @param $name
317
+     * @param string $name
318 318
      * @param null $default
319
-     * @return mixed|null
319
+     * @return string
320 320
      */
321 321
     public function getParameter($name, $default = null)
322 322
     {
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 
492 492
     /**
493 493
      * 处理字符串
494
-     * @param $value
494
+     * @param string $value
495 495
      * @return mixed
496 496
      * @throws DependencyInjectionException
497 497
      */
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         //兼容旧的api
232 232
         if (is_bool($arguments)) {
233 233
             trigger_error("Argument 'new' has been deprecated", E_USER_DEPRECATED);
234
-            $forceNewInstance  = $arguments;
234
+            $forceNewInstance = $arguments;
235 235
             $arguments = [];
236 236
         } else {
237 237
             $forceNewInstance = false;
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
      */
477 477
     protected function resolveParameters($parameters)
478 478
     {
479
-        return array_map(function ($parameter) {
479
+        return array_map(function($parameter) {
480 480
             //字符类型参数处理下预定义参数的情况
481 481
             if (is_string($parameter)) {
482 482
                 $parameter = $this->resolveString($parameter);
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
             throw new DependencyInjectionException(sprintf("Parameter [%s] is not defined", $key));
507 507
         }
508 508
         //"fool%bar%baz"
509
-        return preg_replace_callback("#%([^%\s]+)%#", function ($matches) {
509
+        return preg_replace_callback("#%([^%\s]+)%#", function($matches) {
510 510
             $key = $matches[1];
511 511
             if ($parameter = $this->parameterStore->getParameter($key)) {
512 512
                 return $parameter;
Please login to merge, or discard this patch.
Tests/ContainerTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     public function testDelegate()
25 25
     {
26 26
         $container = $this->getContainer();
27
-        $container->delegate('director1', function () {
27
+        $container->delegate('director1', function() {
28 28
             return new Director('James', 26);
29 29
         });
30 30
         $this->assertInstanceOf(Director::class, $container->get('director1'));
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     public function testShare()
125 125
     {
126 126
         $container = $this->getContainer();
127
-        $container->delegate('director', function () {
127
+        $container->delegate('director', function() {
128 128
             return new Director('James', 26);
129 129
         });
130 130
         $container->share('director');
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         $this->assertTrue($container->get('director') === $container->get('director'));
133 133
 
134 134
         //兼容旧的api,已提示废除
135
-        $container->share('director2', function () {
135
+        $container->share('director2', function() {
136 136
             return new Director('James', 26);
137 137
         });
138 138
         $this->assertTrue($container->get('director2') === $container->get('director2'));
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         $container->setParameters([
160 160
             'directorName' => 'James'
161 161
         ]);
162
-        $container->delegate('director', function (Container $container) {
162
+        $container->delegate('director', function(Container $container) {
163 163
             return new Director($container->getParameter('directorName'), 26);
164 164
         });
165 165
         $this->assertEquals('James', $container->get('director')->getName());
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
         $container = $this->getContainer();
171 171
         $container->setParameters([
172 172
             'directorName' => 'James',
173
-            'director' => [ //支持点号获取深度数据结构
173
+            'director' => [//支持点号获取深度数据结构
174 174
                 'age' => 26
175 175
             ]
176 176
         ]);
Please login to merge, or discard this patch.