-
Notifications
You must be signed in to change notification settings - Fork 660
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
ParamNameMismatch not reported for __construct #10784
Comments
I found these snippets: https://psalm.dev/r/f49829b72e<?php
class A
{
public function __construct(
string $name,
string $email,
) {}
public function foo(
string $name,
string $email,
) {}
}
class B extends A
{
public function __construct(
string $names,
string $email,
) {}
public function foo(
string $names,
string $email,
) {}
}
https://psalm.dev/r/3f6f25190f<?php
class A
{
public function __construct(
public string $name,
public string $foo,
) {}
}
class B extends A
{
public function __construct(
public string $names,
public string $foo,
) {}
}
|
Constructors generally don't have to be compatible. However we should report name mismatches if the constructor is declared consistent by using |
I found these snippets: https://psalm.dev/r/80275d44f3<?php
/** @psalm-consistent-constructor */
class A
{
public function __construct(
string $aaaa,
) {}
}
class B extends A
{
public function __construct(
string $xxx,
) {}
}
|
But isn't this an issue with named arguments then? Only if @no-named-arguments is used, it shouldn't report an error, shouldn't it? EDIT:
|
No, it should be like the following:
|
https://psalm.dev/r/f49829b72e
Besides named argument calls, this is also an issue with promoted properties: https://psalm.dev/r/3f6f25190f
which is the reason this should report an error
The text was updated successfully, but these errors were encountered: