Skip to content

Commit

Permalink
fix bug with leaves
Browse files Browse the repository at this point in the history
  • Loading branch information
pvsaintpe committed May 16, 2024
1 parent 8f07516 commit e76fc38
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Collections/LTreeCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private function excludeLeaves(): void
{
foreach ($this->items as $key => $item) {
/** @var LTreeModelTrait $item */
if ($item->ltreeChildren->isEmpty()) {
if ($item->ltreeChildren->isEmpty() && $item->getLtreeParentId()) {

Check failure on line 67 in src/Collections/LTreeCollection.php

View check run for this annotation

Scrutinizer / Inspection

src/Collections/LTreeCollection.php#L67

The expression ``$item->getLtreeParentId()`` of type ``integer|null`` is loosely compared to ``true``; this is ambiguous if the integer can be 0. You might want to explicitly use ``!== null`` instead.
$this->forget($key);
}
}
Expand Down

0 comments on commit e76fc38

Please sign in to comment.