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

Cannot declare class because the name is already in use #468

Closed jhones-prv closed 3 years ago

jhones-prv commented 3 years ago

Hi,

When I execute a call, I get the following error:

Cannot declare class App \ Exceptions \ Handler, because the name is already in use

When I opened the cache file generated in, it included the following code in the body of the method:

public function render ($request, Throwable $exception)
     {
         $parentRender = parent::render ($request, $exception);

         if ($parentRender instanceof JsonResponse) {
             return $parentRender;
         }

//This is the generated code that causes the problem
include_once AOP_CACHE_DIR. '/_proxies/Exceptions/Handler.php/App/Exceptions/Handler.php';

         return new JsonResponse ([
             'message' => $exception->getMessage ()
         ], $parentRender->getStatusCode ());
     }

Is there any solution to this problem?

I'm using PHP 7.4

Thanks

lisachenko commented 3 years ago

Hello, strange... This seems related to the #451 which was fixed previously... can you try to require latest version of goaop framework from the master branch. Assuming that you are running 7.4 this should be ok...

jhones-prv commented 3 years ago

Yes that's right.

In my composer.json the goaop framework project has the version "goaop/framework": "^ 2.3", but it still doesn't work. I may be doing something wrong, but I followed the documentation tutorial carefully.

lisachenko commented 3 years ago

Could you please try 3.0.0-dev version of framework please?

jhones-prv commented 3 years ago

I tried to put version 3.0.0-dev, but it doesn't exist, so I put the dev-master, and it worked !!! : D

Thanks for your help!

lisachenko commented 3 years ago

Resolved in 3.0.0