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:
parent
b7f79b547e
commit
b61d0c6dcd
@ -913,9 +913,11 @@ class CommentAnalyzer
|
|||||||
array_shift($doc_line_parts);
|
array_shift($doc_line_parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
$docblock_lines[] = '@return ' . 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 = implode(' ', $doc_line_parts);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$method_entry = trim(preg_replace('/\/\/.*/', '', $method_entry));
|
$method_entry = trim(preg_replace('/\/\/.*/', '', $method_entry));
|
||||||
|
@ -641,6 +641,18 @@ class MagicMethodAnnotationTest extends TestCase
|
|||||||
class B extends A {}',
|
class B extends A {}',
|
||||||
'error_message' => 'ImplementedParamTypeMismatch - src/somefile.php:11:21',
|
'error_message' => 'ImplementedParamTypeMismatch - src/somefile.php:11:21',
|
||||||
],
|
],
|
||||||
|
'parseBadMethodAnnotation' => [
|
||||||
|
'<?php
|
||||||
|
/**
|
||||||
|
* @method aaa
|
||||||
|
*/
|
||||||
|
class AAA {
|
||||||
|
function __call() {
|
||||||
|
echo $b."\n";
|
||||||
|
}
|
||||||
|
}',
|
||||||
|
'error_message' => 'InvalidDocblock',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user