@@ -55,7 +55,7 @@ class Container implements ContainerInterface, \ArrayAccess, \IteratorAggregate,
55
55
* 'id' => Service Object
56
56
* ... ...
57
57
* ];
58
- * @var Service []
58
+ * @var ObjectItem []
59
59
*/
60
60
private $ services = [];
61
61
@@ -107,7 +107,7 @@ public function set(string $id, $definition, array $opts = []): self
107
107
// 已经是个服务实例 object
108
108
if (\is_object ($ definition )) {
109
109
$ this ->ids [$ id ] = (bool )$ opts ['locked ' ];
110
- $ this ->services [$ id ] = new Service ($ definition , $ args , $ opts ['shared ' ], $ opts ['locked ' ]);
110
+ $ this ->services [$ id ] = new ObjectItem ($ definition , $ args , $ opts ['shared ' ], $ opts ['locked ' ]);
111
111
$ this ->setAlias ($ id , $ opts ['aliases ' ]);
112
112
113
113
return $ this ;
@@ -152,7 +152,7 @@ public function set(string $id, $definition, array $opts = []): self
152
152
}
153
153
154
154
$ this ->ids [$ id ] = (bool )$ opts ['locked ' ];
155
- $ this ->services [$ id ] = new Service ($ callback , $ args , $ opts ['shared ' ], $ opts ['locked ' ]);
155
+ $ this ->services [$ id ] = new ObjectItem ($ callback , $ args , $ opts ['shared ' ], $ opts ['locked ' ]);
156
156
$ this ->setAlias ($ id , $ opts ['aliases ' ]);
157
157
158
158
// active service
@@ -464,10 +464,10 @@ public function getInstance(string $id, $thrErr = true, $forceNew = false)
464
464
* 获取某一个服务的信息
465
465
* @param $id
466
466
* @param bool $thrErr
467
- * @return Service |null
467
+ * @return ObjectItem |null
468
468
* @throws \InvalidArgumentException
469
469
*/
470
- public function getService (string $ id , $ thrErr = false )
470
+ public function getService (string $ id , $ thrErr = false ): ? ObjectItem
471
471
{
472
472
$ id = $ this ->resolveAlias ($ id );
473
473
@@ -569,9 +569,9 @@ public function isLocked(string $id): bool
569
569
}
570
570
571
571
/**
572
- * 是已注册的服务
572
+ * Is a registered service object
573
573
* @param string $id
574
- * @return bool|Service
574
+ * @return bool|ObjectItem
575
575
*/
576
576
public function has ($ id )
577
577
{
@@ -591,7 +591,7 @@ public function exists(string $id): bool
591
591
592
592
/**
593
593
* @param $name
594
- * @return bool|Service
594
+ * @return bool|ObjectItem
595
595
*/
596
596
public function __isset ($ name )
597
597
{
@@ -621,9 +621,9 @@ public function __get($name)
621
621
return $ service ->get ($ this );
622
622
}
623
623
624
- $ method = 'get ' . ucfirst ($ name );
624
+ $ method = 'get ' . \ ucfirst ($ name );
625
625
626
- if (method_exists ($ this , $ method )) {
626
+ if (\ method_exists ($ this , $ method )) {
627
627
return $ this ->$ method ();
628
628
}
629
629
@@ -677,21 +677,20 @@ public function offsetGet($offset)
677
677
* Sets an offset in the iterator.
678
678
* @param mixed $offset The array offset.
679
679
* @param mixed $value The array value.
680
- * @return $this
681
680
* @throws \InvalidArgumentException
682
681
* @throws DependencyResolutionException
683
682
*/
684
- public function offsetSet ($ offset , $ value )
683
+ public function offsetSet ($ offset , $ value ): void
685
684
{
686
- return $ this ->set ($ offset , $ value );
685
+ $ this ->set ($ offset , $ value );
687
686
}
688
687
689
688
/**
690
689
* Unset an offset in the iterator.
691
690
* @param mixed $offset The array offset.
692
691
* @return void
693
692
*/
694
- public function offsetUnset ($ offset )
693
+ public function offsetUnset ($ offset ): void
695
694
{
696
695
$ this ->del ($ offset );
697
696
}
0 commit comments