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

Fix ReflectionClass::newInstanceArgs() with named parameters #9085

Merged
merged 1 commit into from Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions dictionaries/CallMap.php
Expand Up @@ -11387,7 +11387,7 @@
'ReflectionClass::isTrait' => ['bool'],
'ReflectionClass::isUserDefined' => ['bool'],
'ReflectionClass::newInstance' => ['object', '...args='=>'mixed'],
'ReflectionClass::newInstanceArgs' => ['object', 'args='=>'array<array-key, mixed>'],
'ReflectionClass::newInstanceArgs' => ['object', 'args='=>'list<mixed>|array<string, mixed>'],
'ReflectionClass::newInstanceWithoutConstructor' => ['object'],
'ReflectionClass::setStaticPropertyValue' => ['void', 'name'=>'string', 'value'=>'mixed'],
'ReflectionClassConstant::__construct' => ['void', 'class'=>'mixed', 'name'=>'string'],
Expand Down Expand Up @@ -11590,7 +11590,7 @@
'ReflectionObject::isTrait' => ['bool'],
'ReflectionObject::isUserDefined' => ['bool'],
'ReflectionObject::newInstance' => ['object', 'args='=>'mixed', '...args='=>'array'],
'ReflectionObject::newInstanceArgs' => ['object', 'args='=>'array'],
'ReflectionObject::newInstanceArgs' => ['object', 'args='=>'list<mixed>|array<string, mixed>'],
'ReflectionObject::newInstanceWithoutConstructor' => ['object'],
'ReflectionObject::setStaticPropertyValue' => ['void', 'name'=>'string', 'value'=>'string'],
'ReflectionParameter::__clone' => ['void'],
Expand Down
6 changes: 5 additions & 1 deletion dictionaries/CallMap_80_delta.php
Expand Up @@ -259,12 +259,16 @@
],
'ReflectionClass::newInstanceArgs' => [
'old' => ['object', 'args='=>'list<mixed>'],
'new' => ['object', 'args='=>'array<array-key, mixed>'],
'new' => ['object', 'args='=>'list<mixed>|array<string, mixed>'],
],
'ReflectionMethod::getClosure' => [
'old' => ['?Closure', 'object='=>'object'],
'new' => ['Closure', 'object='=>'?object'],
],
'ReflectionObject::newInstanceArgs' => [
'old' => ['object', 'args='=>'list<mixed>'],
'new' => ['object', 'args='=>'list<mixed>|array<string, mixed>'],
],
'ReflectionProperty::getValue' => [
'old' => ['mixed', 'object='=>'object'],
'new' => ['mixed', 'object='=>'null|object'],
Expand Down
2 changes: 1 addition & 1 deletion dictionaries/CallMap_historical.php
Expand Up @@ -6217,7 +6217,7 @@
'ReflectionObject::isTrait' => ['bool'],
'ReflectionObject::isUserDefined' => ['bool'],
'ReflectionObject::newInstance' => ['object', 'args='=>'mixed', '...args='=>'array'],
'ReflectionObject::newInstanceArgs' => ['object', 'args='=>'array'],
'ReflectionObject::newInstanceArgs' => ['object', 'args='=>'list<mixed>'],
'ReflectionObject::newInstanceWithoutConstructor' => ['object'],
'ReflectionObject::setStaticPropertyValue' => ['void', 'name'=>'string', 'value'=>'string'],
'ReflectionParameter::__clone' => ['void'],
Expand Down
7 changes: 7 additions & 0 deletions stubs/Php80.phpstub
Expand Up @@ -110,6 +110,13 @@ class ReflectionClass implements Reflector {
* @psalm-pure
*/
public function getExtensionName(): string|false {}

/**
* @param list<mixed>|array<string, mixed> $args
*
* @return T
*/
public function newInstanceArgs(array $args): object {}
}

/** @psalm-immutable */
Expand Down
2 changes: 1 addition & 1 deletion stubs/Reflection.phpstub
Expand Up @@ -196,7 +196,7 @@ class ReflectionClass implements Reflector {
public function newInstance(...$args): object {}

/**
* @param array<int, mixed> $args
* @param list<mixed> $args
*
* @return T
*/
Expand Down