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

Encapsed string loses literal string details for unions unlike concat #10946

Open
kkmuffme opened this issue May 3, 2024 · 1 comment · May be fixed by #10948
Open

Encapsed string loses literal string details for unions unlike concat #10946

kkmuffme opened this issue May 3, 2024 · 1 comment · May be fixed by #10948

Comments

@kkmuffme
Copy link
Contributor

kkmuffme commented May 3, 2024

https://psalm.dev/r/448c9d0bef

Copy link

I found these snippets:

https://psalm.dev/r/448c9d0bef
<?php

/**
 * @var 'hello'|'world' $a
 * @var 'foo'|'bar' $b
 * @var 'x'|'y' $c
 */

$x = $a . $b . $c;
/** @psalm-trace $x */;

$y = "hello {$a} world";
/** @psalm-trace $y */;

$z = "{$a}{$b}{$c}";
/** @psalm-trace $z */;
Psalm output (using commit 08afc45):

INFO: Trace - 10:23 - $x: 'hellobarx'|'hellobary'|'hellofoox'|'hellofooy'|'worldbarx'|'worldbary'|'worldfoox'|'worldfooy'

INFO: Trace - 13:23 - $y: non-empty-literal-string

INFO: Trace - 16:23 - $z: non-empty-literal-string

INFO: UnusedVariable - 9:1 - $x is never referenced or the value is not used

INFO: UnusedVariable - 12:1 - $y is never referenced or the value is not used

INFO: UnusedVariable - 15:1 - $z is never referenced or the value is not used

@kkmuffme kkmuffme linked a pull request May 3, 2024 that will close this issue
kkmuffme added a commit to kkmuffme/psalm that referenced this issue May 5, 2024
kkmuffme added a commit to kkmuffme/psalm that referenced this issue May 5, 2024
kkmuffme added a commit to kkmuffme/psalm that referenced this issue May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants