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

MissingConstructor message only shows first entry #4297

Closed
theseer opened this issue Oct 7, 2020 · 5 comments
Closed

MissingConstructor message only shows first entry #4297

theseer opened this issue Oct 7, 2020 · 5 comments
Labels

Comments

@theseer
Copy link

theseer commented Oct 7, 2020

Given the following example class, the error reporting is not correctly updated for the 2+ property:

class foo {
    
    private array $a;
    
    private array $b;
    
    private array $c;

}

Reproducable on psalm.dev

It seems to me that when having multiple properties triggering the MissingConstructor error, while all are being reported, only the first property is used in the accompanying error messages.

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/9875de887d
<?php

class foo {
 
    private $a;
    
    private $b;
}
Psalm output (using commit c2108e8):

INFO: MissingPropertyType - 5:13 - Property foo::$a does not have a declared type

INFO: MissingPropertyType - 7:13 - Property foo::$b does not have a declared type

@muglug
Copy link
Collaborator

muglug commented Oct 7, 2020

I'm confused. What's incorrect about this? https://psalm.dev/r/469ee6ca54

@muglug muglug closed this as completed Oct 7, 2020
@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/469ee6ca54
<?php

class foo {
    private array $a;
    private array $b;
    private array $c;
}
Psalm output (using commit c8d4baf):

ERROR: MissingConstructor - 4:19 - foo has an uninitialized property $this->a, but no constructor

ERROR: MissingConstructor - 5:19 - foo has an uninitialized property $this->a, but no constructor

ERROR: MissingConstructor - 6:19 - foo has an uninitialized property $this->a, but no constructor

@muglug muglug reopened this Oct 7, 2020
@theseer
Copy link
Author

theseer commented Oct 7, 2020

I assume reopening it implies your confusion is resolved? ;)

If not: Read the actual text of the error message. It's in all cases referring to $this->a ...

@muglug muglug added the bug label Oct 7, 2020
@muglug
Copy link
Collaborator

muglug commented Oct 7, 2020

Oh!

@muglug muglug closed this as completed in 8b7657f Oct 7, 2020
danog pushed a commit to danog/psalm that referenced this issue Jan 29, 2021
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