22
33namespace Kalnoy \Nestedset \Contracts ;
44
5- use Illuminate \Database \Query \Builder as BaseQueryBuilder ;
65use Illuminate \Database \Eloquent \Builder as EloquentBuilder ;
76use Illuminate \Database \Eloquent \Collection as EloquentCollection ;
87use Illuminate \Database \Eloquent \Relations \BelongsTo ;
98use Illuminate \Database \Eloquent \Relations \HasMany ;
109use Illuminate \Database \Eloquent \Relations \Relation ;
10+ use Illuminate \Database \Query \Builder as BaseQueryBuilder ;
1111
1212/**
1313 * Accompanies {@link \Kalnoy\Nestedset\NodeTrait}.
2323 *
2424 * @template Tmodel of \Illuminate\Database\Eloquent\Model
2525 *
26- * @phpstan-type NodeModel Node<Tmodel>
27- *
26+ * @phpstan-type NodeModel Node<Tmodel>&Tmodel
27+ *
2828 * @require-extends \Illuminate\Database\Eloquent\Model
29+ *
30+ * @method mixed getKey()
31+ * @method mixed getKeyName()
32+ * @method Node setRelation($relation, $value)
33+ * @method mixed save()
34+ * @method string getTable()
35+ * @method mixed getAttribute($key)
36+ * @method string getDeletedAtColumn()
37+ * @method Node getRelationValue($key)
38+ * @method bool usesSoftDelete()
2939 */
3040interface Node
3141{
@@ -51,7 +61,7 @@ public function children(): HasMany;
5161 /**
5262 * Get query for descendants of the node.
5363 *
54- * @return DescendantsRelation< Tmodel>
64+ * @return Relation<NodeModel,NodeModel,EloquentCollection<int,Node< Tmodel>&Tmodel> >
5565 */
5666 public function descendants (): Relation ;
5767
@@ -74,9 +84,9 @@ public function siblingsAndSelf(): NodeQueryBuilder;
7484 *
7585 * @param string[] $columns
7686 *
77- * @return EloquentCollection<int,NodeModel >
87+ * @return NestedSetCollection<Tmodel >
7888 */
79- public function getSiblingsAndSelf (array $ columns = ['* ' ]): EloquentCollection ;
89+ public function getSiblingsAndSelf (array $ columns = ['* ' ]): NestedSetCollection ;
8090
8191 /**
8292 * Get query for siblings after the node.
@@ -109,7 +119,7 @@ public function prevNodes(): NodeQueryBuilder;
109119 /**
110120 * Get query ancestors of the node.
111121 *
112- * @return AncestorsRelation< Tmodel>
122+ * @return Relation<NodeModel,NodeModel,EloquentCollection<int,Node< Tmodel>&Tmodel> >
113123 */
114124 public function ancestors (): Relation ;
115125
@@ -291,35 +301,35 @@ public function getPrevNode(array $columns = ['*']): Node;
291301 /**
292302 * @param string[] $columns
293303 *
294- * @return Collection <Tmodel>
304+ * @return NestedSetCollection <Tmodel>
295305 */
296306 public function getAncestors (array $ columns = ['* ' ]);
297307
298308 /**
299309 * @param string[] $columns
300310 *
301- * @return Collection <Tmodel>
311+ * @return NestedSetCollection <Tmodel>
302312 */
303313 public function getDescendants (array $ columns = ['* ' ]);
304314
305315 /**
306316 * @param string[] $columns
307317 *
308- * @return Collection <Tmodel>
318+ * @return NestedSetCollection <Tmodel>
309319 */
310320 public function getSiblings (array $ columns = ['* ' ]);
311321
312322 /**
313323 * @param string[] $columns
314324 *
315- * @return Collection <Tmodel>
325+ * @return NestedSetCollection <Tmodel>
316326 */
317327 public function getNextSiblings (array $ columns = ['* ' ]);
318328
319329 /**
320330 * @param string[] $columns
321331 *
322- * @return Collection <Tmodel>
332+ * @return NestedSetCollection <Tmodel>
323333 */
324334 public function getPrevSiblings (array $ columns = ['* ' ]);
325335
@@ -430,20 +440,4 @@ public function isSelfOrDescendantOf(Node $other);
430440 * @return NodeQueryBuilder<Tmodel>
431441 */
432442 public function newQuery ();
433-
434- /**
435- * Get the value of the model's primary key.
436- * ! This is directly from Model method...
437- *
438- * @return mixed
439- */
440- public function getKey ();
441-
442- /**
443- * Get the value of the model's primary key.
444- * ! This is directly from Model method...
445- *
446- * @return mixed
447- */
448- public function getKeyName ();
449443}
0 commit comments