The extension incorrectly identifies PHP 8.1's first-class callable syntax when passing a method reference to a function expecting a callable.
Example Code (Laravel 12)
public function deleteUser(Logout $logout): void
{
$this->validate([
'password' => ['required', 'string', 'current_password'],
]);
tap(Auth::user(), $logout(...))->delete();
$this->redirect('/', navigate: true);
}
The second argument passed to tap() should be recognized as a callable, as $logout(...) passes the function reference without executing it. The extension incorrectly assumes $logout(...) executes immediately and returns a RedirectResponse, causing this warning:
"Argument '2' passed to tap() is expected to be of type callable|null, Illuminate\Http\RedirectResponse given PHP(PHP0406)"