Sounds like it is running an older version of php than 7.4. Check your homestead.yaml file for the version (if specified)
You can try setting it and reprovision
https://laravel.com/docs/6.x/homestead#multiple-php-versions
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
At some point something happened to my Homestead VM, but I don't know what it was. All of my databases were gone (I have migrations) and now any PHP arrow functions I have in my code produce a Symfony\Component\Debug\Exception\FatalThrowableError exception with the message "syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ')'". Switching the code from an arrow function
$job_ids = $jobs->map(fn($job) => $job->role_id)->unique();
back to a callback with typical syntax
$job_ids = $jobs->map(function ($job) { return $job->role_id; })->unique();
fixes the error but arrow functions are spread throughout my code base.
I also tried running an arrow function with artisan tinker and it worked just fine, which make this even more confusing to me.
>>> $collection = collect([1,2,3,4]);
=> Illuminate\Support\Collection {#3366
all: [
1,
2,
3,
4,
],
}
>>> $collection->map(fn($item) => $item * 2);
=> Illuminate\Support\Collection {#3357
all: [
2,
4,
6,
8,
],
}
>>>
I'm wondering, is there a command I need to run to refresh something?
ETA: I'm running PHP 7.4.0 and Laravel 6.9.0
Sounds like it is running an older version of php than 7.4. Check your homestead.yaml file for the version (if specified)
You can try setting it and reprovision
https://laravel.com/docs/6.x/homestead#multiple-php-versions
Please or to participate in this conversation.