-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
78 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,23 +17,27 @@ | |
* Interface for tree nodes. | ||
* | ||
* @author Nicolò Martini <[email protected]> | ||
* | ||
* @template TValue | ||
*/ | ||
interface NodeInterface | ||
{ | ||
/** | ||
* Set the value of the current node. | ||
* | ||
* @param TValue $value | ||
*/ | ||
public function setValue(mixed $value): static; | ||
public function setValue($value): static; | ||
|
||
/** | ||
* Get the current node value. | ||
* | ||
* @return TValue | ||
*/ | ||
public function getValue(): mixed; | ||
public function getValue(); | ||
|
||
/** | ||
* Add a child. | ||
* | ||
* @return mixed | ||
*/ | ||
public function addChild(self $child): static; | ||
|
||
|
@@ -58,8 +62,6 @@ public function getChildren(): array; | |
* Replace the children set with the given one. | ||
* | ||
* @param array<int, NodeInterface> $children | ||
* | ||
* @return mixed | ||
*/ | ||
public function setChildren(array $children): static; | ||
|
||
|
@@ -71,7 +73,7 @@ public function setParent(?self $parent = null): void; | |
/** | ||
* Return the parent node. | ||
*/ | ||
public function getParent(): ?static; | ||
public function getParent(): ?self; | ||
|
||
/** | ||
* Retrieves all ancestors of node excluding current node. | ||
|
@@ -115,7 +117,7 @@ public function isLeaf(): bool; | |
/** | ||
* Find the root of the node. | ||
*/ | ||
public function root(): static; | ||
public function root(): self; | ||
|
||
/** | ||
* Return the distance from the current node to the root. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters