for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Vine\Commands;
use Vine\Node;
use Vine\NodeCollection;
class Copy
{
/**
* Keep in mind that Node::copy() utilises the Copy class when used with the depth parameter.
* So here the Node::copy() must never be passed a param to avoid infinite call loop.
*
* @param Node $node
* @param null $depth (null is infinite)
* @return Node
*/
public function __invoke(Node $node, $depth = null): Node
$copy = $node->isolatedCopy();
return $copy->addChildren($this->recursiveDepth($node->children(), $depth));
}
$node
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
* @param NodeCollection $children
$children
* @param $depth
* @param null|int $currentDepth
* @return bool|Node
private function recursiveDepth(NodeCollection $nodeCollection, $depth = null, $currentDepth = 0)
if(!is_null($depth) && $depth <= $currentDepth) return new NodeCollection();
$copyCollection = new NodeCollection();
$currentDepth++;
foreach($nodeCollection as $node)
$copyCollection->add($subNode = $node->isolatedCopy());
$subNode->addChildren($this->recursiveDepth($node->children(), $depth, $currentDepth));
return $copyCollection;
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.