Skip to content
Permalink
Browse files

Add support for templated @var on return statements

  • Loading branch information...
muglug committed Jun 26, 2019
1 parent 1864d9a commit e4e48d2d06ad67469f55067b616a67aa5bc26789
Showing with 28 additions and 8 deletions.
  1. +28 −8 src/Psalm/Internal/Analyzer/CommentAnalyzer.php
@@ -316,8 +316,13 @@ public static function extractFunctionDocblockInfo(PhpParser\Comment\Doc $commen
}
if (isset($parsed_docblock['specials']['param']) || isset($parsed_docblock['specials']['psalm-param'])) {
$all_params = (isset($parsed_docblock['specials']['param']) ? $parsed_docblock['specials']['param'] : [])
+ (isset($parsed_docblock['specials']['psalm-param']) ? $parsed_docblock['specials']['psalm-param'] : []);
$all_params =
(isset($parsed_docblock['specials']['param'])
? $parsed_docblock['specials']['param']
: [])
+ (isset($parsed_docblock['specials']['psalm-param'])
? $parsed_docblock['specials']['psalm-param']
: []);
/** @var string $param */
foreach ($all_params as $offset => $param) {
@@ -487,8 +492,13 @@ public static function extractFunctionDocblockInfo(PhpParser\Comment\Doc $commen
}
if (isset($parsed_docblock['specials']['template']) || isset($parsed_docblock['specials']['psalm-template'])) {
$all_templates = (isset($parsed_docblock['specials']['template']) ? $parsed_docblock['specials']['template'] : [])
+ (isset($parsed_docblock['specials']['psalm-template']) ? $parsed_docblock['specials']['psalm-template'] : []);
$all_templates
= (isset($parsed_docblock['specials']['template'])
? $parsed_docblock['specials']['template']
: [])
+ (isset($parsed_docblock['specials']['psalm-template'])
? $parsed_docblock['specials']['psalm-template']
: []);
foreach ($all_templates as $template_line) {
$template_type = preg_split('/[\s]+/', preg_replace('@^[ \t]*\*@m', '', $template_line));
@@ -672,8 +682,13 @@ public static function extractClassLikeDocblockInfo(\PhpParser\Node $node, PhpPa
$info = new ClassLikeDocblockComment();
if (isset($parsed_docblock['specials']['template']) || isset($parsed_docblock['specials']['psalm-template'])) {
$all_templates = (isset($parsed_docblock['specials']['template']) ? $parsed_docblock['specials']['template'] : [])
+ (isset($parsed_docblock['specials']['psalm-template']) ? $parsed_docblock['specials']['psalm-template'] : []);
$all_templates
= (isset($parsed_docblock['specials']['template'])
? $parsed_docblock['specials']['template']
: [])
+ (isset($parsed_docblock['specials']['psalm-template'])
? $parsed_docblock['specials']['psalm-template']
: []);
foreach ($all_templates as $template_line) {
$template_type = preg_split('/[\s]+/', preg_replace('@^[ \t]*\*@m', '', $template_line));
@@ -800,8 +815,13 @@ public static function extractClassLikeDocblockInfo(\PhpParser\Node $node, PhpPa
}
if (isset($parsed_docblock['specials']['method']) || isset($parsed_docblock['specials']['psalm-method'])) {
$all_methods = (isset($parsed_docblock['specials']['method']) ? $parsed_docblock['specials']['method'] : [])
+ (isset($parsed_docblock['specials']['psalm-method']) ? $parsed_docblock['specials']['psalm-method'] : []);
$all_methods
= (isset($parsed_docblock['specials']['method'])
? $parsed_docblock['specials']['method']
: [])
+ (isset($parsed_docblock['specials']['psalm-method'])
? $parsed_docblock['specials']['psalm-method']
: []);
foreach ($all_methods as $offset => $method_entry) {
$method_entry = preg_replace('/[ \t]+/', ' ', trim($method_entry));

0 comments on commit e4e48d2

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