Description
v2.11.13 works, but since v2.11.14 the following code gives 2 warnings:
15 | WARNING | Variable $item is undefined.
21 | WARNING | Variable $value is undefined.
<?php
declare(strict_types=1);
namespace App\Http\Controllers\Admin;
use App\Entities\Vacancy;
class VacancyController
{
public function index(): array
{
$first = Vacancy::query()->where(static fn ($query) => $query)->first(); // OK
$val = static fn ($item): string => $item; // fails
return [
'first' => $first,
'val' => $val,
'fn1' => static fn ($val): string => $val, // OK (because $val exists)
'fn2' => static fn (Vacancy $value): Vacancy => $value, // fails
];
}
}
only the first arrow function reaches the last return in getArrowFunctionOpenClose
Metadata
Metadata
Assignees
Labels
No labels