--level used: default, 5, or maxhttps://github.com/nunomaduro/larastan/issues/25
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.
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!
@sebastiaanluca Thanks for reporting this issue.
Can I see the code of Omnipay::class?
That would be this one from the thephpleague/omnipay-common package.
Ok. There is recursive @see annotations. We need to check the code of mixins.php in order to avoid this bug.
@sebastiaanluca This issue got addressed on the version v0.2.11. Can you test it?
Monday first thing, thanks!
So Monday turned out Friday 馃槵 But Larastan now analyzes the complete project and shows all errors.
Thanks, man!
Hi @nunomaduro and @sebastiaanluca 馃憢 ,
This seems to still be a problem in 0.2.12 and 0.3.7.
The last errors I got:
PHP Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 20480 bytes) in /Users/tomdewit/Sites/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php on line 128
PHP Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 32768 bytes) in /Users/tomdewit/Sites/[redacted]/vendor/symfony/debug/Exception/FatalErrorException.php on line 1
Edit 1: If I remove the @see annotation in the Omnipay class it's working, as mentioned before.
You are using 0.3.7?
Hi @nunomaduro,
I do!
composer show | grep larastan
nunomaduro/larastan v0.3.7 Larastan - Discover bugs in your code without running it. A phpstan/phpstan wrapper for Laravel
@ttomdewit Can you try to debug it? Please check the Mixins method pipe.
@nunomaduro Yes, I鈥檒l get back to you tomorrow morning. Thank you!
So when I add a var_dump($mixins) on line 96 of the Mixins class located at nunomaduro/larastan/src/Methods/Pipes/Mixins.php it looks like it's running into a loop. I had to kill my terminal to make it stop, so I don't have a copy of it's output (writing it to a file didn't work either).
It shows the Omnipay\Omnipay class at index 0 and the Omnipay\Common\GatewayFactory at index 1.
I'll try a bit more later this morning.
Try Symfonys dd which is available in Laravel.
dd() and exit-ing does not work, since it'll stop executing LaraStan and continue with the next step in my so-called build pipeline.
I am sorry, but I am unable to tell you more than what I've previously told you roughly three weeks ago.
All I can say for certain is that if I remove the @see annotation in the Omnipay class it's working.
Edit 1: I've upgraded to 0.3.8 via composer upgrade nunomaduro/larastan.
@ttomdewit Fell free to re-open the issue if the problem still exist.