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

Support references #7254

Closed
AndrolGenhald opened this issue Dec 30, 2021 · 2 comments
Closed

Support references #7254

AndrolGenhald opened this issue Dec 30, 2021 · 2 comments

Comments

@AndrolGenhald
Copy link
Collaborator

References aren't really supported by Psalm at the moment outside of ReferenceConstraintViolation and related issues when using references in arguments. It would be nice to fully support references.

https://3v4l.org/mQ809
https://psalm.dev/r/d79b9b2f0f

See also #7252 (when fixed skipped tests should be unskipped).

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/d79b9b2f0f
<?php

$a = 1;
$b = &$a;
$b = 2;
$c = 3;
$b = &$c;
$b = 4;

/** @psalm-trace $a, $b, $c */;
Psalm output (using commit 0ec8dd2):

INFO: Trace - 10:31 - $a: 1

INFO: Trace - 10:31 - $b: 4

INFO: Trace - 10:31 - $c: 3

@orklah
Copy link
Collaborator

orklah commented Dec 30, 2021

Yeah, I believe we also have some flaws about references wrongly considered unused. I tried to flag issues related to references here: https://github.com/vimeo/psalm/issues?q=is%3Aissue+is%3Aopen+label%3Areferences

orklah added a commit that referenced this issue Jan 26, 2022
Add support for references and improve UnusedVariable checks (fixes #7254).
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