xero-laravel icon indicating copy to clipboard operation
xero-laravel copied to clipboard

syntax error, unexpected '?', expecting variable (T_VARIABLE)

Open kanokHossain opened this issue 2 years ago • 13 comments

while I am want to call the function below, getting the error syntax error, unexpected '?', expecting variable (T_VARIABLE), using PHP version PHP 7.4.27 public function redirectUserToXero() { return $this->getOAuth2()->getAuthorizationRedirect(); } error

kanokHossain avatar May 25 '22 04:05 kanokHossain

I am also seeing this on a codebase which has been using this library for a while. Just introduced.

richmartell avatar May 25 '22 11:05 richmartell

I think related to this commit... https://github.com/langleyfoxall/xero-laravel/commit/b6fed0cf0deeca5cc48a196152f0e97af9349961

richmartell avatar May 25 '22 11:05 richmartell

Thanks, @richmartell for your response, please let me know if you get any solution on this in future

kanokHossain avatar May 25 '22 17:05 kanokHossain

@richmartell you are right its came with this line,

public function refreshAccessToken(AccessTokenInterface $accessToken, string? $grantType = null)

new released has been deployed 8 days ago, since the error came., new1

i remove latest version and using "langleyfoxall/xero-laravel": "v3.1.1", its working fine till now, i am still doing other setup, lets see how its goes

kanokHossain avatar May 26 '22 03:05 kanokHossain

https://github.com/langleyfoxall/xero-laravel/pull/54 check this

AbdullahGhanem avatar Jun 08 '22 09:06 AbdullahGhanem

Same issue here!

JacopoKenzo avatar Jul 11 '22 12:07 JacopoKenzo

the same issue here :( with last version :(

stojankukrika avatar Jul 12 '22 10:07 stojankukrika

For php 7.4 remove "string?" from line 133 on OAuth2.php in refreshAccessToken() method, that should fix this error.

image

Go to src>OAuth2.php and remove "string?" from refreshAccessToken() Previous: public function refreshAccessToken(AccessTokenInterface $accessToken, string? $grantType = null) Now: public function refreshAccessToken(AccessTokenInterface $accessToken, $grantType = null)

shirish71 avatar Sep 27 '22 08:09 shirish71

This is also an issue for PHP8 in 3.1.2

emp-sean avatar Oct 04 '22 21:10 emp-sean

Also getting this, that fix (#58) seems to have solved it, and has been merged into master. Can a new release be created to deploy this fix?

ed-hanton-swytch avatar Oct 26 '22 12:10 ed-hanton-swytch

go to : vendor\langleyfoxall\xero-laravel\src\OAuth2.php

     public function refreshAccessToken(AccessTokenInterface $accessToken, string ? $grantType = null)  
     ->remove "?" from above line

sunilpatidar avatar Nov 01 '22 17:11 sunilpatidar