2
2
3
3
namespace Cspray \AnnotatedContainer \Definition ;
4
4
5
- use Cspray \Typiphy \ObjectType ;
5
+
6
+ use Cspray \AnnotatedContainer \Reflection \Type ;
6
7
7
8
/**
8
9
* The preferred method for constructing AliasDefinition instances.
9
10
*/
10
11
final class AliasDefinitionBuilder {
11
12
12
- private ObjectType $ abstractType ;
13
- private ObjectType $ concreteType ;
13
+ private Type $ abstractType ;
14
+ private Type $ concreteType ;
14
15
15
16
private function __construct () {
16
17
}
17
18
18
19
/**
19
20
* Define the abstract Service that should have an alias defined for it.
20
21
*
21
- * @param ObjectType $serviceDefinition
22
+ * @param Type $serviceDefinition
22
23
* @return static
23
24
*/
24
- public static function forAbstract (ObjectType $ serviceDefinition ) : self {
25
+ public static function forAbstract (Type $ serviceDefinition ) : self {
25
26
$ instance = new self ;
26
27
$ instance ->abstractType = $ serviceDefinition ;
27
28
return $ instance ;
@@ -32,10 +33,10 @@ public static function forAbstract(ObjectType $serviceDefinition) : self {
32
33
*
33
34
* This method is immutable and a new AliasDefinitionBuilder will be returned.
34
35
*
35
- * @param ObjectType $serviceDefinition
36
+ * @param Type $serviceDefinition
36
37
* @return $this
37
38
*/
38
- public function withConcrete (ObjectType $ serviceDefinition ) : self {
39
+ public function withConcrete (Type $ serviceDefinition ) : self {
39
40
$ instance = clone $ this ;
40
41
$ instance ->concreteType = $ serviceDefinition ;
41
42
return $ instance ;
@@ -49,16 +50,16 @@ public function withConcrete(ObjectType $serviceDefinition) : self {
49
50
public function build () : AliasDefinition {
50
51
return new class ($ this ->abstractType , $ this ->concreteType ) implements AliasDefinition {
51
52
public function __construct (
52
- private readonly ObjectType $ abstractService ,
53
- private readonly ObjectType $ concreteService
53
+ private readonly Type $ abstractService ,
54
+ private readonly Type $ concreteService
54
55
) {
55
56
}
56
57
57
- public function abstractService () : ObjectType {
58
+ public function abstractService () : Type {
58
59
return $ this ->abstractService ;
59
60
}
60
61
61
- public function concreteService () : ObjectType {
62
+ public function concreteService () : Type {
62
63
return $ this ->concreteService ;
63
64
}
64
65
};
0 commit comments