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

Added test for #10807

This commit is contained in:
Aleksandr Zhuravlev 2024-03-11 20:09:05 +10:00 committed by Bruce Weirdan
parent 005e3184fb
commit 2a91bd6616
No known key found for this signature in database
GPG Key ID: CFC3AAB181751B0D

View File

@ -90,6 +90,36 @@ class AssertAnnotationTest extends TestCase
$this->analyzeFile('somefile.php', new Context());
}
public function testAssertsAllongCallStaticMethodWork(): void
{
$this->addFile(
'somefile.php',
'<?php
class ImportedAssert
{
/** @psalm-assert non-empty-string $b */
public static function notEmptyStrOnly(string $b): void
{
if ("" === $b) throw new \Exception("");
}
public function __callStatic() {}
}
/** @return non-empty-string */
function returnNonEmpty(string $b): string
{
ImportedAssert::notEmptyStrOnly($b);
return $b;
}
',
);
$this->analyzeFile('somefile.php', new Context());
}
public function testAssertInvalidDocblockMessageDoesNotIncludeTrace(): void
{
$this->expectException(CodeException::class);