Skip to content

Commit

Permalink
bump
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Nov 30, 2024
1 parent a05ac99 commit 12e5f79
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 19 deletions.
30 changes: 21 additions & 9 deletions bin/gen_callmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 */
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion dictionaries/CallMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -12697,7 +12697,7 @@
'exit' =>
array (
0 => 'never',
'status' => 'string|int',
'status=' => 'string|int',
),
'exp' =>
array (
Expand Down Expand Up @@ -44802,6 +44802,7 @@
'days' => 'int',
'options=' => 'array|null',
'serial=' => 'int',
'serial_hex=' => 'string|null',
),
'openssl_decrypt' =>
array (
Expand Down
41 changes: 32 additions & 9 deletions dictionaries/CallMap_84_delta.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
),
),
),
);

0 comments on commit 12e5f79

Please sign in to comment.