psalm
psalm copied to clipboard
@psalm-assert cannot be used with imported and aliased types.
Same symptoms as #8263.
https://psalm.dev/r/4da30212ca
I found these snippets:
https://psalm.dev/r/4da30212ca
<?php
/**
* @psalm-type Foo = 'a'|'b'
*/
class Dummy
{
}
/**
* @psalm-import-type Foo from Dummy as Bar
*/
class Dummy2
{
}
/**
* @psalm-assert Bar $param
*/
function test(mixed $param) : bool
{
echo (string)$param;
return true;
}
function caller(string $value) : void
{
if (test($value))
error_log('something');
}
Psalm output (using commit cb0e6a1):
ERROR: TypeDoesNotContainType - 28:9 - Cannot resolve types for $value - string does not contain type-alias(Dummy::Foo)