MedicOneSystems / livewire-datatables

Advanced datatables using Laravel, Livewire, Tailwind CSS and Alpine JS
https://livewire-datatables.com/
MIT License
1.19k stars 258 forks source link

ParseError syntax error, unexpected '|', expecting variable #451

Open jayomayan opened 2 years ago

jayomayan commented 2 years ago

ParseError syntax error, unexpected '|', expecting variable (T_VARIABLE) (View: / [retracted]/resources/views/merchants.blade.php)

Has anyone encountered above error? I followed this https://codelapan.com/post/how-to-use-datatables-in-laravel-8-and-livewire

rogerlauermann commented 2 years ago

Check your PHP version, I had this issue using PHP 7.4 version, after update to PHP 8.0 worked.

yamato52 commented 2 years ago

Check your PHP version, I had this issue using PHP 7.4 version, after update to PHP 8.0 worked.

any solution if using php 7.4 ?

arlanram commented 2 years ago

looks like there is now solution, only updating whole project to 8.0

BrayanCaro commented 1 year ago

TL; DR (PHP 7.4)

Downgrading to v0.9.1 solves the problem.

composer require mediconesystems/livewire-datatables:0.9.1

Explanation

In v0.9.2 was introduced the following line

https://github.com/MedicOneSystems/livewire-datatables/blob/0b1068ce45f942d4b84f80610efbe69f03386523/src/Column.php#L118

But union types syntax has been available since PHP 8.0, although the composer.json file warranty PHP 7.4 support:

https://github.com/MedicOneSystems/livewire-datatables/blob/0b1068ce45f942d4b84f80610efbe69f03386523/composer.json#L19