Skip to content

Commit

Permalink
Merge pull request #9085 from BenMorel/newInstanceArgs
Browse files Browse the repository at this point in the history
Fix ReflectionClass::newInstanceArgs() with named parameters
  • Loading branch information
orklah committed Jan 19, 2023
2 parents d32aca3 + a669c89 commit a4d1b06
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dictionaries/CallMap.php
Expand Up @@ -11385,7 +11385,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 @@ -11588,7 +11588,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 @@ -6215,7 +6215,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

0 comments on commit a4d1b06

Please sign in to comment.