bmewburn / vscode-intelephense

PHP intellisense for Visual Studio Code
https://intelephense.com
Other
1.57k stars 93 forks source link

False unknown named arg with anon function #2801

Closed bmewburn closed 3 months ago

bmewburn commented 4 months ago
          Still can reproduce version v1.10.2:

Unknown named argument $files.intelephense(P1044)

Note that in this case "css_dir" doesn't yield any intelephense error (only this is displayed when hover on: @var unset $css_dir)

$loader = function (array $files, $css_dir = 'scss') {
    // stuff
};
$loader(files: ['a.txt', 'b.txt'], css_dir: 'css');

Unknown named argument $css_dir.intelephense(P1044)

$loader = function (array $files, $css_dir = 'scss') {
    // stuff
};
$loader(['a.txt', 'b.txt'], css_dir: 'css');

Originally posted by @realjjaveweb in https://github.com/bmewburn/vscode-intelephense/issues/2154#issuecomment-1951413629

realjjaveweb commented 4 months ago

To clarify - PHP version is set to PHP 8.1 in the intelephense settings and the code does work with the named argument in practice. vscode version: 1.86.1

realjjaveweb commented 3 months ago

Thank you. Although unknown named argument was fixed, hovering over "files" still says "@var unset $files" and also the type is assumed for the closure from the default value @var \Closure(array $files, string $css_dir = 'scss'): void $loader, the css_dir argument does not define "string" as type, it defines no type, so it should be "mixed", only the default value is string.