mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Remove union types in magic methods for now
This commit is contained in:
parent
6873e60847
commit
c1586ee347
@ -385,7 +385,7 @@ class CommentChecker
|
||||
$method_entry = substr($method_entry, 0, (int) $matches[0][1] + strlen((string) $matches[0][0]));
|
||||
}
|
||||
|
||||
$method_entry = str_replace('|', '__UNIONOR__', $method_entry);
|
||||
$method_entry = preg_replace('/[a-zA-Z\\\\0-9_]+(\|[a-zA-Z\\\\0-9_]+)+ \$/', '$', $method_entry);
|
||||
|
||||
$php_string = '<?php ' . $return_docblock . ' function ' . $method_entry . '{}';
|
||||
|
||||
|
@ -1265,7 +1265,6 @@ class DependencyFinderVisitor extends PhpParser\NodeVisitorAbstract implements P
|
||||
}
|
||||
|
||||
if ($param_type_string) {
|
||||
$param_type_string = str_replace('__UNIONOR__', '|', $param_type_string);
|
||||
if ($is_nullable) {
|
||||
$param_type_string .= '|null';
|
||||
}
|
||||
|
@ -834,6 +834,24 @@ class AnnotationTest extends TestCase
|
||||
'$e' => 'callable():string',
|
||||
],
|
||||
],
|
||||
'namespacedMagicMethodValidAnnotations' => [
|
||||
'<?php
|
||||
namespace Foo;
|
||||
|
||||
class Parent {
|
||||
public function __call() {}
|
||||
}
|
||||
|
||||
/**
|
||||
* @method setBool(string $foo, string|bool $bar) : bool
|
||||
*/
|
||||
class Child extends Parent {}
|
||||
|
||||
$child = new Child();
|
||||
|
||||
$c = $child->setBool("hello", true);
|
||||
$c = $child->setBool("hello", "true");',
|
||||
],
|
||||
'slashAfter?' => [
|
||||
'<?php
|
||||
namespace ns;
|
||||
|
Loading…
x
Reference in New Issue
Block a user