From a669c89074ecd25f77bce216ce086f6927ac7f97 Mon Sep 17 00:00:00 2001 From: Benjamin Morel Date: Sun, 8 Jan 2023 23:58:14 +0100 Subject: [PATCH] Fix ReflectionClass::newInstanceArgs() --- dictionaries/CallMap.php | 4 ++-- dictionaries/CallMap_80_delta.php | 6 +++++- dictionaries/CallMap_historical.php | 2 +- stubs/Php80.phpstub | 7 +++++++ stubs/Reflection.phpstub | 2 +- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index cc88e43fb..aed80cb23 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -11387,7 +11387,7 @@ return [ 'ReflectionClass::isTrait' => ['bool'], 'ReflectionClass::isUserDefined' => ['bool'], 'ReflectionClass::newInstance' => ['object', '...args='=>'mixed'], -'ReflectionClass::newInstanceArgs' => ['object', 'args='=>'array'], +'ReflectionClass::newInstanceArgs' => ['object', 'args='=>'list|array'], 'ReflectionClass::newInstanceWithoutConstructor' => ['object'], 'ReflectionClass::setStaticPropertyValue' => ['void', 'name'=>'string', 'value'=>'mixed'], 'ReflectionClassConstant::__construct' => ['void', 'class'=>'mixed', 'name'=>'string'], @@ -11590,7 +11590,7 @@ return [ 'ReflectionObject::isTrait' => ['bool'], 'ReflectionObject::isUserDefined' => ['bool'], 'ReflectionObject::newInstance' => ['object', 'args='=>'mixed', '...args='=>'array'], -'ReflectionObject::newInstanceArgs' => ['object', 'args='=>'array'], +'ReflectionObject::newInstanceArgs' => ['object', 'args='=>'list|array'], 'ReflectionObject::newInstanceWithoutConstructor' => ['object'], 'ReflectionObject::setStaticPropertyValue' => ['void', 'name'=>'string', 'value'=>'string'], 'ReflectionParameter::__clone' => ['void'], diff --git a/dictionaries/CallMap_80_delta.php b/dictionaries/CallMap_80_delta.php index 0cb1e3726..2214a7d37 100644 --- a/dictionaries/CallMap_80_delta.php +++ b/dictionaries/CallMap_80_delta.php @@ -259,12 +259,16 @@ return [ ], 'ReflectionClass::newInstanceArgs' => [ 'old' => ['object', 'args='=>'list'], - 'new' => ['object', 'args='=>'array'], + 'new' => ['object', 'args='=>'list|array'], ], 'ReflectionMethod::getClosure' => [ 'old' => ['?Closure', 'object='=>'object'], 'new' => ['Closure', 'object='=>'?object'], ], + 'ReflectionObject::newInstanceArgs' => [ + 'old' => ['object', 'args='=>'list'], + 'new' => ['object', 'args='=>'list|array'], + ], 'ReflectionProperty::getValue' => [ 'old' => ['mixed', 'object='=>'object'], 'new' => ['mixed', 'object='=>'null|object'], diff --git a/dictionaries/CallMap_historical.php b/dictionaries/CallMap_historical.php index 73cb2d80a..89b89ae96 100644 --- a/dictionaries/CallMap_historical.php +++ b/dictionaries/CallMap_historical.php @@ -6217,7 +6217,7 @@ return [ 'ReflectionObject::isTrait' => ['bool'], 'ReflectionObject::isUserDefined' => ['bool'], 'ReflectionObject::newInstance' => ['object', 'args='=>'mixed', '...args='=>'array'], - 'ReflectionObject::newInstanceArgs' => ['object', 'args='=>'array'], + 'ReflectionObject::newInstanceArgs' => ['object', 'args='=>'list'], 'ReflectionObject::newInstanceWithoutConstructor' => ['object'], 'ReflectionObject::setStaticPropertyValue' => ['void', 'name'=>'string', 'value'=>'string'], 'ReflectionParameter::__clone' => ['void'], diff --git a/stubs/Php80.phpstub b/stubs/Php80.phpstub index a15ddc82c..5a5363347 100644 --- a/stubs/Php80.phpstub +++ b/stubs/Php80.phpstub @@ -110,6 +110,13 @@ class ReflectionClass implements Reflector { * @psalm-pure */ public function getExtensionName(): string|false {} + + /** + * @param list|array $args + * + * @return T + */ + public function newInstanceArgs(array $args): object {} } /** @psalm-immutable */ diff --git a/stubs/Reflection.phpstub b/stubs/Reflection.phpstub index 0bb12352d..e69da1243 100644 --- a/stubs/Reflection.phpstub +++ b/stubs/Reflection.phpstub @@ -196,7 +196,7 @@ class ReflectionClass implements Reflector { public function newInstance(...$args): object {} /** - * @param array $args + * @param list $args * * @return T */