From 12e5f79326f35497e87918f3aef1240a572a9f07 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sat, 30 Nov 2024 11:36:30 +0100 Subject: [PATCH] bump --- bin/gen_callmap.php | 30 +++++++++++++++------- dictionaries/CallMap.php | 3 ++- dictionaries/CallMap_84_delta.php | 41 ++++++++++++++++++++++++------- 3 files changed, 55 insertions(+), 19 deletions(-) diff --git a/bin/gen_callmap.php b/bin/gen_callmap.php index f1fe2dba826..255f23f3a36 100644 --- a/bin/gen_callmap.php +++ b/bin/gen_callmap.php @@ -14,6 +14,7 @@ use Psalm\Internal\Type\Comparator\UnionTypeComparator; use Psalm\Tests\TestConfig; use Psalm\Type; +use Psalm\Type\Atomic\TNull; /** * Returns the correct reflection type for function or method name. @@ -22,7 +23,11 @@ function getReflectionFunction(string $functionName): ?ReflectionFunctionAbstrac { try { if (strpos($functionName, '::') !== false) { - return new ReflectionMethod($functionName); + if (PHP_VERSION_ID < 8_03_00) { + return new ReflectionMethod($functionName); + } + + return ReflectionMethod::createFromMethodName($functionName); } /** @var callable-string $functionName */ @@ -143,14 +148,21 @@ function assertTypeValidity(ReflectionType $reflected, string &$specified, strin } catch (Throwable) { } - // Reflection::getPsalmTypeFromReflectionType adds |null to mixed types so skip comparison - /*if (!$expectedType->hasMixed()) { - $this->assertSame($expectedType->isNullable(), $callMapType->isNullable(), "{$msgPrefix} type '{$specified}' missing null from reflected type '{$reflected}'"); - //$this->assertSame($expectedType->hasBool(), $callMapType->hasBool(), "{$msgPrefix} type '{$specified}' missing bool from reflected type '{$reflected}'"); - $this->assertSame($expectedType->hasArray(), $callMapType->hasArray(), "{$msgPrefix} type '{$specified}' missing array from reflected type '{$reflected}'"); - $this->assertSame($expectedType->hasInt(), $callMapType->hasInt(), "{$msgPrefix} type '{$specified}' missing int from reflected type '{$reflected}'"); - $this->assertSame($expectedType->hasFloat(), $callMapType->hasFloat(), "{$msgPrefix} type '{$specified}' missing float from reflected type '{$reflected}'"); - }*/ + if ($expectedType->hasMixed()) { + return; + } + $callMapType = $callMapType->getBuilder(); + if ($expectedType->isNullable() !== $callMapType->isNullable()) { + if ($expectedType->isNullable()) { + $callMapType->addType(new TNull()); + } else { + $callMapType->removeType('null'); + } + } + // //$this->assertSame($expectedType->hasBool(), $callMapType->hasBool(), "{$msgPrefix} type '{$specified}' missing bool from reflected type '{$reflected}'"); + // $this->assertSame($expectedType->hasArray(), $callMapType->hasArray(), "{$msgPrefix} type '{$specified}' missing array from reflected type '{$reflected}'"); + // $this->assertSame($expectedType->hasInt(), $callMapType->hasInt(), "{$msgPrefix} type '{$specified}' missing int from reflected type '{$reflected}'"); + // $this->assertSame($expectedType->hasFloat(), $callMapType->hasFloat(), "{$msgPrefix} type '{$specified}' missing float from reflected type '{$reflected}'"); } BypassFinals::enable(); diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index f1de67b971d..d62f2fcfe91 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -12697,7 +12697,7 @@ 'exit' => array ( 0 => 'never', - 'status' => 'string|int', + 'status=' => 'string|int', ), 'exp' => array ( @@ -44802,6 +44802,7 @@ 'days' => 'int', 'options=' => 'array|null', 'serial=' => 'int', + 'serial_hex=' => 'string|null', ), 'openssl_decrypt' => array ( diff --git a/dictionaries/CallMap_84_delta.php b/dictionaries/CallMap_84_delta.php index b245fce7198..f9185c725a7 100644 --- a/dictionaries/CallMap_84_delta.php +++ b/dictionaries/CallMap_84_delta.php @@ -1720,14 +1720,37 @@ 'bucket' => 'StreamBucket', ), ), - - 'xml_set_element_handler' => [ - 'old' => ['true', 'parser'=>'XMLParser', 'start_handler'=>'callable', 'end_handler'=>'callable'], - 'new' => ['true', 'parser'=>'XMLParser', 'start_handler'=>'callable|null', 'end_handler'=>'callable'], - ], - 'xml_set_start_namespace_decl_handler' => [ - 'old' => ['true', 'parser'=>'XMLParser', 'handler'=>'callable'], - 'new' => ['true', 'parser'=>'XMLParser', 'handler'=>'callable|null'], - ], + 'xml_set_element_handler' => + array ( + 'old' => + array ( + 0 => 'true', + 'parser' => 'XMLParser', + 'start_handler' => 'callable', + 'end_handler' => 'callable', + ), + 'new' => + array ( + 0 => 'true', + 'parser' => 'XMLParser', + 'start_handler' => 'callable|null', + 'end_handler' => 'callable', + ), + ), + 'xml_set_start_namespace_decl_handler' => + array ( + 'old' => + array ( + 0 => 'true', + 'parser' => 'XMLParser', + 'handler' => 'callable', + ), + 'new' => + array ( + 0 => 'true', + 'parser' => 'XMLParser', + 'handler' => 'callable|null', + ), + ), ), ); \ No newline at end of file