1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Fix #1258 - allow static method returns

This commit is contained in:
Brown 2019-01-30 11:44:12 -05:00
parent 661c7ee707
commit e060ec35de
2 changed files with 17 additions and 1 deletions

View File

@ -641,7 +641,7 @@ class CommentAnalyzer
if (!preg_match('/^([a-z_A-Z][a-z_0-9A-Z]+) *\(/', $method_entry, $matches)) {
$doc_line_parts = self::splitDocLine($method_entry);
if ($doc_line_parts[0] === 'static' && !strpos($doc_line_parts[0], '(')) {
if ($doc_line_parts[0] === 'static' && !strpos($doc_line_parts[1], '(')) {
$is_static = true;
array_shift($doc_line_parts);
}

View File

@ -370,6 +370,22 @@ class MagicMethodAnnotationTest extends TestCase
'$b' => 'C',
]
],
'allowMagicMethodStatic' => [
'<?php
/** @method static getStatic() */
class C {
public function __call(string $c, array $args) {}
}
class D extends C {}
$c = (new C)->getStatic();
$d = (new D)->getStatic();',
[
'$c' => 'C',
'$d' => 'D',
]
],
];
}