1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Fix ReflectionClass::newInstanceArgs()

This commit is contained in:
Benjamin Morel 2023-01-08 23:58:14 +01:00
parent 729c0ba5ed
commit a669c89074
5 changed files with 16 additions and 5 deletions

View File

@ -11387,7 +11387,7 @@ return [
'ReflectionClass::isTrait' => ['bool'], 'ReflectionClass::isTrait' => ['bool'],
'ReflectionClass::isUserDefined' => ['bool'], 'ReflectionClass::isUserDefined' => ['bool'],
'ReflectionClass::newInstance' => ['object', '...args='=>'mixed'], '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::newInstanceWithoutConstructor' => ['object'],
'ReflectionClass::setStaticPropertyValue' => ['void', 'name'=>'string', 'value'=>'mixed'], 'ReflectionClass::setStaticPropertyValue' => ['void', 'name'=>'string', 'value'=>'mixed'],
'ReflectionClassConstant::__construct' => ['void', 'class'=>'mixed', 'name'=>'string'], 'ReflectionClassConstant::__construct' => ['void', 'class'=>'mixed', 'name'=>'string'],
@ -11590,7 +11590,7 @@ return [
'ReflectionObject::isTrait' => ['bool'], 'ReflectionObject::isTrait' => ['bool'],
'ReflectionObject::isUserDefined' => ['bool'], 'ReflectionObject::isUserDefined' => ['bool'],
'ReflectionObject::newInstance' => ['object', 'args='=>'mixed', '...args='=>'array'], '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::newInstanceWithoutConstructor' => ['object'],
'ReflectionObject::setStaticPropertyValue' => ['void', 'name'=>'string', 'value'=>'string'], 'ReflectionObject::setStaticPropertyValue' => ['void', 'name'=>'string', 'value'=>'string'],
'ReflectionParameter::__clone' => ['void'], 'ReflectionParameter::__clone' => ['void'],

View File

@ -259,12 +259,16 @@ return [
], ],
'ReflectionClass::newInstanceArgs' => [ 'ReflectionClass::newInstanceArgs' => [
'old' => ['object', 'args='=>'list<mixed>'], 'old' => ['object', 'args='=>'list<mixed>'],
'new' => ['object', 'args='=>'array<array-key, mixed>'], 'new' => ['object', 'args='=>'list<mixed>|array<string, mixed>'],
], ],
'ReflectionMethod::getClosure' => [ 'ReflectionMethod::getClosure' => [
'old' => ['?Closure', 'object='=>'object'], 'old' => ['?Closure', 'object='=>'object'],
'new' => ['Closure', 'object='=>'?object'], 'new' => ['Closure', 'object='=>'?object'],
], ],
'ReflectionObject::newInstanceArgs' => [
'old' => ['object', 'args='=>'list<mixed>'],
'new' => ['object', 'args='=>'list<mixed>|array<string, mixed>'],
],
'ReflectionProperty::getValue' => [ 'ReflectionProperty::getValue' => [
'old' => ['mixed', 'object='=>'object'], 'old' => ['mixed', 'object='=>'object'],
'new' => ['mixed', 'object='=>'null|object'], 'new' => ['mixed', 'object='=>'null|object'],

View File

@ -6217,7 +6217,7 @@ return [
'ReflectionObject::isTrait' => ['bool'], 'ReflectionObject::isTrait' => ['bool'],
'ReflectionObject::isUserDefined' => ['bool'], 'ReflectionObject::isUserDefined' => ['bool'],
'ReflectionObject::newInstance' => ['object', 'args='=>'mixed', '...args='=>'array'], 'ReflectionObject::newInstance' => ['object', 'args='=>'mixed', '...args='=>'array'],
'ReflectionObject::newInstanceArgs' => ['object', 'args='=>'array'], 'ReflectionObject::newInstanceArgs' => ['object', 'args='=>'list<mixed>'],
'ReflectionObject::newInstanceWithoutConstructor' => ['object'], 'ReflectionObject::newInstanceWithoutConstructor' => ['object'],
'ReflectionObject::setStaticPropertyValue' => ['void', 'name'=>'string', 'value'=>'string'], 'ReflectionObject::setStaticPropertyValue' => ['void', 'name'=>'string', 'value'=>'string'],
'ReflectionParameter::__clone' => ['void'], 'ReflectionParameter::__clone' => ['void'],

View File

@ -110,6 +110,13 @@ class ReflectionClass implements Reflector {
* @psalm-pure * @psalm-pure
*/ */
public function getExtensionName(): string|false {} public function getExtensionName(): string|false {}
/**
* @param list<mixed>|array<string, mixed> $args
*
* @return T
*/
public function newInstanceArgs(array $args): object {}
} }
/** @psalm-immutable */ /** @psalm-immutable */

View File

@ -196,7 +196,7 @@ class ReflectionClass implements Reflector {
public function newInstance(...$args): object {} public function newInstance(...$args): object {}
/** /**
* @param array<int, mixed> $args * @param list<mixed> $args
* *
* @return T * @return T
*/ */