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

Compatibility issue with PHP 7.4 due to return type hinting in FormActionsType #1285

Open
N26N26 opened this issue Jun 19, 2024 · 0 comments

Comments

@N26N26
Copy link

N26N26 commented Jun 19, 2024

Hi,

I encountered a syntax error while updating mopa/bootstrap-bundle from version 3.4.2 to 3.5.0 with PHP 7.4. The error is due to the use of union return type hinting in the FormActionsType class, which is not supported in PHP 7.4. According to the packagist documentation, this bundle should be compatible with PHP 7.4, so this appears to be either a documentation error or a code error.

### Error message:

ParseError: syntax error, unexpected '|', expecting ';' or '{'

### File and line number:

./vendor/mopa/bootstrap-bundle/Form/Type/FormActionsType.php:49

### Problematic code:

protected function createButton($builder, $name, $config): ButtonBuilder|FormBuilderInterface

For the moment, I have temporarily fixed the issue by requiring version 3.4.2 of mopa/bootstrap-bundle. However, I wanted to bring this to your attention as it is likely an issue that needs to be addressed.

### Suggested solution:

To resolve this issue, the documentation should either be updated to reflect that PHP 7.4 is not supported, or the code should be modified to be compatible with PHP 7.4. Here is one potential code modification:

Omit the return type hinting:

protected function createButton($builder, $name, $config)

@N26N26 N26N26 changed the title Compatibility issue with PHP 7.x due to return type hinting in FormActionsType Compatibility issue with PHP 7.4 due to return type hinting in FormActionsType Jun 19, 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

1 participant