for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace GBProd\ElasticsearchExtraBundle\Handler;
use Elasticsearch\Client;
use GBProd\ElasticsearchExtraBundle\Repository\IndexConfigurationRepository;
/**
* Handler to put index mappings command
*
* @author gbprod <[email protected]>
*/
class PutIndexMappingsHandler
{
* @var IndexConfigurationRepository
private $configurationRepository;
* @param ClientRepository $clientRepository
$clientRepository
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 IndexConfigurationRepository $configurationRepository
public function __construct(IndexConfigurationRepository $configurationRepository)
$this->configurationRepository = $configurationRepository;
}
* Handle index creation command
* @param Client $client
* @param string $index
public function handle(Client $client, $index, $type)
$config = $this->configurationRepository->get($index);
if ($this->isInvalid($config, $type)) {
throw new \InvalidArgumentException();
$client
->indices()
->putMapping([
'index' => $index,
'type' => $type,
'body' => [
$type => $config['mappings'][$type],
],
])
;
private function isInvalid($config, $type)
return null === $config
|| empty($type)
|| !isset($config['mappings'])
|| !isset($config['mappings'][$type])
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.