mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Fix #3721 - prevent crash on empty @method
This commit is contained in:
parent
cceacde01d
commit
4c368da75e
@ -1023,6 +1023,10 @@ class CommentAnalyzer
|
||||
// replace array bracket contents
|
||||
$method_entry = preg_replace('/\[([0-9a-zA-Z_\'\" ]+,)*([0-9a-zA-Z_\'\" ]+)\]/', '[]', $method_entry);
|
||||
|
||||
if (!$method_entry) {
|
||||
throw new DocblockParseException('No @method entry specified');
|
||||
}
|
||||
|
||||
try {
|
||||
$parse_tree_creator = new ParseTreeCreator(
|
||||
TypeTokenizer::getFullyQualifiedTokens(
|
||||
|
@ -838,6 +838,14 @@ class MagicMethodAnnotationTest extends TestCase
|
||||
$b->foo();',
|
||||
'error_message' => 'UndefinedMagicMethod',
|
||||
],
|
||||
'lonelyMethod' => [
|
||||
'<?php
|
||||
/**
|
||||
* @method
|
||||
*/
|
||||
class C {}',
|
||||
'error_message' => 'InvalidDocblock',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user