Closed WalterWoshid closed 10 months ago
There are still some things to do after this:
jakubledl/dissect
with walterwoshid/dissect
which is a fork that supports PHP 8__unserialize
and __serialize
to remove deprecation warning in console for PHP 8.1ReflectionClassLikeTrait::newInstance
needs different types for PHP 8.0 and PHP 8.1 - how would one implement that?Helo, @WalterWoshid! Really nice work towards PHP8 support, check my small comments inside PR.
I would also like to hear your thoughts about a new and easier syntax style proposal:
<?php
use Go\Aop\Intercept\MethodInvocation;
use Go\Lang\Attribute\Aspect;
use Go\Lang\Attribute\Before;
#[Aspect]
class AspectExample /* or keep the old */ implements Aspect /* instead of the #[Aspect] */
{
#[Before(
public: true,
class: TargetClass::class, // or "Namespace/Target*"
method: "render", // or "get*"
)]
public function beforeMethodExecution(...)
{
// ...
}
}
It would use the new named arguments syntax for PHP 8 which adds better typings and you could skip the whole execution(...)
parsing, which would be faster I guess. It requires a lot of refactoring though
I would also like to hear your thoughts about a new and easier syntax style proposal:
<?php use Go\Aop\Intercept\MethodInvocation; use Go\Lang\Attribute\Aspect; use Go\Lang\Attribute\Before; #[Aspect] class AspectExample /* or keep the old */ implements Aspect /* instead of the #[Aspect] */ { #[Before( public: true, class: TargetClass::class, // or "Namespace/Target*" method: "render", // or "get*" )] public function beforeMethodExecution(...) { // ... } }
It would use the new named arguments syntax for PHP 8 which adds better typings and you could skip the whole
execution(...)
parsing, which would be faster I guess. It requires a lot of refactoring though
It looks good for me, assuming native attributes support - this looks logical š
@lisachenko I read that you don't have much time to manage this framework. If you'd like, you could give me concrete tasks to do and so I could do them for you )
Oh, that's sounds sweet for me ) So, basically, you have almost done full the job already, let's collect and put all tasks one by one. Writing tasks in your main PR body now...
A new inspection was created.
hey, any news for PHP 8 support ?
Hi @AmraniCh, check out Okapi/AOP
which is my own implementation of AOP for PHP :)
@WalterWoshid I already did, I think I do not have other options because our web application is running on PHP 8, however I would like to thank you for your effort in this package š If I see something needs to improve or fix I will open a PR!
Hi @AmraniCh, check out
Okapi/AOP
which is my own implementation of AOP for PHP :)
@WalterWoshid You saved my life! I starred your repo like number 1 š
I have added PHP 8 Support by replacing the
@Annotation
with the new#[Attribute]
syntaxI have refactored
goaop/parser-reflection
to also support PHP 8. I might have refactored too much of it, but all the tests are running :)The tests from the framework must be edited, but most of them work as well. I also ran some custom tests on the Laravel framework and it seemed to work
Tasks:
jakubledl/dissect
and register it in the composer - current version is a little bit outdated, but still works.goaop/parser-reflection
support for PHP8. Mostly for existing functional, need to add support for parsing attributes from the AST data and try not to call original reflection instances to avoid autoloading. Support for PHP8 enums is missing, but I guess this can be added later separately. This new version should be published as a new major with bump of minimum PHP version to >=8.0goaop/framework
to include new version ofgoaop/parser-reflection
,dissect
libraries. Also, bump PHP minimum version to use PHP>=8.0.