-
-
Notifications
You must be signed in to change notification settings - Fork 671
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
Memory leak with Laravel IDE helper loaded #3836
Comments
Is there a way I could explicitly disable checking |
It might be something in
Not sure what does it mean, I never used Laravel. Could you share reproducible minimal code so we can see error ourselves? |
Not sure what IDE helper is, but if it makes mess, you can exclude it. |
The problem is that rector, or some part of rector, is analyzing content DOCblock, finding |
Hm, black magic strikes again. What do you suggest to keep PHPStan/Rector working on other projects but not get stuck on your code? |
I am digging deeper to narrow it down to the smallest possible example I can make. |
So here are things that worked out: _ide_helper.php is now narrowed down to
Model.php looks like this at the top:
I thought it's some sort of infinite loop because class that Model is using @mixin and that Mixin is extending Model. But that's not the case if I try it in isolated environment. Then I went to try to narrow down the part of code of rector causing this. PHPStanNodeScopeResolver.php - I added these echoes
and also var_dumped the nodes:
This is what I get if I have Eloquent mixin in Model:
If i remove that mixin in Model class, I get
Unfortunately I wasn't narrow it down futher because it looks like It's hanging in NodeScopeResolver.php which is in phar, which I found even you had problem with finding solution to :-) |
Maybe @ondrejmirtes could help a bit here, please? It would be plenty enough to just have an ability to skip the @mixin from analyzing I think |
PHPStan has an undocumented feature that you can tell it to ignore some |
Just found about that haha. Thanks! |
I don't know how rector works. If you have a possiblity to have your own PHPStan config, just add parameters:
mixinExcludeClasses:
- Eloquent |
Closing as resolved with #3836 (comment) |
rectorphp/rector-src@499fdbc Drop AttributeKey::SCOPE in various classes (#3836)
Bug Report
So I am using Laravel IDE helper to have better suggestions in IDE. There's a _ide_loader.php file which has some classes which I then include as
@mixin
in PHPDoc of Models.When I try to run rector on such code
It bloats the memory over 4G and causes a segmentation fault because lack of memory available.
The underlying property price doesn't exist, it's only as a
@property float $price
and is available via Laravel's Model magic. The problem is that BaseModel, which I am extending in Cart class, is defined on two places: that generated ide helper & actual BaseModel class. If I load the ide helper file, it goes into fire.When I don't autoload that file (which I should not ever load, it's only for ide's knowledge), it screams about the @mixin Eloquent I have in some of my models:
The text was updated successfully, but these errors were encountered: