-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
Internal error: Internal error: Method newEloquentBuilder() was not found in reflection of class Staudenmeir\LaravelAdjacencyList\Eloquent\Relations\Descendants. #233
Comments
Hi @marco76tv, What version of |
yes running with phpstan larastan/larastan v2.9.2 Larastan |
What version of |
staudenmeir/laravel-adjacency-list v1.21 |
What does your PHPStan/Larastan configuration look like? |
includes: parameters:
|
Is that the whole message? Do you see where the error is coming from? |
Internal error: Internal error: Method newEloquentBuilder() was not found in reflection of class |
This is the relevant part. What is the content of this file? |
Hi @staudenmeir, i've just hit the same issue.
This is the complete output i'm getting:
phpstan.neon:
Hope this helps. |
@mxaGianluca What does |
I've reduced it to this: <?php
namespace App\Models;
use Staudenmeir\LaravelAdjacencyList\Eloquent\HasRecursiveRelationships;
use Staudenmeir\LaravelAdjacencyList\Eloquent\Relations\Ancestors;
class FsDirectory
{
use HasRecursiveRelationships;
public function ancestorDirectories(): Ancestors
{
return $this->ancestorsAndSelf()
->hasParent()
->breadthFirst();
}
} Removing the |
Thanks @mxaGianluca. I can reproduce the error, but I don't know what the package can do to prevent it (if it can do anything). It only seems to occur when you call multiple scopes. |
@staudenmeir i'm not 100% sure, but might this issue be related? larastan/larastan#1759 |
@mxaGianluca I've read that, but AFAICT, the package's generics are correct. Did you just now add the |
In my specific case i updated from L9 -> L10 and i updated I didn't have this error in the older version. It looks like something that should be fixed upstream. |
It's not a solution yet, but i have a workaround. public function ancestorDirectories(): Ancestors
{
return $this
->ancestorsAndSelf()
->addAncestorConstraints();
}
public function scopeAddAncestorConstraints($query)
{
$query
->hasParent()
->breadthFirst();
} This prevents the error from being thrown. |
@mxaGianluca can you check if this error has been resolved since #252 and #255 have been merged? You would have to load this package via If it isn't fixed, then we might have to take a look at improving the scope generics. |
@SanderMuller it doesn't seem that it has been fixed. I've loaded the package via Hope this helps. |
I know somewhat the area where it's going wrong, but not sure yet why exactly or how to fix it, but I will fiddle with it when I have some spare time! @staudenmeir this is the WIP: https://github.com/staudenmeir/laravel-adjacency-list/compare/main...SanderMuller:laravel-adjacency-list:fix/issue-233?expand=1 the
One step forward, but I don't have an actual fix yet |
This has been fixed in the latest release thanks to @SanderMuller. |
when running php i get this error
Internal error: Internal error: Method newEloquentBuilder() was not found in reflection of class
Staudenmeir\LaravelAdjacencyList\Eloquent\Relations\Descendants.
The text was updated successfully, but these errors were encountered: