Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syntax error, unexpected '$url' (T_VARIABLE), expecting ')' #39

Closed
SarasVe opened this issue Dec 18, 2019 · 14 comments
Closed

syntax error, unexpected '$url' (T_VARIABLE), expecting ')' #39

SarasVe opened this issue Dec 18, 2019 · 14 comments

Comments

@SarasVe
Copy link

SarasVe commented Dec 18, 2019

Hello, I've got syntax error after fresh install on laravel app for woocommerce webhook handle. Here is what I get:

Symfony\Component\Debug\Exception\FatalThrowableError
syntax error, unexpected '$url' (T_VARIABLE), expecting ')'
::Composer\Autoload\includeFile:28
vendor/spatie/laravel-webhook-client/src/WebhookClientServiceProvider.php:28

And the line is:
Route::macro('webhooks', fn(string $url, string $name = 'default') => Route::post($url, '\Spatie\WebhookClient\WebhookController')->name("webhook-client-{$name}"));

@freekmurze
Copy link
Member

Make sure to have PHP 7.4 installed.

@DLO33
Copy link

DLO33 commented Feb 12, 2020

I am also encountering this error. I have php 7.4.2 installed.

PHP 7.4.2 (cli) (built: Feb 5 2020 16:50:38) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.2, Copyright (c), by Zend Technologies

image

@Globulard
Copy link

Same issue here using PHP 7.4.1. I don't get why @freekmurze closed it this fast.

@mvrska
Copy link

mvrska commented Feb 25, 2020

@DLO33 @Globulard I had this issue, too, but when I doublechecked I didn't really have PHP 7.4, check in the context tab by the stack trace, just in case you have multiple php versions

@kennblvnp
Copy link

same issue with 7.4.4.

@blessingdube
Copy link

blessingdube commented Mar 23, 2020

If anyone is using Docker, you will need to maker sure that the PHP version in your container is also set to PHP 7.4. The error syntax error you are receiving is actually coming from the container's PHP version and not your local PHP version.

If using laradock, this is pretty easy to resolve.

First edit your laradock .env file on line 42 and set the PHP_VERSION value to 7.4

Then run docker-compose build php-fpm, followed by docker-compose build workspace

Once that's done, run docker-compose down and then bring your containers up as you normally would.

I hope this helps!

@DLO33
Copy link

DLO33 commented May 9, 2020

@DLO33 @Globulard I had this issue, too, but when I doublechecked I didn't really have PHP 7.4, check in the context tab by the stack trace, just in case you have multiple php versions

@mvrska appreciate the reply, finally got around to having a look at this and you were correct. Context was showing an older version of php. Updated Ngix and everything seems to be good now :)

@LinuxSwiss
Copy link

Good evening all. Plsss I encounter de same problem but is not telling me to be expecting any ')' is just like that. Just check it out here please and help me
IMG_20210624_100707_289

@mvrska
Copy link

mvrska commented Jul 5, 2021

Good evening all. Plsss I encounter de same problem but is not telling me to be expecting any ')' is just like that. Just check it out here please and help me
IMG_20210624_100707_289

is this even laravel?

@LinuxSwiss
Copy link

Good evening all. Plsss I encounter de same problem but is not telling me to be expecting any ')' is just like that. Just check it out here please and help me
IMG_20210624_100707_289

is this even laravel?

well I don't really know I got my code from the company by name bulksmsnigeria.com.
And I integrated it using just php.

@LinuxSwiss
Copy link

And this error is showing.

@LinuxSwiss
Copy link

IMG_20210707_070548_673

@LinuxSwiss
Copy link

This is the code

@vicmi-dev
Copy link

Make sure to have PHP 7.4 installed.

the issue for me was that I had changed the php version but I had not restarted apache. Thank you for the hint!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants