Skip to content

Commit bc01976

Browse files
authored
Fix named args false positive (#196)
1 parent b655392 commit bc01976

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

src/UsedSymbolExtractor.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ private function canBeSymbolName(
415415
|| $tokenBeforeName[0] === (PHP_VERSION_ID > 80000 ? T_NULLSAFE_OBJECT_OPERATOR : -1)
416416
|| $tokenAfterName[0] === T_INSTEADOF
417417
|| $tokenAfterName[0] === T_AS
418+
|| $tokenAfterName === ':'
418419
) {
419420
return false;
420421
}

tests/UsedSymbolExtractorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ public function provideVariants(): iterable
206206
private static function extensionSymbolsForExtensionsTestCases(): array
207207
{
208208
return [
209+
strtolower('Normalizer') => SymbolKind::CLASSLIKE, // https://www.php.net/manual/en/class.normalizer.php
209210
strtolower('XMLReader') => SymbolKind::CLASSLIKE,
210211
strtolower('PDO') => SymbolKind::CLASSLIKE,
211212
strtolower('json_encode') => SymbolKind::FUNCTION,

tests/data/not-autoloaded/used-symbols/extensions.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@
2020
CURLOPT_SSL_VERIFYPEER;
2121
\json_decode('');
2222
ZipArchive::class;
23+
24+
function foo($normalizer) {}
25+
foo(normalizer: 1);

0 commit comments

Comments
 (0)