Skip to content

Commit

Permalink
Fix PHPStan errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Dec 30, 2018
1 parent db5f5a6 commit f422c8b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Exporter/Ascii.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace drupol\phptree\Exporter;

use drupol\phptree\Node\NodeInterface;
use drupol\phptree\Node\ValueNodeInterface;

/**
* Class Ascii
Expand Down Expand Up @@ -48,11 +49,19 @@ public function export(NodeInterface $node): string
/**
* Export the tree in an array.
*
* @param \drupol\phptree\Node\NodeInterface $node
* The node.
*
* @return array
* The tree exported into an array.
*/
private function doExportAsArray(NodeInterface $node): array
{
if (!($node instanceof ValueNodeInterface))
{
throw new \InvalidArgumentException('Must implements ValueNodeInterface');
}

$children = [];
/** @var ValueNodeInterface $child */
foreach ($node->children() as $child) {
Expand Down
6 changes: 6 additions & 0 deletions src/Exporter/SimpleArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace drupol\phptree\Exporter;

use drupol\phptree\Node\NodeInterface;
use drupol\phptree\Node\ValueNodeInterface;

/**
* Class SimpleArray
Expand All @@ -16,6 +17,11 @@ class SimpleArray implements ExporterInterface
*/
public function export(NodeInterface $node)
{
if (!($node instanceof ValueNodeInterface))
{
throw new \InvalidArgumentException('Must implements ValueNodeInterface');
}

$children = [];
/** @var ValueNodeInterface $child */
foreach ($node->children() as $child) {
Expand Down
6 changes: 6 additions & 0 deletions src/Exporter/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace drupol\phptree\Exporter;

use drupol\phptree\Node\NodeInterface;
use drupol\phptree\Node\ValueNodeInterface;

/**
* Class Text
Expand All @@ -16,6 +17,11 @@ class Text implements ExporterInterface
*/
public function export(NodeInterface $node): string
{
if (!($node instanceof ValueNodeInterface))
{
throw new \InvalidArgumentException('Must implements ValueNodeInterface');
}

$children = [];
/** @var ValueNodeInterface $child */
foreach ($node->children() as $child) {
Expand Down

0 comments on commit f422c8b

Please sign in to comment.