Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Jan 18, 2025
1 parent ca3949e commit ca0e233
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/gen_callmap_utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function assertParameter(array &$normalizedEntry, ReflectionParameter $param): v
function assertEntryReturnType(ReflectionFunctionAbstract $function, string &$entryReturnType): void
{
if (version_compare(PHP_VERSION, '8.1.0', '>=')) {
$expectedType = $function->hasTentativeReturnType() ? $function->getTentativeReturnType() : $function->getReturnType();
$expectedType = $function->getTentativeReturnType() ?? $function->getReturnType();
} else {
$expectedType = $function->getReturnType();
}
Expand Down
4 changes: 3 additions & 1 deletion src/Psalm/Internal/Codebase/Reflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,9 @@ public function registerFunction(string $function_id): ?bool
$storage->addParam($param_obj);
}

if ($reflection_return_type = $reflection_function->getReturnType()) {
if ($reflection_return_type = (PHP_VERSION_ID >= 80100 ? (
$reflection_function->getTentativeReturnType() ?? $reflection_function->getReturnType()
) : $reflection_function->getReturnType())) {
$storage->return_type = self::getPsalmTypeFromReflectionType($reflection_return_type);
}
}
Expand Down

0 comments on commit ca0e233

Please sign in to comment.