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

[Step 1] Bump requirement to PHP 8.2 and parser-reflection 4.0.0-RC1 #492

Merged
merged 40 commits into from
Mar 31, 2024

Conversation

samsonasik
Copy link
Contributor

@samsonasik samsonasik commented Feb 4, 2024

@lisachenko here the step 1 PR to upgrade to php 8.2 and upgrade parser-reflection to 4.0.0-RC1

@samsonasik samsonasik changed the title Bump requirement to PHP 8.2 and parser-reflection 4.0.0-RC1 [Step 1] Bump requirement to PHP 8.2 and parser-reflection 4.0.0-RC1 Feb 6, 2024
@samsonasik
Copy link
Contributor Author

@lisachenko there are 2 errors and 5 failures test left, It seems somehow cache not put into file, could you take a look on it? Thank you.

There were 2 errors:

1) Go\Functional\ClassWeavingTest::testPropertyWeaving
TypeError: preg_replace(): Argument #3 ($subject) must be of type array|string, bool given

/home/runner/work/framework/framework/tests/Go/PhpUnit/ProxyClassReflectionHelper.php:50
/home/runner/work/framework/framework/tests/Go/PhpUnit/ClassMemberWovenConstraint.php:38
/home/runner/work/framework/framework/tests/Go/Functional/BaseFunctionalTest.php:322
/home/runner/work/framework/framework/tests/Go/Functional/ClassWeavingTest.php:25

2) Go\Functional\ClassWeavingTest::testClassInitializationWeaving
TypeError: preg_replace(): Argument #3 ($subject) must be of type array|string, bool given

/home/runner/work/framework/framework/tests/Go/PhpUnit/ProxyClassReflectionHelper.php:50
/home/runner/work/framework/framework/tests/Go/PhpUnit/ClassMemberWovenConstraint.php:38
/home/runner/work/framework/framework/tests/Go/Functional/BaseFunctionalTest.php:375
/home/runner/work/framework/framework/tests/Go/Functional/ClassWeavingTest.php:51

--

There were 5 failures:

1) Go\Console\Command\CacheWarmupCommandTest::testItWarmsUpCache
Failed asserting that 'Go\Tests\TestProject\Application\Main' is woven class..

/home/runner/work/framework/framework/tests/Go/Functional/BaseFunctionalTest.php:170
/home/runner/work/framework/framework/tests/Go/Console/Command/CacheWarmupCommandTest.php:30

2) Go\Console\Command\DebugWeavingCommandTest::testReportInconsistentWeaving
Failed asserting that ' Weaving debug information =========================  ' matches PCRE pattern "/.+InconsistentlyWeavedClass.php.+generated.+on.+second.+"warmup".+pass.+/".

/home/runner/work/framework/framework/tests/Go/Console/Command/DebugWeavingCommandTest.php:23

3) Go\Functional\ClassWeavingTest::testItDoesNotWeaveAbstractMethods
Failed asserting that 'Go\Tests\TestProject\Application\Main' is woven class..

/home/runner/work/framework/framework/tests/Go/Functional/BaseFunctionalTest.php:170
/home/runner/work/framework/framework/tests/Go/Functional/ClassWeavingTest.php:38

4) Go\Functional\ClassWeavingTest::testItWeavesFinalClasses
Failed asserting that 'Go\Tests\TestProject\Application\FinalClass' is woven class..

/home/runner/work/framework/framework/tests/Go/Functional/BaseFunctionalTest.php:170
/home/runner/work/framework/framework/tests/Go/Functional/ClassWeavingTest.php:58

5) Go\Functional\Issue293Test::testItDoesNotWeaveDynamicMethodsForComplexStaticPointcut
Failed asserting that 'Go\Tests\TestProject\Application\Issue293StaticMembers' is woven class..

/home/runner/work/framework/framework/tests/Go/Functional/BaseFunctionalTest.php:170
/home/runner/work/framework/framework/tests/Go/Functional/Issue293Test.php:25

@samsonasik
Copy link
Contributor Author

samsonasik commented Feb 10, 2024

@lisachenko I debugged cache warmer, and it seems got deprecated notices:

✗ php tests/Fixtures/project/bin/console --no-ansi cache:warmup:aop tests/Fixtures/project/web/../web/index.php
PHP Deprecated:  Creation of dynamic property Go\Core\CachedAspectLoader::$loader is deprecated in /Users/samsonasik/www/framework-3/src/Core/CachedAspectLoader.php on line 89
...
PHP Deprecated:  Return type of Dissect\Lexer\TokenStream\ArrayTokenStream::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/samsonasik/www/framework-3/vendor/jakubledl/dissect/src/Dissect/Lexer/TokenStream/ArrayTokenStream.php on line 114
PHP Deprecated:  Return type of Dissect\Lexer\TokenStream\ArrayTokenStream::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/samsonasik/www/framework-3/vendor/jakubledl/dissect/src/Dissect/Lexer/TokenStream/ArrayTokenStream.php on line 122
PHP Deprecated:  Go\Aop\Framework\BeforeInterceptor implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /Users/samsonasik/www/framework-3/src/Aop/Framework/BeforeInterceptor.php on line 23
...
PHP Deprecated:  Go\Aop\Framework\AfterInterceptor implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /Users/samsonasik/www/framework-3/src/Aop/Framework/AfterInterceptor.php on line 23
...
Total 18 files to process.

[ERR]: /Users/samsonasik/www/framework-3/tests/Fixtures/project/src/Annotation/Loggable.php
[ERR]: /Users/samsonasik/www/framework-3/tests/Fixtures/project/src/Aspect/InconsistentlyWeavingAspect.php
[OK]: /Users/samsonasik/www/framework-3/tests/Fixtures/project/src/Aspect/WeavingAspect.php
[OK]: /Users/samsonasik/www/framework-3/tests/Fixtures/project/src/Aspect/LoggingAspect.php
[OK]: /Users/samsonasik/www/framework-3/tests/Fixtures/project/src/Aspect/DoSomethingAspect.php
[OK]: /Users/samsonasik/www/framework-3/tests/Fixtures/project/src/Aspect/PropertyInterceptAspect.php
[OK]: /Users/samsonasik/www/framework-3/tests/Fixtures/project/src/Aspect/InitializationAspect.php
[OK]: /Users/samsonasik/www/framework-3/tests/Fixtures/project/src/Aspect/Issue293Aspect.php
[ERR]: /Users/samsonasik/www/framework-3/tests/Fixtures/project/src/Application/Issue293DynamicMembers.php
[ERR]: /Users/samsonasik/www/framework-3/tests/Fixtures/project/src/Application/Main.php
[ERR]: /Users/samsonasik/www/framework-3/tests/Fixtures/project/src/Application/FinalClass.php
[ERR]: /Users/samsonasik/www/framework-3/tests/Fixtures/project/src/Application/AbstractBar.php
[ERR]: /Users/samsonasik/www/framework-3/tests/Fixtures/project/src/Application/InconsistentlyWeavedClass.php
[ERR]: /Users/samsonasik/www/framework-3/tests/Fixtures/project/src/Application/FooInterface.php
[ERR]: /Users/samsonasik/www/framework-3/tests/Fixtures/project/src/Application/ParentWithFinalMethod.php
[ERR]: /Users/samsonasik/www/framework-3/tests/Fixtures/project/src/Application/Issue293StaticMembers.php
[ERR]: /Users/samsonasik/www/framework-3/tests/Fixtures/project/src/Kernel/DefaultAspectKernel.php
[ERR]: /Users/samsonasik/www/framework-3/tests/Fixtures/project/src/Kernel/InconsistentlyWeavingAspectKernel.php

[DONE]: Total processed 18, 12 errors.

@lisachenko
Copy link
Member

just let me know what step by step to run the demo

It is very easy, just follow https://github.com/goaop/framework?tab=readme-ov-file#step-0-optional-try-demo-examples-in-the-framework (but you can also just simply run the built-in PHP web server on 8080 port and point it to the demos/ folder and then open localhost:8080 in your browser (or even put breakpoints in demos/ folder, etc)

@lisachenko
Copy link
Member

goaop/dissect part is ready - package is published, CI tool configured, cleaned a little bit with rector. Marked as major release 3.0.0 because we are bumping PHP requirement >=8.2

@lisachenko
Copy link
Member

With my current available time goaop/parser-reflection cleaning/polishing will take some time too, please be patient ) Our final victory is near, I feel this

@samsonasik
Copy link
Contributor Author

@lisachenko it is mergeable?

@lisachenko
Copy link
Member

@lisachenko it is mergeable?

Not yet, need to clean a little bit first the goaop/parser-reflection and release stable version to replace "goaop/parser-reflection": "4.x-dev" with something more stable, dev dependencies shouldn't be merged into the master branch

@lisachenko
Copy link
Member

@samsonasik FYI: During clean-up yesterday, I've identified serious logic break inside the NodeExpressionResolver class in dependant parser-reflection component. When I'm trying to get real value for constant fetches, it started to return string names instead of values due to the changes inside resolveExprConstFetch (I guess, you were trying to make __toString works, but for this you should try to use getConstantName).

I'm trying to fix issues with value resolver now.

@uzmasterdev
Copy link

@samsonasik @lisachenko very happy for there is something happening, I really enjoy with aspect-mock and glad to use it with newest php versions but see that is depends on this package. Thank you for your work, guys!

@lisachenko
Copy link
Member

@samsonasik Here we go, this is starting point now, all main dependencies are looking good now to create something good on top of this.

Tests partially broken now, but at least all internal part now works as expected. I might join this PR later, but can't promise if it will be quick enough, because goaop/parser-reflection has also requested significant work from me to make it usable for modern PHP8.3 codebase with all Union/Intersection/DNF types.

PHP8.0 has support for native Reflection Attributes, thus usage of annotations were removed completely
PHP8.0 Uses native attributes instead of emulated annotations.
Go! AOP Adopts this approach too and switches to the usage of attributes.
Replace all Go\Lang\Annotation annotations with relevant Go\Lang\Attribute attributes.
@scrutinizer-notifier
Copy link

A new inspection was created.

@lisachenko lisachenko merged commit 91dbacb into goaop:master Mar 31, 2024
3 checks passed
@lisachenko
Copy link
Member

Merged, with support for attributes instead of annotations

@samsonasik samsonasik deleted the patch-1 branch March 31, 2024 18:30
@samsonasik
Copy link
Contributor Author

Thank you @lisachenko for taking care of it 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

5 participants