mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +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
|
// replace array bracket contents
|
||||||
$method_entry = preg_replace('/\[([0-9a-zA-Z_\'\" ]+,)*([0-9a-zA-Z_\'\" ]+)\]/', '[]', $method_entry);
|
$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 {
|
try {
|
||||||
$parse_tree_creator = new ParseTreeCreator(
|
$parse_tree_creator = new ParseTreeCreator(
|
||||||
TypeTokenizer::getFullyQualifiedTokens(
|
TypeTokenizer::getFullyQualifiedTokens(
|
||||||
|
@ -838,6 +838,14 @@ class MagicMethodAnnotationTest extends TestCase
|
|||||||
$b->foo();',
|
$b->foo();',
|
||||||
'error_message' => 'UndefinedMagicMethod',
|
'error_message' => 'UndefinedMagicMethod',
|
||||||
],
|
],
|
||||||
|
'lonelyMethod' => [
|
||||||
|
'<?php
|
||||||
|
/**
|
||||||
|
* @method
|
||||||
|
*/
|
||||||
|
class C {}',
|
||||||
|
'error_message' => 'InvalidDocblock',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user