Skip to content

Commit f7c6464

Browse files
committed
Sync parse_url signature with PHP 8
1 parent a82605f commit f7c6464

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

resources/functionMap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8230,7 +8230,7 @@
82308230
'parse_ini_file' => ['array|false', 'filename'=>'string', 'process_sections='=>'bool', 'scanner_mode='=>'int'],
82318231
'parse_ini_string' => ['array|false', 'ini_string'=>'string', 'process_sections='=>'bool', 'scanner_mode='=>'int'],
82328232
'parse_str' => ['void', 'encoded_string'=>'string', '&w_result='=>'array'],
8233-
'parse_url' => ['mixed', 'url'=>'string', 'url_component='=>'int'],
8233+
'parse_url' => ['array|int|string|false|null', 'url'=>'string', 'url_component='=>'int'],
82348234
'ParseError::__clone' => ['void'],
82358235
'ParseError::__construct' => ['void', 'message='=>'string', 'code='=>'int', 'previous='=>'(?Throwable)|(?ParseError)'],
82368236
'ParseError::__toString' => ['string'],

src/Type/Php/ParseUrlFunctionDynamicReturnTypeExtension.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@ public function isFunctionSupported(FunctionReflection $functionReflection): boo
3636

3737
public function getTypeFromFunctionCall(FunctionReflection $functionReflection, FuncCall $functionCall, Scope $scope): Type
3838
{
39-
$defaultReturnType = ParametersAcceptorSelector::selectSingle(
40-
$functionReflection->getVariants()
41-
)->getReturnType();
42-
4339
if (count($functionCall->args) < 1) {
44-
return $defaultReturnType;
40+
return ParametersAcceptorSelector::selectSingle(
41+
$functionReflection->getVariants()
42+
)->getReturnType();
4543
}
4644

4745
$this->cacheReturnTypes();

tests/PHPStan/Analyser/LegacyNodeScopeResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5917,7 +5917,7 @@ public function dataFunctions(): array
59175917
],
59185918
// parse_url
59195919
[
5920-
'mixed',
5920+
'array|int|string|false|null',
59215921
'$parseUrlWithoutParameters',
59225922
],
59235923
[

0 commit comments

Comments
 (0)