-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Improve replacement of return type for methods from Query\Builder #1575
Conversation
Here the old and new file for easier comparison: |
Changes 03.09.24
Edit: Intelephense up to version 1.10.4 and again since version 1.12.6 works with the |
Thank you very much for your valuable contributions! |
Is this fixed with 3.2 now adding the type? |
Not yet. This pull request additionally adds the type for various methods of Examples: User::query()->where('name', 'joe')->first(); // `query()` from the model already works as of 3.2
User::where('name', 'joe')->first(); // `where` from Eloquent\Builder will work with this pull request
User::whereNull('name')->first(); // `whereNull` from Query\Builder will work with this pull request |
Summary
See issue for expected improvement: #1574
The class
\Eloquent
in_ide_helper.php
contains methods fromIlluminate\Database\Eloquent\Builder
andIlluminate\Database\Query\Builder
. The return type for$this
is replaced with the real class (in case of the Eloquent\Builder already with an additional|static
). This merge requests replaces$this
in methods from Query\Builder with the identical return typeIlluminate\Database\Eloquent\Builder|static
. In the context of an\Eloquent
instance this should be the real behavior and improves the derived types.Type of change
Checklist
composer fix-style