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

Avoid php8 only syntax when possible #4636

Closed
wants to merge 1 commit into from

Conversation

lazka
Copy link

@lazka lazka commented Jan 17, 2022

Q A
Branch? 2.6
Tickets #4614
License MIT

This resulted in phpstan to fail if the active PHP version is <8.0:
Internal error: syntax error, unexpected 'static' (T_STATIC)

In case a project depending on api-platform/core would use ClientTrait directly,
or indirectly, phpstan would try to parse it and fail with the above syntax error.

Move the type declarations into a comment instead.

This resulted in phpstan to fail if the active PHP version is <8.0:
Internal error: syntax error, unexpected 'static' (T_STATIC)

In case a project depending on api-platform/core would use ClientTrait directly,
or indirectly, phpstan would try to parse it and fail with the above syntax error.

Move the type declarations into a comment instead.

Fixes api-platform#4614
@norkunas
Copy link
Contributor

But then it's phpstan fault that it cannot understand the code :) I'd suggest for you then to make phpstan happy, override the createClient method and adapt not to use that trait

@lazka
Copy link
Author

lazka commented Jan 17, 2022

ok, I'll file a bug with phpstan then

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

Successfully merging this pull request may close these issues.

None yet

2 participants