@@ -365,4 +365,43 @@ public function testUpdateMethodParametersFromTags(): void
365365 ])
366366 );
367367 }
368+
369+ /**
370+ * @see NodeVisitor::updateMethodParametersFromTags
371+ */
372+ public function testUpdateMethodParametersFromInvalidTags (): void
373+ {
374+ $ docBlockParser = new DocBlockParser ();
375+ $ docBlockNode = $ docBlockParser ->parse (
376+ '/** ' . "\n"
377+ . '* @param type1 $param1 Description ' . "\n"
378+ . '* @param $param8 Description 4 ' . "\n"
379+ . '* @param $param9 ' . "\n"
380+ . '* @param foo ' . "\n"
381+ . '* @param type1 $param4 Description 4 ' . "\n"
382+ . '* @param array[\Illuminate\Notifications\Channels\Notification] $notification ' . "\n"
383+ . '**/ ' . "\n"
384+ );
385+ $ parserContext = new ParserContext (new TrueFilter (), new DocBlockParser (), new Standard ());
386+ $ visitor = new NodeVisitor ($ parserContext );
387+ $ function = new FunctionReflection ('fun1 ' , 0 );
388+
389+ $ param1 = (new ParameterReflection ('param1 ' , 0 ));
390+ $ param1 ->setHint ('array ' );
391+ $ function ->addParameter ($ param1 );
392+
393+ $ param2 = (new ParameterReflection ('param2 ' , 0 ));
394+ $ function ->addParameter ($ param2 );
395+
396+ $ this ->assertSame (
397+ [
398+ 'The "param2" parameter of the method "fun1" is missing a @param tag ' ,
399+ 'The method "fun1" has "6" @param tags but only "2" where expected. ' ,
400+ ],
401+ $ this ->callMethod ($ visitor , 'updateMethodParametersFromTags ' , [
402+ $ function ,
403+ $ docBlockNode ->getTag ('param ' )
404+ ])
405+ );
406+ }
368407}
0 commit comments