@@ -482,7 +482,7 @@ protected function processParams(File $phpcsFile, $stackPtr, $commentStart)
482482 $ commentLines = [];
483483 if ($ tokens [($ tag + 2 )]['code ' ] === T_DOC_COMMENT_STRING ) {
484484 $ matches = [];
485- preg_match ('/([^$&] *)(?:((?:\$|&)[^\s]+)(?:(\s+)(.*))?)?/ ' , $ tokens [($ tag + 2 )]['content ' ], $ matches );
485+ preg_match ('/((?:(?![$.]|&(?=\$)).) *)(?:((?:\.\.\.)? (?:\$|&)[^\s]+)(?:(\s+)(.*))?)?/ ' , $ tokens [($ tag + 2 )]['content ' ], $ matches );
486486
487487 $ typeLen = strlen ($ matches [1 ]);
488488 $ type = trim ($ matches [1 ]);
@@ -618,7 +618,7 @@ protected function processParams(File $phpcsFile, $stackPtr, $commentStart)
618618 $ variableArguments = true ;
619619 }
620620
621- if ($ typeLen === 0 ) {
621+ if ($ typeLen === 0 && $ variableArguments === false ) {
622622 $ error = 'Missing parameter type ' ;
623623 // If there is just one word as comment at the end of the line
624624 // then this is probably the data type. Move it before the
@@ -677,8 +677,11 @@ protected function processParams(File $phpcsFile, $stackPtr, $commentStart)
677677 while (isset ($ realParams [($ checkPos )]) === true ) {
678678 $ realName = $ realParams [$ checkPos ]['name ' ];
679679
680- if ($ realName === $ param ['var ' ] || ($ realParams [$ checkPos ]['pass_by_reference ' ] === true
680+ if ($ realName === $ param ['var ' ]
681+ || ($ realParams [$ checkPos ]['pass_by_reference ' ] === true
681682 && ('& ' .$ realName ) === $ param ['var ' ])
683+ || ($ realParams [$ checkPos ]['variable_length ' ] === true
684+ && ('... ' .$ realName ) === $ param ['var ' ])
682685 ) {
683686 $ matched = true ;
684687 break ;
@@ -923,7 +926,7 @@ public static function suggestType($type)
923926 // Also allow some more characters for special type hints supported by
924927 // PHPStan:
925928 // https://phpstan.org/writing-php-code/phpdoc-types#basic-types .
926- $ type = preg_replace ('/[^a-zA-Z0-9_ \\\[\]\-<> ,"\{\}\? \':\*]/ ' , '' , $ type );
929+ $ type = preg_replace ('/[^a-zA-Z0-9_ \\\[\]\-<> ,"\{\}\? \':\*\|\& ]/ ' , '' , $ type );
927930
928931 return $ type ;
929932
0 commit comments