livewire-datatables icon indicating copy to clipboard operation
livewire-datatables copied to clipboard

ParseError syntax error, unexpected '|', expecting variable

Open jayomayan opened this issue 3 years ago • 4 comments

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

jayomayan avatar Apr 29 '22 22:04 jayomayan

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

rogerlauermann avatar Apr 30 '22 19:04 rogerlauermann

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 ?

yamato52 avatar May 14 '22 09:05 yamato52

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

arlanram avatar Aug 10 '22 07:08 arlanram

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

BrayanCaro avatar Nov 22 '22 23:11 BrayanCaro