1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Fix #2104 - only treat @method returns as separate if attached to method name

This commit is contained in:
Matthew Brown 2019-09-07 22:30:09 -04:00
parent b7f79b547e
commit b61d0c6dcd
2 changed files with 16 additions and 2 deletions

View File

@ -913,10 +913,12 @@ class CommentAnalyzer
array_shift($doc_line_parts);
}
if (count($doc_line_parts) > 1) {
$docblock_lines[] = '@return ' . array_shift($doc_line_parts);
$method_entry = implode(' ', $doc_line_parts);
}
}
$method_entry = trim(preg_replace('/\/\/.*/', '', $method_entry));

View File

@ -641,6 +641,18 @@ class MagicMethodAnnotationTest extends TestCase
class B extends A {}',
'error_message' => 'ImplementedParamTypeMismatch - src/somefile.php:11:21',
],
'parseBadMethodAnnotation' => [
'<?php
/**
* @method aaa
*/
class AAA {
function __call() {
echo $b."\n";
}
}',
'error_message' => 'InvalidDocblock',
],
];
}
}