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:
parent
661c7ee707
commit
e060ec35de
@ -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);
|
||||
}
|
||||
|
@ -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',
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user