larastan: Recursive mixins causes - allowed memory size exhausted

  • Larastan Version: 0.2.9
  • --level used: default, 5, or max

References

https://github.com/nunomaduro/larastan/issues/25

Description

Running php artisan code:analyse quits early with a fatal error exception.

PHP Fatal error:  Allowed memory size of 2147483648 bytes exhausted (tried to allocate 262144 bytes) in /vagrant/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 625
PHP Fatal error:  Allowed memory size of 2147483648 bytes exhausted (tried to allocate 262144 bytes) in /vagrant/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php on line 122

Increasing the memory limit (to 4G) does not resolve the issue.

Laravel code where the issue was found

When removing the following code, Larastan continues as expected:

$this->app->bind(MolliePaymentGateway::class, function () {
    $gateway = Omnipay::create('Mollie');

    $gateway->setApiKey(config('services.mollie.api_key'));

    return $gateway;
});

MolliePaymentGateway is a simple interface:

<?php

declare(strict_types=1);

namespace Payment\Contracts;

use Omnipay\Common\GatewayInterface;
use Omnipay\Common\Message\RequestInterface;

interface MolliePaymentGateway extends GatewayInterface, RequestInterface
{
}

I think there are some other pieces of code too, but for now I’ve pinpointed it to this section. Any way I can further debug this or do you have any idea what’s going wrong?

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

So Monday turned out Friday 😬 But Larastan now analyzes the complete project and shows all errors.

Thanks, man!

Monday first thing, thanks!

Ok. There is recursive @see annotations. We need to check the code of mixins.php in order to avoid this bug.