for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Nexus\CustomCommand\Business\Hydrator;
use Nexus\CustomCommand\Business\Finder\CommandFinderInterface;
class CommandHydrator implements CommandHydratorInterface
{
/**
* @var \Nexus\CustomCommand\Business\Finder\CommandFinderInterface
*/
private $commandFinder;
* CommandHydrator constructor.
*
* @param \Nexus\CustomCommand\Business\Finder\CommandFinderInterface $commandFinder
public function __construct(CommandFinderInterface $commandFinder)
$this->commandFinder = $commandFinder;
}
* @param array $commands
* @return array
public function hydrateCommands(array $commands)
if ($this->commandFinder->isDir()) {
$commands += $this->getCommandsFromFinder();
return $commands;
$commands
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.
private function getCommandsFromFinder(): array
$commands = [];
foreach ($this->commandFinder->getCommandClasses() as $file) {
require_once $file->getRealPath();
$className = sprintf(
'Nexus\\CustomCommand\\Command\\%s',
$file->getBasename('.php')
);
$commands[] = new $className();
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.