-
Notifications
You must be signed in to change notification settings - Fork 11.5k
[9.x] PHPStan support for union methods #42374
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
Conversation
This is not necessary. Including subtypes of types already in the union adds no extra information. It like having a the type |
@GrahamCampbell https://github.com/laravel/framework/blob/9.x/src/Illuminate/Database/Eloquent/Builder.php#L30 |
@@ -2438,7 +2438,7 @@ protected function removeExistingOrdersFor($column) | |||
/** | |||
* Add a union statement to the query. | |||
* | |||
* @param \Illuminate\Database\Query\Builder|\Closure $query | |||
* @param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|\Closure $query |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct, for the reason @GrahamCampbell mentioned:
This is not necessary. Including subtypes of types already in the union adds no extra information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each class implements a different interface, so they look different.
Am I misunderstanding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nunomaduro
Illuminate\Database\Eloquent\Builder
and Illuminate\Database\Eloquent\Builder
are not subclassed to each other, so they are not what @GrahamCampbell calls Person|Man
.
The code that @fagai exemplifies in the issue is valid code that actually works.
Is there a reasonable reason to exclude Illuminate\Database\Eloquent\Builder
from PHPDoc?
|
@GrahamCampbell @nunomaduro |
The union method is supports EloquentBuilder, but an error occurs because there is no description.