Skip to content

Commit

Permalink
Merge pull request #147 from nicmart/fix/size
Browse files Browse the repository at this point in the history
Fix: Add `getSize()` to `NodeInterface`
  • Loading branch information
localheinz committed Jan 27, 2023
2 parents 65d4323 + 1dad3c0 commit 3a8ee5d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

For a full diff see [`0.5.0...master`][0.5.0...master].

### Changed

- Added `getSize()` to `NodeInterface` ([#147]), by [@localheinz]

## [`0.5.0`][0.5.0]

For a full diff see [`0.4.0...0.5.0`][0.4.0...0.5.0].
Expand Down Expand Up @@ -200,6 +204,7 @@ For a full diff see [`fcfd14e...v0.1.1`][fcfd14e...0.1.1].
[#136]: https://github.com/nicmart/Tree/pull/136
[#137]: https://github.com/nicmart/Tree/pull/137
[#138]: https://github.com/nicmart/Tree/pull/138
[#147]: https://github.com/nicmart/Tree/pull/147

[@asalazar-pley]: https://github.com/asalazar-pley
[@Djuki]: https://github.com/Djuki
Expand Down
7 changes: 0 additions & 7 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@
</MixedArgument>
<MixedAssignment>
<code>$child</code>
<code>$size</code>
</MixedAssignment>
<MixedInferredReturnType>
<code>int</code>
</MixedInferredReturnType>
<MixedReturnTypeCoercion>
<code>getAncestorsAndSelf</code>
</MixedReturnTypeCoercion>
Expand All @@ -65,9 +61,6 @@
<code>getChildren</code>
<code>getDepth</code>
</PossiblyNullReference>
<UndefinedInterfaceMethod>
<code>getSize</code>
</UndefinedInterfaceMethod>
</file>
<file src="src/Visitor/PostOrderVisitor.php">
<MixedArgument>
Expand Down
7 changes: 7 additions & 0 deletions src/Node/NodeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ public function getDepth();
*/
public function getHeight();

/**
* Return the number of nodes in a tree.
*
* @return int
*/
public function getSize();

/**
* Accept method for the visitor pattern (see http://en.wikipedia.org/wiki/Visitor_pattern).
*/
Expand Down
5 changes: 0 additions & 5 deletions src/Node/NodeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,6 @@ public function getHeight()
return \max($heights) + 1;
}

/**
* Return the number of nodes in a tree.
*
* @return int
*/
public function getSize()
{
$size = 1;
Expand Down

0 comments on commit 3a8ee5d

Please sign in to comment.