Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Darkdawg's avatar

PHPStan: method not found from laravel-cte package

I'm new to PHPStan & Larastan, and it's driving me nuts. I'm also using Laravel IDE Helper, but it's not being helpful with these specific errors.

I'm using two common packages:

staudenmeir/laravel-cte and staudenmeir/laravel-adjacency-list

Whenever I use any methods from these packages, PHPStan complains that the methods are not found:

Illuminate\Database\Query\Builder::withRecursiveExpression(). method.notFound

For example: DB::query()->withRecursiveExpression(...)

What's weird is that my IDE sees the methods, but PHPStan does not.

With so many people using these packages, I'm surprised there's few to no hits when searching for this issue. Is it something on my end? I don't want to just ignore the errors, am I supposed to manually create stubs for these? Are there no extensions or something?

0 likes
0 replies

Please or to participate in this conversation.