facebook / facebook-php-business-sdk

PHP SDK for Meta Marketing API
https://developers.facebook.com/docs/business-sdk
Other
837 stars 519 forks source link

syntax error, unexpected '|', expecting ';' or '{' #571

Closed xriter closed 1 year ago

xriter commented 1 year ago

Since 15.0.3 getting this error:

PHP Parse error:  syntax error, unexpected '|', expecting ';' or '{' in ...vendor/facebook/php-business-sdk/src/FacebookAds/Cursor.php on line 438
natewiebe13 commented 1 year ago

It appears to me that you're on an older version of php than 8.0. It looks like the syntax is fine, but is using union types which was introduced in php 8.0. Is that the case here?

xriter commented 1 year ago

Ah, that could be it. It's running in a php 7.4 env indeed, because of other packages that are not compatible with php >= 8 yet. Would it be difficult to make it still compatible with 7.4?

natewiebe13 commented 1 year ago

I do know a bunch of work has gone into making this package compatible with php 8.0/8.1, and removing return types I'm guessing isn't likely to happen, especially with 7.4 being EOL last year.

If you do need to maintain 7.4 support, I'd suggest either forking the repo, remove the return types that are causing issues and using that, or instead of a repo apply patches using something like https://github.com/cweagans/composer-patches

xriter commented 1 year ago

Makes sense. Thank you for your efforts. 🙏