File tree 3 files changed +16
-13
lines changed
3 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -9,9 +9,10 @@ interface InstanceContainer {
9
9
* If no matching class could be found, it must throw an Ioc\Exceptions\DefinitionNotFoundException.
10
10
* $className must be an fully qualified class-name.
11
11
*
12
- * @param string $className
12
+ * @template T of object
13
+ * @param class-string<T> $className
13
14
* @throws DefinitionNotFoundException
14
- * @return object
15
+ * @return T
15
16
*/
16
- public function get ($ className );
17
+ public function get (string $ className );
17
18
}
Original file line number Diff line number Diff line change @@ -22,11 +22,12 @@ interface MethodInvoker {
22
22
* mixed together. Scalar-types and array-types can not be determined automatically. They must be provided through
23
23
* $arguments.
24
24
*
25
- * @param callable $callable
26
- * @param array $arguments Must be an array were the keys match to the Variable-Names of the __construct'ors parameters.
27
- * @return mixed
28
- *@throws MissingParameterException
25
+ * @template T
26
+ * @param callable(mixed ...$args): T $callable
27
+ * @param list<mixed> $arguments Must be an array were the keys match to the Variable-Names of the __construct'ors parameters.
28
+ * @return T
29
+ * @throws MissingParameterException
29
30
* @throws DefinitionNotFoundException
30
31
*/
31
- public function invoke ($ callable , array $ arguments = array () );
32
+ public function invoke ($ callable , array $ arguments = [] );
32
33
}
Original file line number Diff line number Diff line change @@ -10,11 +10,12 @@ interface ObjectFactory {
10
10
* arguments were missing in $arguments, the method-invoker tries to fill the missing arguments by itself.
11
11
* If no matching class could be found, it must throw an Ioc\Exceptions\DefinitionNotFoundException.
12
12
*
13
- * @param string $className Must be an fully qualified class-name.
14
- * @param array $arguments Must be an array were the keys match to the Variable-Names of the __construct'ors parameters.
15
- * @return mixed
16
- *@throws MissingParameterException
13
+ * @template T of object
14
+ * @param class-string<T> $className Must be an fully qualified class-name.
15
+ * @param list<mixed> $arguments Must be an array were the keys match to the Variable-Names of the __construct'ors parameters.
16
+ * @return T
17
+ * @throws MissingParameterException
17
18
* @throws DefinitionNotFoundException
18
19
*/
19
- public function create ($ className , array $ arguments = array () );
20
+ public function create (string $ className , array $ arguments = [] );
20
21
}
You can’t perform that action at this time.
0 commit comments