Skip to content

Commit f08c42b

Browse files
author
David DiMaria
committed
Replaces "instanceof Node" in favor of NodeTrait::hasTrait()
1 parent 5525555 commit f08c42b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Collection.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ public function toTree($root = null)
7777
*/
7878
protected function getRootNodeId($root = null)
7979
{
80-
if ($root instanceof Node) return $root->getKey();
80+
if (NodeTrait::hasTrait($root)) {
81+
return $root->getKey();
82+
}
8183

8284
// If root node is not specified we take parent id of node with
8385
// least lft value as root node id.

src/QueryBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function whereAncestorOf($id)
8484

8585
$key = $this->query->getGrammar()->wrap($keyName);
8686

87-
if ($id instanceof Node)
87+
if (NodeTrait::hasTrait($id))
8888
{
8989
$dataSource = '?';
9090

@@ -167,7 +167,7 @@ public function orWhereNodeBetween($values)
167167
*/
168168
public function whereDescendantOf($id, $boolean = 'and', $not = false)
169169
{
170-
if ($id instanceof Node)
170+
if (NodeTrait::hasTrait($id))
171171
{
172172
$data = $id->getBounds();
173173
}

0 commit comments

Comments
 (0)