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 T_MATCH #3946

Closed
b1rdex opened this issue Oct 13, 2020 · 3 comments
Closed

Syntax error, unexpected T_MATCH #3946

b1rdex opened this issue Oct 13, 2020 · 3 comments

Comments

@b1rdex
Copy link
Contributor

b1rdex commented Oct 13, 2020

I tried to run using phpVersion: 80000 and got these errors reported on some files:

------ ----------------------------------------------------------------- 
  Line   protected/tests/unit/OrdersTest.php                              
 ------ ----------------------------------------------------------------- 
  15     Syntax error, unexpected T_MATCH, expecting T_STRING on line 15  
  25     Syntax error, unexpected ';', expecting '{' on line 25           
 ------ ----------------------------------------------------------------- 
 ------ ----------------------------------------------------------------- 
  Line   protected/tests/unit/PickupTest.php                              
 ------ ----------------------------------------------------------------- 
  15     Syntax error, unexpected T_MATCH, expecting T_STRING on line 15  
  25     Syntax error, unexpected ';', expecting '{' on line 25           
 ------ ----------------------------------------------------------------- 
 ------ ----------------------------------------------------------------- 
  Line   protected/tests/unit/PurchasesTest.php                           
 ------ ----------------------------------------------------------------- 
  15     Syntax error, unexpected T_MATCH, expecting T_STRING on line 15  
  25     Syntax error, unexpected ';', expecting '{' on line 25           
 ------ ----------------------------------------------------------------- 

As you can see all of them are tests. But there is no match on line 15 in any of these files:
image

I tried to remove some lines from test files and came to the conclusion that the errors aren't related to those files at all. The errors are still reported at the same lines even if there are no class contents on them at all

Running w/ the --debug switch doesn't help at all, no further trace is provided. How do I debug this?

@b1rdex
Copy link
Contributor Author

b1rdex commented Oct 13, 2020

OK I found it. It's \PHPUnit\Framework\MockObject\Builder\Match interface in PHPUnit@8.5.8.

I understand that the error isn't related to PHPStan but I'd suggest fixing the error message. It'd be easier to fix the issue if the error provided had the right file path 😄

@ondrejmirtes
Copy link
Member

You need to upgrade to PHPUnit 9.3.

Duplicate of #3943

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants