mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Fix issues with single-letter classes
This commit is contained in:
parent
ee4a3882a7
commit
393297786d
@ -11,7 +11,7 @@ use Psalm\Type;
|
||||
class CommentChecker
|
||||
{
|
||||
const TYPE_REGEX =
|
||||
'(\\\?[A-Za-z0-9_\<,\>\[\]\-\{\}:|\\\]+[A-Za-z0-9_\<,\>\[\]-\{\}:]|\$[a-zA-Z_0-9_\<,\>\|\[\]-\{\}:]+)';
|
||||
'(\\\?[A-Za-z0-9_\<,\>\[\]\-\{\}:|\\\]+|\$[a-zA-Z_0-9_\<,\>\|\[\]-\{\}:]+)';
|
||||
|
||||
/**
|
||||
* @param string $comment
|
||||
|
@ -366,7 +366,7 @@ abstract class FunctionLikeChecker extends SourceChecker implements StatementsSo
|
||||
$function_param->code_location
|
||||
)
|
||||
)) {
|
||||
return false;
|
||||
// fall through
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -202,4 +202,42 @@ class AnnotationTest extends PHPUnit_Framework_TestCase
|
||||
$file_checker->check(true, true, $context);
|
||||
$this->assertEquals('int', (string) $context->vars_in_scope['$a']);
|
||||
}
|
||||
|
||||
public function testGoodDocblock()
|
||||
{
|
||||
$stmts = self::$parser->parse('<?php
|
||||
class A {
|
||||
/**
|
||||
* @param A $a
|
||||
* @param bool $b
|
||||
*/
|
||||
public function g(A $a, $b) : void {
|
||||
}
|
||||
}
|
||||
');
|
||||
|
||||
$file_checker = new FileChecker('somefile.php', $stmts);
|
||||
$context = new Context('somefile.php');
|
||||
$file_checker->check(true, true, $context);
|
||||
}
|
||||
|
||||
public function testGoodDocblockInNamespace()
|
||||
{
|
||||
$stmts = self::$parser->parse('<?php
|
||||
namespace Foo;
|
||||
|
||||
class A {
|
||||
/**
|
||||
* @param \Foo\A $a
|
||||
* @param bool $b
|
||||
*/
|
||||
public function g(A $a, $b) : void {
|
||||
}
|
||||
}
|
||||
');
|
||||
|
||||
$file_checker = new FileChecker('somefile.php', $stmts);
|
||||
$context = new Context('somefile.php');
|
||||
$file_checker->check(true, true, $context);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user