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

Implode of literal-string should be inferred as literal-string #10909

Open
VincentLanglet opened this issue Apr 17, 2024 · 1 comment
Open

Implode of literal-string should be inferred as literal-string #10909

VincentLanglet opened this issue Apr 17, 2024 · 1 comment

Comments

@VincentLanglet
Copy link
Contributor

Cf rfc: https://wiki.php.net/rfc/is_literal

Cf phpstan: https://phpstan.org/r/ca885493-b98a-4192-9e9b-eccabeda173a

Psalm snippet
https://psalm.dev/r/36ad98d72b

Copy link

I found these snippets:

https://psalm.dev/r/36ad98d72b
<?php

/** @param array<literal-string> $string */
function test(array $string): void
{
    /** @psalm-trace $a */
    $a = implode('e', $string);
}
Psalm output (using commit 08afc45):

INFO: Trace - 7:5 - $a: string

INFO: UnusedVariable - 7:5 - $a is never referenced or the value is not used

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

No branches or pull requests

1 participant