mirror of
https://github.com/danog/psalm.git
synced 2024-12-12 09:19:40 +01:00
Merge pull request #10812 from issidorov/bug-10807
This commit is contained in:
commit
8471a896cc
@ -789,7 +789,7 @@ final class AtomicStaticCallAnalyzer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$callstatic_method_exists || $class_storage->hasSealedMethods($config)) {
|
if ($naive_method_exists || !$callstatic_method_exists || $class_storage->hasSealedMethods($config)) {
|
||||||
$does_method_exist = MethodAnalyzer::checkMethodExists(
|
$does_method_exist = MethodAnalyzer::checkMethodExists(
|
||||||
$codebase,
|
$codebase,
|
||||||
$method_id,
|
$method_id,
|
||||||
|
@ -90,6 +90,36 @@ class AssertAnnotationTest extends TestCase
|
|||||||
$this->analyzeFile('somefile.php', new Context());
|
$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
|
public function testAssertInvalidDocblockMessageDoesNotIncludeTrace(): void
|
||||||
{
|
{
|
||||||
$this->expectException(CodeException::class);
|
$this->expectException(CodeException::class);
|
||||||
|
Loading…
Reference in New Issue
Block a user