-
Notifications
You must be signed in to change notification settings - Fork 669
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
ReflectionClass::newInstanceArgs() accepts associative arrays #9077
Comments
I found these snippets: https://psalm.dev/r/835445aea1<?php
class X {
public function __construct(
public readonly string $a,
public readonly string $b,
) {
}
}
$r = new ReflectionClass(X::class);
$r->newInstanceArgs([
'b' => 1,
'a' => 2,
]);
|
I tried to fix it, but I fail to understand the hierarchy of CallMaps that leads Psalm to fail on this example on PHP 8:
I think a sane validation would be (for both
(even though |
@BenMorel new stubs were introduced for Reflection classes: https://github.com/vimeo/psalm/blob/master/stubs/Reflection.phpstub They take precedence over the callmaps, your fix should belong here |
Since PHP 8,
ReflectionClass::newInstanceArgs()
accepts an associative array of parameter names.This code works (https://3v4l.org/L0kj4):
But Psalm fails with:
https://psalm.dev/r/835445aea1
The text was updated successfully, but these errors were encountered: