Syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ')'
Closed this issue · 2 comments
Alvaro-Vidal-Azevedo-Pinheiro commented
I have been using this package for quite a while but I have encountered the following error recently
exception: "ParseError"
file: "/var/www/html/vendor/outl1ne/nova-multiselect-field/src/Traits/MultiselectBelongsToSupport.php"
line: 109
message: "syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ')'"
The error seems to be in regard to this line, about to the '{' and '}'
return $value->map(fn ($model) => $model->{$this->keyName ?? $model->getKeyName()})->toArray();
A simple fix to something like this should be enough
return $value->map(function ($model) {
$tempKeyName = $this->keyName ?? $model->getKeyName();
return $model->$tempKeyName;
})->toArray();
KasparRosin commented
Thanks for the report.
What version of php are you running?
Unable to reproduce it myself with 8.1.13
Tarpsvo commented
Heya! I fixed it for backwards compatibility in 4.3.0. :) Thanks!