1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Remove mixed in @method param types

This commit is contained in:
Matt Brown 2018-06-28 17:39:25 -04:00
parent 2fc816a6e1
commit c872f9179e
2 changed files with 9 additions and 2 deletions

View File

@ -436,7 +436,11 @@ class CommentChecker
$method_entry = substr($method_entry, 0, (int) $matches[0][1] + strlen((string) $matches[0][0]));
}
$method_entry = preg_replace('/[a-zA-Z\\\\0-9_]+(\|[a-zA-Z\\\\0-9_]+)+ \$/', '$', $method_entry);
// replace unions
$method_entry = preg_replace('/[a-zA-Z\\\\0-9_]+(\|[a-zA-Z\\\\0-9_]+)+ +\$/', '$', $method_entry);
// replace mixed
$method_entry = preg_replace('/mixed +\$/', '$', $method_entry);
$php_string = '<?php class A { ' . $return_docblock . ' public function ' . $method_entry . '{} }';

View File

@ -1069,6 +1069,7 @@ class AnnotationTest extends TestCase
* @method string getString()
* @method void setInteger(int $integer)
* @method setString(int $integer)
* @method setMixed(mixed $foo)
* @method getBool(string $foo) : bool
* @method setBool(string $foo, string|bool $bar) : bool
* @method (string|int)[] getArray() : array with some text
@ -1088,7 +1089,9 @@ class AnnotationTest extends TestCase
$c = $child->setBool("hello", "true");
$d = $child->getArray();
$child->setArray(["boo"])
$e = $child->getCallable();',
$e = $child->getCallable();
$child->setMixed("hello");
$child->setMixed(4);',
'assertions' => [
'$a' => 'string',
'$b' => 'mixed',