goaop / framework

:gem: Go! AOP PHP - modern aspect-oriented framework for the new level of software development
go.aopphp.com
MIT License
1.66k stars 163 forks source link

PHP 8 Compatibility #466

Open ganigeorgiev opened 3 years ago

ganigeorgiev commented 3 years ago

I'm not sure if this is the correct package to report the issue, but I've just upgraded to PHP 8 and got the following error:

Fatal error: Declaration of Go\ParserReflection\Traits\ReflectionClassLikeTrait::getConstants() must be compatible with ReflectionClass::getConstants(?int $filter = null) in /var/www/html/vendor/goaop/parser-reflection/src/ReflectionClass.php on line 214

Is the library supposed to work with PHP 8 or I'm pulling some older transitive dependency?

Here is part of my dependencies tree:

lisachenko commented 3 years ago

Hello! I can confirm that goaop/framework doesn't support PHP8 yet. First, the goaop/parser-reflection should be updated to support PHP8, as there are some important changes in Refection API.

Would you like to work on this? )

amuluowin commented 3 years ago

From PHP8 News The upgrading guide specifies that if you extend these classes, and still want to support both PHP 7 and PHP 8, the following signatures are allowed:

ReflectionClass::newInstance($arg = null, ...$args);
ReflectionFunction::invoke($arg = null, ...$args);
ReflectionMethod::invoke($object, $arg = null, ...$args);

When i use classMap some file for goaop/parser-reflection, it work well

ganigeorgiev commented 3 years ago

@lisachenko I'm not sure from where to start. Are you planning to deprecate goaop/parser-reflection (https://github.com/goaop/framework/issues/465#issuecomment-754576563)? I also noticed that master is quite ahead of the latest stable parser-reflection 2.1.2 release.

lisachenko commented 3 years ago

Personally, I don't want to deprecate/abandon my own goaop/parser-reflection library, but I see that I don't have enough free time to develop/maintain it. Thus, it will be honest to highlight this and abandon it by switching to BetterReflection package.

Theoretically, I can make parser-reflection working with PHP8 without new features, this can give some time to test/play with current packages and unblock migration to PHP8.

lisachenko commented 3 years ago

Linked issue: https://github.com/Roave/BetterReflection/issues/701.

So, there are no currently working static reflection libraries supporting PHP8 now, neither my, nor BR is not ready for that.

jberculo commented 2 years ago

FYI: It seems that BR portability is getting up to speed: https://github.com/Roave/BetterReflection/issues/701

lisachenko commented 2 years ago

Yes, I’m looking forward to have this PHP8 support added to BR, then need one more step - to migrate my framework to BR

ilminaev commented 2 years ago

Hi! Are there any updates to that? It seems BetterReflection has added support for PHP 8.

lisachenko commented 2 years ago

Yep, BR has now PHP8 support, looking for someone who can do integration ) I don't have enough time to do it, so can't promise it will be ready soon...

WalterWoshid commented 1 year ago

I am currently refactoring the library to support PHP 8.0. See https://github.com/WalterWoshid/goaop-framework/issues/1 for progress information

WalterWoshid commented 1 year ago

Done https://github.com/goaop/framework/pull/486