Closed Indeedornot closed 3 months ago
Describe the bug No type inference from array_map - As far as I know it has been introduced in 1.9 but does not work anymore
To Reproduce
$test = array_map(fn($test) => $test, ['test']);
More complex example
public function canAccessRoute(Route $route): bool { [$controller, $function] = explode('::', $route->getDefault('_controller')); $attrs = [...$this->reflection->findClassAttribute($controller, IsGranted::class)]; $attrs = [...$attrs, ...$this->reflection->findClassAttribute($controller, IsGranted::class, $function)]; if (empty($attrs)) { return true; } $isGranted = array_map(function (ReflectionAttribute $attr) { return $attr->getArguments()[0]; }, $attrs); $isGranted = array_map(fn ($role) => $this->security->isGranted($role), $isGranted); return !in_array(false, $isGranted); }
Expected behavior Argument of an array_map closure is correctly infered and so is its transformation
Screenshots Looses generic type argument due to need for static typing to get hints
Platform and version Windows 10 Intelephense v1.10.2
Describe the bug No type inference from array_map - As far as I know it has been introduced in 1.9 but does not work anymore
To Reproduce
More complex example
Expected behavior Argument of an array_map closure is correctly infered and so is its transformation
Screenshots Looses generic type argument due to need for static typing to get hints
Platform and version Windows 10 Intelephense v1.10.2