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

getPhpVersion() method has different return type in V5 #975

Closed
phpfui opened this issue Jan 11, 2024 · 2 comments
Closed

getPhpVersion() method has different return type in V5 #975

phpfui opened this issue Jan 11, 2024 · 2 comments

Comments

@phpfui
Copy link

phpfui commented Jan 11, 2024

getPhpVersion() returns PhpVersion in some places and string in others. This causes issues in PHP 8.3 (have not tested in other versions). I would be happy to submit a PR if given guidance on the best solution. Off the top of my head, I would convert everything to return PhpVersion and add toString to PhpVersion.

Fatal error: Declaration of PhpParser\Lexer\TokenEmulator\CoaleseEqualTokenEmulator::getPhpVersion(): string must be compatible with PhpParser\Lexer\TokenEmulator\TokenEmulator::getPhpVersion(): PhpParser\PhpVersion in C:\websites\PHPFUIWebsite\PhpParser\Lexer\TokenEmulator\CoaleseEqualTokenEmulator.php on line 9

PhpParser\Lexer\TokenEmulator\AttributeEmulator.php 9 12:    public function getPhpVersion(): PhpVersion {
PhpParser\Lexer\TokenEmulator\CoaleseEqualTokenEmulator.php 9 12:    public function getPhpVersion(): string
PhpParser\Lexer\TokenEmulator\EnumTokenEmulator.php 8 12:    public function getPhpVersion(): PhpVersion {
PhpParser\Lexer\TokenEmulator\ExplicitOctalEmulator.php 9 12:    public function getPhpVersion(): PhpVersion {
PhpParser\Lexer\TokenEmulator\FlexibleDocStringEmulator.php 15 12:    public function getPhpVersion(): string
PhpParser\Lexer\TokenEmulator\FnTokenEmulator.php 9 12:    public function getPhpVersion(): string
PhpParser\Lexer\TokenEmulator\MatchTokenEmulator.php 8 12:    public function getPhpVersion(): PhpVersion {
PhpParser\Lexer\TokenEmulator\NullsafeTokenEmulator.php 9 12:    public function getPhpVersion(): PhpVersion {
PhpParser\Lexer\TokenEmulator\NumericLiteralSeparatorEmulator.php 17 12:    public function getPhpVersion(): string
PhpParser\Lexer\TokenEmulator\ReadonlyFunctionTokenEmulator.php 23 12:    public function getPhpVersion(): PhpVersion {
PhpParser\Lexer\TokenEmulator\ReadonlyTokenEmulator.php 8 12:    public function getPhpVersion(): PhpVersion {
PhpParser\Lexer\TokenEmulator\ReverseEmulator.php 18 12:    public function getPhpVersion(): PhpVersion {
PhpParser\Lexer\TokenEmulator\TokenEmulator.php 10 21:    abstract public function getPhpVersion(): PhpVersion;
@xabbuh
Copy link

xabbuh commented Jan 11, 2024

This looks like you have two versions of this package installed (CoaleseEqualTokenEmulator is part of version 4, but not of version 5). Are you using the Symfony PHPUnit bridge? In this case the error could be related to symfony/symfony#53459.

@phpfui
Copy link
Author

phpfui commented Jan 11, 2024

Yes, that was the problem. Found this error on a site that automatically updates, but did not purge the old source with the version change. Will close.

Thanks for the super fast response!

@phpfui phpfui closed this as completed Jan 11, 2024
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

2 participants