mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Fix #2583 - don’t convert scalar terms in @method annotations
This commit is contained in:
parent
d22b13262f
commit
03030d4887
@ -1074,9 +1074,12 @@ abstract class Type
|
||||
$string_type_token[0] = preg_replace('/(.+)\$.*/', '$1', $string_type_token[0]);
|
||||
}
|
||||
|
||||
$type_tokens[$i][0]
|
||||
= $string_type_token[0]
|
||||
= self::fixScalarTerms($string_type_token[0]);
|
||||
$fixed_token = !isset($type_tokens[$i + 1]) || $type_tokens[$i + 1][0] !== '('
|
||||
? self::fixScalarTerms($string_type_token[0])
|
||||
: $string_type_token[0];
|
||||
|
||||
$type_tokens[$i][0] = $fixed_token;
|
||||
$string_type_token[0] = $fixed_token;
|
||||
|
||||
if ($string_type_token[0] === 'self' && $self_fqcln) {
|
||||
$type_tokens[$i][0] = $self_fqcln;
|
||||
|
@ -544,6 +544,21 @@ class MagicMethodAnnotationTest extends TestCase
|
||||
$child->setInteger(function() : void {});
|
||||
}',
|
||||
],
|
||||
'allowMethodsNamedBooleanAndInteger' => [
|
||||
'<?php
|
||||
/**
|
||||
* @method boolean(int $foo) : bool
|
||||
* @method integer(int $foo) : bool
|
||||
*/
|
||||
class Child {
|
||||
public function __call(string $name, array $args) {}
|
||||
}
|
||||
|
||||
$child = new Child();
|
||||
|
||||
$child->boolean(5);
|
||||
$child->integer(5);'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user