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 on enum #8877

Closed
greg0ire opened this issue Dec 10, 2022 · 8 comments
Closed

Syntax error on enum #8877

greg0ire opened this issue Dec 10, 2022 · 8 comments

Comments

@greg0ire
Copy link
Contributor

Weird issue that I cannot reproduce on https://psalm.dev/r/b10ef1cbd6 : https://github.com/doctrine/lexer/actions/runs/3664018448/jobs/6194159893#step:6:54

ParseError: Syntax error, unexpected T_STRING on line 7

Why is Psalm having an issue with enums? I'm using version 5.1.0

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/b10ef1cbd6
<?php

declare(strict_types=1);

namespace Doctrine\Tests\Common\Lexer;

enum TokenType
{
    case INT;
    case OPERATOR;
    case STRING;
}
Psalm output (using commit ef02ded):

No issues!

@danog
Copy link
Collaborator

danog commented Dec 10, 2022

Make sure nikic/php-parser was also updated to the latest version

@greg0ire
Copy link
Contributor Author

greg0ire commented Dec 10, 2022

$ composer outdated
Info from https://repo.packagist.org: #StandWithUkraine
Color legend:
- patch or minor release available - update recommended
- major release available - update possible

Direct dependencies required in composer.json:
Everything up to date

Transitive dependencies not required in composer.json:
phpstan/phpdoc-parser 1.13.1 1.15.0 PHPDoc parser with support for nullable, intersection and generic types

Almost everything seems up to date. I'm still using PHP 8.1 though.

@greg0ire
Copy link
Contributor Author

greg0ire commented Dec 10, 2022

Target PHP version: 7.1 (inferred from composer.json)

Maybe this is the cause?

EDIT: changing that indeed makes the issue disappear 🤔

@greg0ire
Copy link
Contributor Author

greg0ire commented Dec 10, 2022

Closing, I think that's expected, I should be using phpVersion=8.1 (right? if yes, sorry for the disturbance and in any case, thanks for the help)

@weirdan
Copy link
Collaborator

weirdan commented Dec 10, 2022

And to reproduce it on psalm.dev you could add ?php=7.1 to the URL: https://psalm.dev/r/b10ef1cbd6?php=7.1

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/b10ef1cbd6
<?php

declare(strict_types=1);

namespace Doctrine\Tests\Common\Lexer;

enum TokenType
{
    case INT;
    case OPERATOR;
    case STRING;
}
Psalm output (using commit ef02ded):

ERROR: ParseError - 7:6 - Syntax error, unexpected T_STRING on line 7

@greg0ire
Copy link
Contributor Author

Good to know! Thanks!

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

3 participants