antlr / antlr-php-runtime

PHP Runtime for ANTLR4
BSD 3-Clause "New" or "Revised" License
84 stars 20 forks source link

PHP 8.0.0 support #11

Closed nikcani closed 3 years ago

nikcani commented 4 years ago

antlr/antlr4-php-runtime 0.4 requires php ^7.2 -> your php version (8.0.0) does not satisfy that requirement

Is PHP 8 support planned?

marcospassos commented 3 years ago

I don't have time right now to upgrade the library, but PRs are always welcome.

mtouellette commented 3 years ago

So I haven't gone too deeply into it but this seems to work fine under PHP 8 (built a parse tree running 8.0.3, no errors or warnings). Perhaps the composer.json could be updated to require "php": ">=7.2"? That is until PHP 8 specific language features are added. @nikcani adding --ignore-platform-reqs seems to do the trick for now.

marcospassos commented 3 years ago

@mtouellette, if you can look more in-depth to ensure nothing breaks in PHP 8, feel free to open a PR relaxing the version constraint in the composer file.

nikcani commented 3 years ago

adding --ignore-platform-reqs seems to do the trick for now.

That is what I was using too 👍

rasteiner commented 3 years ago

I tried it too with php 8.0 with no errors or strange behaviors. Also, https://github.com/PHPCompatibility/PHPCompatibility does not produce any errors or warnings for versions 7.4-8.1

:~/work/antlr-php-runtime$ ./vendor/bin/phpcs -p src --standard=PHPCompatibility --runtime-set testVersion 7.4-8.1
............................................................  60 / 130 (46%)
............................................................ 120 / 130 (92%)
..........                                                   130 / 130 (100%)

Time: 4.17 secs; Memory: 22MB
marcospassos commented 3 years ago

Thank you for checking. Could you please open a PR making the composer file to compatible with both PHP 7 and 8?

rasteiner commented 3 years ago

here it is: https://github.com/antlr/antlr-php-runtime/pull/14

some dependencies in "require-dev" don't support PHP 8 (and also actually produce errors), but those aren't needed to use the runtime... So it's enough to install this package with a --no-dev flag for composer; like:

composer require antlr/antlr-php-runtime --no-dev
nikcani commented 2 years ago

The about text here at github is "PHP 7 Runtime for ANTLR4". I would suggest to update this to "PHP 7/8 Runtime for ANTLR4".

marcospassos commented 2 years ago

Done! Thank you!