Skip to content

Commit 766b99e

Browse files
committed
lvl 5
1 parent 28efff9 commit 766b99e

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ includes:
44
- phpstan-baseline.neon
55

66
parameters:
7-
level: 4
7+
level: 5
88
paths:
99
- src
1010
- tests/models/

src/Contracts/Node.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ public function isAncestorOf(Node $other): bool;
419419
/**
420420
* Get whether a node is a descendant of other node.
421421
*
422-
* @param NodeModel $other
422+
* @param Node<Tmodel> $other
423423
*
424424
* @return bool
425425
*/

src/NodeTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Kalnoy\Nestedset\Contracts\NodeQueryBuilder;
1717

1818
/**
19-
* @template Tmodel extends Model
19+
* @template Tmodel extends \Illuminate\Database\Eloquent\Model
2020
* @template Tmodelkey of array-key
2121
*
2222
* @method void setRelation(string $relation, mixed $value)
@@ -181,7 +181,7 @@ protected function actionAppendOrPrepend(Node $parent, $prepend = false)
181181
/**
182182
* Apply parent model.
183183
*
184-
* @param Model|null $value
184+
* @param (Node&Tmodel)|null $value
185185
*
186186
* @return $this
187187
*/

src/QueryBuilder.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public function orWhereNodeBetween(array $values): NodeQueryBuilder
214214
*
215215
* @since 2.0
216216
*
217-
* @param ?NodeModel $id
217+
* @param ?Node<Tmodel> $id
218218
* @param string $boolean
219219
* @param bool $not
220220
* @param bool $andSelf
@@ -250,7 +250,7 @@ public function whereNotDescendantOf(mixed $id): NodeQueryBuilder
250250
}
251251

252252
/**
253-
* @param NodeModel $id
253+
* @param Node<Tmodel> $id
254254
*
255255
* @return QueryBuilder<Tmodel>
256256
*/
@@ -260,7 +260,7 @@ public function orWhereDescendantOf(mixed $id): NodeQueryBuilder
260260
}
261261

262262
/**
263-
* @param NodeModel $id
263+
* @param Node<Tmodel> $id
264264
*
265265
* @return QueryBuilder<Tmodel>
266266
*/
@@ -270,7 +270,7 @@ public function orWhereNotDescendantOf(mixed $id): NodeQueryBuilder
270270
}
271271

272272
/**
273-
* @param NodeModel $id
273+
* @param Node<Tmodel> $id
274274
* @param string $boolean
275275
* @param bool $not
276276
*
@@ -868,15 +868,15 @@ public function fixTree($root = null): int
868868

869869
$dictionary = $this->model
870870
->newNestedSetQuery()
871-
->when($root, function (self $query) use ($root) {
871+
->when($root !== null, function (self $query) use ($root) {
872872
return $query->whereDescendantOf($root);
873873
})
874874
->defaultOrder()
875875
->get($columns)
876876
->groupBy($this->model->getParentIdName())
877877
->all();
878878

879-
return $this->fixNodes($dictionary, $root);
879+
return $this->fixNodes($dictionary, $root); /** @phpstan-ignore argument.type */
880880
}
881881

882882
/**

0 commit comments

Comments
 (0)