Skip to content

Commit

Permalink
Added test for vimeo#10807
Browse files Browse the repository at this point in the history
  • Loading branch information
SCIF authored and weirdan committed Mar 11, 2024
1 parent 005e318 commit 2a91bd6
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/AssertAnnotationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,36 @@ function requiresString(string $_str): void {}
$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);
Expand Down

0 comments on commit 2a91bd6

Please sign in to comment.