Skip to content

Commit

Permalink
Sync parse_url signature with PHP 8
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Aug 31, 2021
1 parent a82605f commit f7c6464
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion resources/functionMap.php
Expand Up @@ -8230,7 +8230,7 @@
'parse_ini_file' => ['array|false', 'filename'=>'string', 'process_sections='=>'bool', 'scanner_mode='=>'int'],
'parse_ini_string' => ['array|false', 'ini_string'=>'string', 'process_sections='=>'bool', 'scanner_mode='=>'int'],
'parse_str' => ['void', 'encoded_string'=>'string', '&w_result='=>'array'],
'parse_url' => ['mixed', 'url'=>'string', 'url_component='=>'int'],
'parse_url' => ['array|int|string|false|null', 'url'=>'string', 'url_component='=>'int'],
'ParseError::__clone' => ['void'],
'ParseError::__construct' => ['void', 'message='=>'string', 'code='=>'int', 'previous='=>'(?Throwable)|(?ParseError)'],
'ParseError::__toString' => ['string'],
Expand Down
8 changes: 3 additions & 5 deletions src/Type/Php/ParseUrlFunctionDynamicReturnTypeExtension.php
Expand Up @@ -36,12 +36,10 @@ public function isFunctionSupported(FunctionReflection $functionReflection): boo

public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): Type
{
$defaultReturnType = ParametersAcceptorSelector::selectSingle(
$functionReflection->getVariants()
)->getReturnType();

if (count($functionCall->args) < 1) {
return $defaultReturnType;
return ParametersAcceptorSelector::selectSingle(
$functionReflection->getVariants()
)->getReturnType();
}

$this->cacheReturnTypes();
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Analyser/LegacyNodeScopeResolverTest.php
Expand Up @@ -5917,7 +5917,7 @@ public function dataFunctions(): array
],
// parse_url
[
'mixed',
'array|int|string|false|null',
'$parseUrlWithoutParameters',
],
[
Expand Down

0 comments on commit f7c6464

Please sign in to comment.