99use phpDocumentor \Reflection \DocBlock \Tags \Method ;
1010use phpDocumentor \Reflection \DocBlock \Tags \MethodParameter ;
1111use phpDocumentor \Reflection \Type ;
12+ use phpDocumentor \Reflection \TypeResolver ;
1213use phpDocumentor \Reflection \Types \Context ;
1314use phpDocumentor \Reflection \Types \Mixed_ ;
1415use phpDocumentor \Reflection \Types \Void_ ;
2526 */
2627final class MethodFactory implements PHPStanFactory
2728{
28- private TypeFactory $ typeFactory ;
2929 private DescriptionFactory $ descriptionFactory ;
30+ private TypeResolver $ typeResolver ;
3031
31- public function __construct (TypeFactory $ typeFactory , DescriptionFactory $ descriptionFactory )
32+ public function __construct (TypeResolver $ typeResolver , DescriptionFactory $ descriptionFactory )
3233 {
33- $ this ->typeFactory = $ typeFactory ;
3434 $ this ->descriptionFactory = $ descriptionFactory ;
35+ $ this ->typeResolver = $ typeResolver ;
3536 }
3637
37- public function create (PhpDocTagNode $ node , ? Context $ context ): Tag
38+ public function create (PhpDocTagNode $ node , Context $ context ): Tag
3839 {
3940 $ tagValue = $ node ->value ;
4041 Assert::isInstanceOf ($ tagValue , MethodTagValueNode::class);
@@ -50,7 +51,7 @@ public function create(PhpDocTagNode $node, ?Context $context): Tag
5051 function (MethodTagValueParameterNode $ param ) use ($ context ) {
5152 return new MethodParameter (
5253 trim ($ param ->parameterName , '$ ' ),
53- $ this ->typeFactory ->createType ($ param ->type , $ context ) ?? new Mixed_ (),
54+ $ this ->typeResolver ->createType ($ param ->type , $ context ) ?? new Mixed_ (),
5455 $ param ->isReference ,
5556 $ param ->isVariadic ,
5657 (string ) $ param ->defaultValue
@@ -61,13 +62,13 @@ function (MethodTagValueParameterNode $param) use ($context) {
6162 );
6263 }
6364
64- public function supports (PhpDocTagNode $ node , ? Context $ context ): bool
65+ public function supports (PhpDocTagNode $ node , Context $ context ): bool
6566 {
6667 return $ node ->value instanceof MethodTagValueNode;
6768 }
6869
69- private function createReturnType (MethodTagValueNode $ tagValue , ? Context $ context ): Type
70+ private function createReturnType (MethodTagValueNode $ tagValue , Context $ context ): Type
7071 {
71- return $ this ->typeFactory ->createType ($ tagValue ->returnType , $ context ) ?? new Void_ ();
72+ return $ this ->typeResolver ->createType ($ tagValue ->returnType , $ context ) ?? new Void_ ();
7273 }
7374}
0 commit comments