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

Definitions after a conditional duplicate definition aren't parsed #4264

Closed
gnarlyquack opened this issue Oct 1, 2020 · 0 comments
Closed
Labels

Comments

@gnarlyquack
Copy link

This causes Psalm to crash ("could not get storage class for X") when those definitions are then referenced in other files.

This can't be reproduced on psalm.dev as multiple files are needed to trigger the error. Here's a minimal reproduction:

<?php
// one.php

if (true) {
    class One {}
}
else {
    class One {}
}

class Two {}
<?php
// two.php

new Two();

In composer.json:

{
    "autoload": {
        "files": ["one.php", "two.php"]
    }
}

I get that Psalm doesn't like the conditional duplicate class definition of One, but it doesn't seem like that should prevent subsequent definitions from being parsed.

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

No branches or pull requests

2 participants