@@ -55,7 +55,7 @@ class Container implements ContainerInterface, \ArrayAccess, \IteratorAggregate,
5555 * 'id' => Service Object
5656 * ... ...
5757 * ];
58- * @var Service []
58+ * @var ObjectItem []
5959 */
6060 private $ services = [];
6161
@@ -107,7 +107,7 @@ public function set(string $id, $definition, array $opts = []): self
107107 // 已经是个服务实例 object
108108 if (\is_object ($ definition )) {
109109 $ 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 ' ]);
111111 $ this ->setAlias ($ id , $ opts ['aliases ' ]);
112112
113113 return $ this ;
@@ -152,7 +152,7 @@ public function set(string $id, $definition, array $opts = []): self
152152 }
153153
154154 $ 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 ' ]);
156156 $ this ->setAlias ($ id , $ opts ['aliases ' ]);
157157
158158 // active service
@@ -464,10 +464,10 @@ public function getInstance(string $id, $thrErr = true, $forceNew = false)
464464 * 获取某一个服务的信息
465465 * @param $id
466466 * @param bool $thrErr
467- * @return Service |null
467+ * @return ObjectItem |null
468468 * @throws \InvalidArgumentException
469469 */
470- public function getService (string $ id , $ thrErr = false )
470+ public function getService (string $ id , $ thrErr = false ): ? ObjectItem
471471 {
472472 $ id = $ this ->resolveAlias ($ id );
473473
@@ -569,9 +569,9 @@ public function isLocked(string $id): bool
569569 }
570570
571571 /**
572- * 是已注册的服务
572+ * Is a registered service object
573573 * @param string $id
574- * @return bool|Service
574+ * @return bool|ObjectItem
575575 */
576576 public function has ($ id )
577577 {
@@ -591,7 +591,7 @@ public function exists(string $id): bool
591591
592592 /**
593593 * @param $name
594- * @return bool|Service
594+ * @return bool|ObjectItem
595595 */
596596 public function __isset ($ name )
597597 {
@@ -621,9 +621,9 @@ public function __get($name)
621621 return $ service ->get ($ this );
622622 }
623623
624- $ method = 'get ' . ucfirst ($ name );
624+ $ method = 'get ' . \ ucfirst ($ name );
625625
626- if (method_exists ($ this , $ method )) {
626+ if (\ method_exists ($ this , $ method )) {
627627 return $ this ->$ method ();
628628 }
629629
@@ -677,21 +677,20 @@ public function offsetGet($offset)
677677 * Sets an offset in the iterator.
678678 * @param mixed $offset The array offset.
679679 * @param mixed $value The array value.
680- * @return $this
681680 * @throws \InvalidArgumentException
682681 * @throws DependencyResolutionException
683682 */
684- public function offsetSet ($ offset , $ value )
683+ public function offsetSet ($ offset , $ value ): void
685684 {
686- return $ this ->set ($ offset , $ value );
685+ $ this ->set ($ offset , $ value );
687686 }
688687
689688 /**
690689 * Unset an offset in the iterator.
691690 * @param mixed $offset The array offset.
692691 * @return void
693692 */
694- public function offsetUnset ($ offset )
693+ public function offsetUnset ($ offset ): void
695694 {
696695 $ this ->del ($ offset );
697696 }
0 commit comments