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

Fix #4017 - allow float defaults in namespaced classes

This commit is contained in:
Brown 2020-08-18 12:13:27 -04:00 committed by Daniil Gentili
parent 3630b4a2f9
commit 7ac771da48
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 27 additions and 2 deletions

View File

@ -361,8 +361,7 @@ class TypeTokenizer
if ($string_type_token[0][0] === '"'
|| $string_type_token[0][0] === '\''
|| $string_type_token[0] === '0'
|| preg_match('/[1-9]/', $string_type_token[0][0])
|| preg_match('/[0-9]/', $string_type_token[0][0])
) {
continue;
}

View File

@ -668,6 +668,32 @@ class MagicMethodAnnotationTest extends TestCase
}
}'
],
'parseFloatInDefault' => [
'<?php
namespace Foo {
/**
* @method int randomInt()
* @method void takesFloat($a = 0.1)
*/
class G
{
/**
* @param string $method
* @param array $attributes
*
* @return mixed
*/
public function __call($method, $attributes)
{
return null;
}
}
}
namespace Bar {
(new \Foo\G)->randomInt();
}'
],
];
}