@@ -71,8 +71,8 @@ final class StandardTagFactory implements TagFactory
7171 public const REGEX_TAGNAME = '[\w\-\_ \\\\:]+ ' ;
7272
7373 /**
74- * @var string[] An array with a tag as a key, and an
75- * FQCN to a class that handles it as an array value.
74+ * @var array<class- string<StaticMethod>> An array with a tag as a key, and an
75+ * FQCN to a class that handles it as an array value.
7676 */
7777 private $ tagHandlerMappings = [
7878 'author ' => Author::class,
@@ -97,7 +97,7 @@ final class StandardTagFactory implements TagFactory
9797 ];
9898
9999 /**
100- * @var string[] An array with a anotation s a key, and an
100+ * @var array<class- string<StaticMethod>> An array with a anotation s a key, and an
101101 * FQCN to a class that handles it as an array value.
102102 */
103103 private $ annotationMappings = [];
@@ -125,7 +125,7 @@ final class StandardTagFactory implements TagFactory
125125 *
126126 * @see self::registerTagHandler() to add a new tag handler to the existing default list.
127127 *
128- * @param string[] $tagHandlers
128+ * @param array<class- string<StaticMethod>> $tagHandlers
129129 */
130130 public function __construct (FqsenResolver $ fqsenResolver , ?array $ tagHandlers = null )
131131 {
@@ -137,9 +137,6 @@ public function __construct(FqsenResolver $fqsenResolver, ?array $tagHandlers =
137137 $ this ->addService ($ fqsenResolver , FqsenResolver::class);
138138 }
139139
140- /**
141- * {@inheritDoc}
142- */
143140 public function create (string $ tagLine , ?TypeContext $ context = null ) : Tag
144141 {
145142 if (!$ context ) {
@@ -152,29 +149,22 @@ public function create(string $tagLine, ?TypeContext $context = null) : Tag
152149 }
153150
154151 /**
155- * {@inheritDoc}
152+ * @param mixed $value
156153 */
157154 public function addParameter (string $ name , $ value ) : void
158155 {
159156 $ this ->serviceLocator [$ name ] = $ value ;
160157 }
161158
162- /**
163- * {@inheritDoc}
164- */
165159 public function addService (object $ service , ?string $ alias = null ) : void
166160 {
167161 $ this ->serviceLocator [$ alias ?: get_class ($ service )] = $ service ;
168162 }
169163
170- /**
171- * {@inheritDoc}
172- */
173164 public function registerTagHandler (string $ tagName , string $ handler ) : void
174165 {
175166 Assert::stringNotEmpty ($ tagName );
176167 Assert::classExists ($ handler );
177- /** @var object $handler stupid hack to make phpstan happy. */
178168 Assert::implementsInterface ($ handler , StaticMethod::class);
179169
180170 if (strpos ($ tagName , '\\' ) && $ tagName [0 ] !== '\\' ) {
@@ -220,9 +210,10 @@ private function createTag(string $body, string $name, TypeContext $context) : T
220210 );
221211
222212 try {
223- /** @var callable $callable */
224213 $ callable = [$ handlerClassName , 'create ' ];
225- $ tag = call_user_func_array ($ callable , $ arguments );
214+ Assert::isCallable ($ callable );
215+ $ tag = call_user_func_array ($ callable , $ arguments );
216+
226217 return $ tag ?? InvalidTag::create ($ body , $ name );
227218 } catch (InvalidArgumentException $ e ) {
228219 return InvalidTag::create ($ body , $ name )->withError ($ e );
0 commit comments