Skip to content

Commit 2e9c7e3

Browse files
committed
add some more hinting
1 parent 54d622a commit 2e9c7e3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/Mixins/RelationshipsExtraMethods.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
* @method string getQualifiedLocalKeyName()
3535
* @method string getExistenceCompareKey()
3636
* @mixin \Illuminate\Database\Eloquent\Relations\Relation
37+
* @mixin \Illuminate\Database\Eloquent\Relations\HasOneOrMany
38+
* @mixin \Illuminate\Database\Eloquent\Relations\BelongsToMany
3739
* @property EloquentBuilder $query
3840
* @property \Illuminate\Database\Eloquent\Model $parent
3941
* @property \Illuminate\Database\Eloquent\Model $throughParent
@@ -105,7 +107,7 @@ protected function performJoinForEloquentPowerJoinsForBelongsTo(): \Closure
105107
*/
106108
protected function performJoinForEloquentPowerJoinsForBelongsToMany(): \Closure
107109
{
108-
return function ($builder, $joinType, $callback = null, $alias = null, bool $disableExtraConditions = false): static {
110+
return function (EloquentBuilder $builder, string $joinType, $callback = null, $alias = null, bool $disableExtraConditions = false): static {
109111
[$alias1, $alias2] = $alias;
110112

111113
$joinedTable = $alias1 ?: $this->getTable();
@@ -161,7 +163,7 @@ protected function performJoinForEloquentPowerJoinsForBelongsToMany(): \Closure
161163
*/
162164
protected function performJoinForEloquentPowerJoinsForMorphToMany(): \Closure
163165
{
164-
return function ($builder, $joinType, $callback = null, $alias = null, bool $disableExtraConditions = false): static {
166+
return function (EloquentBuilder $builder, string $joinType, $callback = null, $alias = null, bool $disableExtraConditions = false): static {
165167
[$alias1, $alias2] = $alias;
166168

167169
$joinedTable = $alias1 ?: $this->getTable();
@@ -217,7 +219,7 @@ protected function performJoinForEloquentPowerJoinsForMorphToMany(): \Closure
217219
*/
218220
protected function performJoinForEloquentPowerJoinsForMorph(): \Closure
219221
{
220-
return function (Builder $builder, $joinType, $callback = null, $alias = null, bool $disableExtraConditions = false) {
222+
return function (Builder $builder, string $joinType, $callback = null, $alias = null, bool $disableExtraConditions = false) {
221223
$builder->{$joinType}($this->getModel()->getTable(), function (PowerJoinClause $join) use ($callback, $disableExtraConditions) {
222224
$join->on(
223225
"{$this->getModel()->getTable()}.{$this->getForeignKeyName()}",
@@ -247,7 +249,7 @@ protected function performJoinForEloquentPowerJoinsForMorph(): \Closure
247249
*/
248250
protected function performJoinForEloquentPowerJoinsForMorphTo() :\Closure
249251
{
250-
return function (Builder $builder, $joinType, $callback = null, $alias = null, bool $disableExtraConditions = false, string $morphable = null) {
252+
return function (Builder $builder, string $joinType, $callback = null, $alias = null, bool $disableExtraConditions = false, string $morphable = null) {
251253
$modelInstance = new $morphable;
252254

253255
$builder->{$joinType}($modelInstance->getTable(), function ($join) use ($modelInstance, $callback, $disableExtraConditions) {
@@ -279,7 +281,7 @@ protected function performJoinForEloquentPowerJoinsForMorphTo() :\Closure
279281
*/
280282
protected function performJoinForEloquentPowerJoinsForHasMany(): \Closure
281283
{
282-
return function ($builder, $joinType, $callback = null, $alias = null, bool $disableExtraConditions = false): void {
284+
return function (EloquentBuilder $builder, string $joinType, callable $callback = null, $alias = null, bool $disableExtraConditions = false): void {
283285
$joinedTable = $alias ?: $this->getQuery()->getModel()->getTable();
284286
$parentTable = StaticCache::getTableOrAliasForModel($this->parent);
285287
$isOneOfMany = method_exists($this, 'isOneOfMany') ? $this->isOneOfMany() : false;
@@ -325,7 +327,7 @@ protected function performJoinForEloquentPowerJoinsForHasMany(): \Closure
325327
*/
326328
protected function performJoinForEloquentPowerJoinsForHasManyThrough(): \Closure
327329
{
328-
return function ($builder, $joinType, $callback = null, $alias = null, bool $disableExtraConditions = false): static {
330+
return function (EloquentBuilder $builder, string $joinType, $callback = null, $alias = null, bool $disableExtraConditions = false): static {
329331
[$alias1, $alias2] = $alias;
330332
$throughTable = $alias1 ?: $this->getThroughParent()->getTable();
331333
$farTable = $alias2 ?: $this->getModel()->getTable();

0 commit comments

Comments
 (0)