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 '?', expecting variable (T_VARIABLE) #53

Open
kanokHossain opened this issue May 25, 2022 · 13 comments
Open

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

kanokHossain opened this issue May 25, 2022 · 13 comments

Comments

@kanokHossain
Copy link

kanokHossain commented May 25, 2022

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

@richmartell
Copy link

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

@richmartell
Copy link

I think related to this commit... b6fed0c

@kanokHossain
Copy link
Author

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

@kanokHossain
Copy link
Author

@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

@AbdullahGhanem
Copy link

#54
check this

@JacopoKenzo
Copy link

Same issue here!

@stojankukrika
Copy link

the same issue here :( with last version :(

@shirish71
Copy link
Contributor

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)

This was referenced Sep 27, 2022
@emp-sean
Copy link

emp-sean commented Oct 4, 2022

This is also an issue for PHP8 in 3.1.2

@ed-hanton-swytch
Copy link

ed-hanton-swytch commented Oct 26, 2022

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?

@sunilpatidar
Copy link

sunilpatidar commented Nov 1, 2022

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

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

@patthewebrat
Copy link

patthewebrat commented Jan 12, 2023

I have experienced this issue and it looks like this is a basic syntax error.

This is not valid PHP as the ? is on the wrong side of the string declaration:

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

I'm assuming whoever wrote this is trying to indicate that $grantType is nullable. This should be represented as follows:

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

Applying this change locally has resolved the error for me and retains the nullable state of $grantType.

@jameswilddev
Copy link
Collaborator

Hello. Just noticed this myself. It looks like @shirish71 had already done a great job of fixing this, but it was never included in a release! v3.1.3 should fix this, please let us know if it does not!

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