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

'\self' is an invalid class name #415

Closed
tpapic opened this issue Apr 2, 2019 · 3 comments
Closed

'\self' is an invalid class name #415

tpapic opened this issue Apr 2, 2019 · 3 comments

Comments

@tpapic
Copy link

tpapic commented Apr 2, 2019

I installed goaop-laravel-bridge on my laravel app.

And I put this issue on that repo but they redirect me to you. goaop/goaop-laravel-bridge#15

'\self' is an invalid class name {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 64): '\\self' is an invalid class name at npp/project/api/storage/app/aspect/_proxies/app/User.php/App/User.php:1055)
Method which has this error

/**
     * Create a new pivot model instance.
     *
     * @param  \Illuminate\Database\Eloquent\Model  $parent
     * @param  array  $attributes
     * @param  string  $table
     * @param  bool  $exists
     * @param  string|null  $using
     * @return \Illuminate\Database\Eloquent\Relations\Pivot
     */
    public function newPivot(\self $parent, array $attributes, $table, $exists, $using = NULL)
    {
        return self::$__joinPoints['method:newPivot']->__invoke($this, \array_slice([$parent, $attributes, $table, $exists, $using], 0, \func_num_args()));
    }

PHP-version: 7.1.23
Laravel version: 5.5

@lisachenko
Copy link
Member

Hi, @tpapic! Sorry for the late reply.

This issue with self should be fixed in #397. You should update to >=2.3.0 to have a fix for that.

@lisachenko
Copy link
Member

Instead of self you should see full class name in generated proxies.

@SerafimArts
Copy link
Member

SerafimArts commented May 23, 2019

Version 2.3.x does not fix the problem. Using goap with Laravel is currently not possible.

image

Reproduction

  • composer create-project laravel/laravel
  • cd laravel
  • composer require goaop/goaop-laravel-bridge
  • php artisan vendor:publish --provider="Go\Laravel\GoAopBridge\GoAopServiceProvider"
  • php artisan serve --host=0.0.0.0 --port=8000
  • Open 127.0.0.1:8000 in browser

During the request, the server writes an errors:

  1. NOTICE: PHP message: PHP Fatal error: '\self' is an invalid class name in xxx on line 924
  2. NOTICE: PHP message: PHP Fatal error: Uncaught ReflectionException: Class App\Exceptions\Handler does not exist in /var/www/dsp.localhost/vendor/laravel/framework/src/Illuminate/Container/Container.php:790

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

No branches or pull requests

3 participants