Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test for #10807 #10808

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading