Skip to content

Commit 2a91bd6

Browse files
SCIFweirdan
authored andcommitted
Added test for #10807
1 parent 005e318 commit 2a91bd6

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/AssertAnnotationTest.php

+30
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,36 @@ function requiresString(string $_str): void {}
9090
$this->analyzeFile('somefile.php', new Context());
9191
}
9292

93+
public function testAssertsAllongCallStaticMethodWork(): void
94+
{
95+
$this->addFile(
96+
'somefile.php',
97+
'<?php
98+
99+
class ImportedAssert
100+
{
101+
/** @psalm-assert non-empty-string $b */
102+
public static function notEmptyStrOnly(string $b): void
103+
{
104+
if ("" === $b) throw new \Exception("");
105+
}
106+
107+
public function __callStatic() {}
108+
}
109+
110+
/** @return non-empty-string */
111+
function returnNonEmpty(string $b): string
112+
{
113+
ImportedAssert::notEmptyStrOnly($b);
114+
115+
return $b;
116+
}
117+
',
118+
);
119+
120+
$this->analyzeFile('somefile.php', new Context());
121+
}
122+
93123
public function testAssertInvalidDocblockMessageDoesNotIncludeTrace(): void
94124
{
95125
$this->expectException(CodeException::class);

0 commit comments

Comments
 (0)