Skip to content
Permalink
Browse files

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

…hod name
  • Loading branch information...
muglug committed Sep 8, 2019
1 parent b7f79b5 commit b61d0c6dcd1111a0c50f555e52ccec26f082b384
Showing with 16 additions and 2 deletions.
  1. +4 −2 src/Psalm/Internal/Analyzer/CommentAnalyzer.php
  2. +12 −0 tests/MagicMethodAnnotationTest.php
@@ -913,9 +913,11 @@ public static function extractClassLikeDocblockInfo(
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));
@@ -641,6 +641,18 @@ public function foo(string $s) : C {
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',
],
];
}
}

0 comments on commit b61d0c6

Please sign in to comment.
You can’t perform that action at this time.