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

@psalm-assert cannot be used with imported and aliased types. #10698

Open
rzvc opened this issue Feb 12, 2024 · 1 comment
Open

@psalm-assert cannot be used with imported and aliased types. #10698

rzvc opened this issue Feb 12, 2024 · 1 comment

Comments

@rzvc
Copy link

rzvc commented Feb 12, 2024

Same symptoms as #8263.

https://psalm.dev/r/4da30212ca

Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants