-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[Bug]: PHPStan invalid return type: Laravel\Scout\Builder
#4062
Comments
Sadly scout doesnt implement the Builder interface :( |
It would be better to revert Scout Query and instead just call the underlying query builder with |
As far as I understood that wouldn't be the same. I don't see any reason to revert the Scout feature.
Nothing is "strictly" using this type, it's completly opt in. It's just on the doclbock, which Phpstan sees. Nothing breaks functionally. I don't see your class in your issue, so I'm just guessing. But it sounds like you don't have a return type in your own code, so PHPstan will probably fallback onto the interface doclbock. If you just add |
@patrickbrouwers but there is an instance of Scout/Builder in code. how Does your code run if the Scout/Builder class is not available in your vendor packages? at least laravel scout should be added in composer json as dependency |
Instanceof checks don't care about the class actually existing. The rest of the logic only runs if the class exists |
Is the bug applicable and reproducable to the latest version of the package and hasn't it been reported before?
What version of Laravel Excel are you using?
3.1.51
What version of Laravel are you using?
latest
What version of PHP are you using?
8.2.0
Describe your issue
When upgrading to 3.1.51 we get the following PHPStan error:
How can the issue be reproduced?
Use PHP Stan + Laravel Excel without laravel Scout.
What should be the expected behaviour?
Not strictly use this type. instead use the laravel Builder interface: Illuminate\Contracts\Database\Query\Builder
The text was updated successfully, but these errors were encountered: