@@ -33,7 +33,7 @@ final class ParameterGenerator
3333 private $ type ;
3434
3535 /**
36- * @var ValueGenerator
36+ * @var ValueGenerator|null
3737 */
3838 private $ defaultValue ;
3939
@@ -77,11 +77,7 @@ public function __construct(
7777 }
7878 }
7979
80- /**
81- * @param string $type
82- * @return ParameterGenerator
83- */
84- public function setType ($ type ): self
80+ public function setType (string $ type ): self
8581 {
8682 $ this ->type = TypeGenerator::fromTypeString ($ type );
8783
@@ -99,7 +95,7 @@ public function getType(): ?TypeGenerator
9995 */
10096 public function setName (string $ name ): self
10197 {
102- $ this ->name = ( string ) $ name ;
98+ $ this ->name = $ name ;
10399
104100 return $ this ;
105101 }
@@ -117,7 +113,7 @@ public function getName(): string
117113 *
118114 * Certain variables are difficult to express
119115 *
120- * @param null|bool|string|int|float|array| ValueGenerator $defaultValue
116+ * @param ValueGenerator|mixed $defaultValue
121117 * @return ParameterGenerator
122118 */
123119 public function setDefaultValue ($ defaultValue ): self
@@ -130,10 +126,7 @@ public function setDefaultValue($defaultValue): self
130126 return $ this ;
131127 }
132128
133- /**
134- * @return ValueGenerator
135- */
136- public function getDefaultValue (): ValueGenerator
129+ public function getDefaultValue (): ?ValueGenerator
137130 {
138131 return $ this ->defaultValue ;
139132 }
@@ -188,17 +181,19 @@ public function getTypeDocBlockHint(): ?string
188181 /**
189182 * @param string|null $typeDocBlockHint
190183 */
191- public function setTypeDocBlockHint (?string $ typeDocBlockHint ): void
184+ public function setTypeDocBlockHint (?string $ typeDocBlockHint ): self
192185 {
193186 $ this ->typeDocBlockHint = $ typeDocBlockHint ;
187+
188+ return $ this ;
194189 }
195190
196191 public function generate (): Node \Param
197192 {
198193 return new Node \Param (
199194 new Node \Expr \Variable ($ this ->name ),
200195 $ this ->defaultValue ? $ this ->defaultValue ->generate () : null ,
201- $ this ->type ? $ this ->type ->generate () : null ,
196+ $ this ->type ? $ this ->type ->generate () : null , // @phpstan-ignore-line
202197 $ this ->passedByReference ,
203198 $ this ->variadic
204199 );
0 commit comments