Skip to content

Commit

Permalink
Enhancement: Use variadics
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Feb 24, 2023
1 parent ebc6c28 commit 767cc88
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 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.7.0...master`][0.7.0...master].

### Changed

- Made use of variadic parameters in `NodeBuilderInterface::leafs()` and `NodeBuilder::leafs()` ([#167]), by [@localheinz]

## [`0.7.0`][0.7.0]

For a full diff see [0.6.0...0.7.0`][0.6.0...0.7.0].
Expand Down Expand Up @@ -239,6 +243,7 @@ For a full diff see [`fcfd14e...v0.1.1`][fcfd14e...0.1.1].
[#152]: https://github.com/nicmart/Tree/pull/152
[#153]: https://github.com/nicmart/Tree/pull/153
[#154]: https://github.com/nicmart/Tree/pull/154
[#167]: https://github.com/nicmart/Tree/pull/167

[@asalazar-pley]: https://github.com/asalazar-pley
[@Djuki]: https://github.com/Djuki
Expand Down
3 changes: 0 additions & 3 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
<MixedAssignment>
<code>$value</code>
</MixedAssignment>
<ParamNameMismatch>
<code>$value1</code>
</ParamNameMismatch>
</file>
<file src="src/Builder/NodeBuilderInterface.php">
<PossiblyUnusedReturnValue>
Expand Down
4 changes: 2 additions & 2 deletions src/Builder/NodeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ public function leaf(mixed $value = null): static
return $this;
}

public function leafs(mixed $value1 /* , $value2, ... */): static
public function leafs(mixed ...$values): static
{
foreach (\func_get_args() as $value) {
foreach ($values as $value) {
$this->leaf($value);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Builder/NodeBuilderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function leaf(mixed $value = null): static;
/**
* Add several leafs to the node.
*/
public function leafs(mixed $value /* , $value2, ... */): static;
public function leafs(mixed ...$values): static;

/**
* Add a child to the node enter in its scope.
Expand Down

0 comments on commit 767cc88

Please sign in to comment.