CS fixes for 3.1

This commit is contained in:
Tim Nagel 2015-03-12 21:45:24 +11:00
parent 345b5d423d
commit 89db88c2a0
20 changed files with 54 additions and 43 deletions

View file

@ -3,7 +3,6 @@
namespace FOS\ElasticaBundle\Command; namespace FOS\ElasticaBundle\Command;
use FOS\ElasticaBundle\Event\IndexPopulateEvent; use FOS\ElasticaBundle\Event\IndexPopulateEvent;
use FOS\ElasticaBundle\Event\PopulateEvent;
use FOS\ElasticaBundle\Event\TypePopulateEvent; use FOS\ElasticaBundle\Event\TypePopulateEvent;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Helper\DialogHelper; use Symfony\Component\Console\Helper\DialogHelper;
@ -181,8 +180,8 @@ class PopulateCommand extends ContainerAwareCommand
* Refreshes an index. * Refreshes an index.
* *
* @param OutputInterface $output * @param OutputInterface $output
* @param string $index * @param string $index
* @param bool $postPopulate * @param bool $postPopulate
*/ */
private function refreshIndex(OutputInterface $output, $index, $postPopulate = true) private function refreshIndex(OutputInterface $output, $index, $postPopulate = true)
{ {

View file

@ -21,9 +21,10 @@ class ProgressClosureBuilder
* line. * line.
* *
* @param OutputInterface $output * @param OutputInterface $output
* @param string $action * @param string $action
* @param string $index * @param string $index
* @param string $type * @param string $type
*
* @return callable * @return callable
*/ */
public function build(OutputInterface $output, $action, $index, $type) public function build(OutputInterface $output, $action, $index, $type)
@ -58,9 +59,10 @@ class ProgressClosureBuilder
* methods to support what we need. * methods to support what we need.
* *
* @param OutputInterface $output * @param OutputInterface $output
* @param string $action * @param string $action
* @param string $index * @param string $index
* @param string $type * @param string $type
*
* @return callable * @return callable
*/ */
private function buildLegacy(OutputInterface $output, $action, $index, $type) private function buildLegacy(OutputInterface $output, $action, $index, $type)

View file

@ -77,7 +77,7 @@ abstract class AbstractProvider extends BaseAbstractProvider
} else { } else {
try { try {
$this->objectPersister->insertMany($objects); $this->objectPersister->insertMany($objects);
} catch(BulkResponseException $e) { } catch (BulkResponseException $e) {
if ($loggerClosure) { if ($loggerClosure) {
$loggerClosure($batchSize, $nbObjects, sprintf('<error>%s</error>', $e->getMessage())); $loggerClosure($batchSize, $nbObjects, sprintf('<error>%s</error>', $e->getMessage()));
} }
@ -106,9 +106,10 @@ abstract class AbstractProvider extends BaseAbstractProvider
* the fetchSlice methods defined in the ORM/MongoDB subclasses. * the fetchSlice methods defined in the ORM/MongoDB subclasses.
* *
* @param $queryBuilder * @param $queryBuilder
* @param int $limit * @param int $limit
* @param int $offset * @param int $offset
* @param array $lastSlice * @param array $lastSlice
*
* @return array * @return array
*/ */
protected function getSlice($queryBuilder, $limit, $offset, $lastSlice) protected function getSlice($queryBuilder, $limit, $offset, $lastSlice)

View file

@ -7,7 +7,7 @@ use FOS\ElasticaBundle\Exception\InvalidArgumentTypeException;
use FOS\ElasticaBundle\Doctrine\SliceFetcherInterface; use FOS\ElasticaBundle\Doctrine\SliceFetcherInterface;
/** /**
* Fetches a slice of objects * Fetches a slice of objects.
* *
* @author Thomas Prelot <tprelot@gmail.com> * @author Thomas Prelot <tprelot@gmail.com>
*/ */

View file

@ -7,7 +7,7 @@ use FOS\ElasticaBundle\Exception\InvalidArgumentTypeException;
use FOS\ElasticaBundle\Doctrine\SliceFetcherInterface; use FOS\ElasticaBundle\Doctrine\SliceFetcherInterface;
/** /**
* Fetches a slice of objects * Fetches a slice of objects.
* *
* @author Thomas Prelot <tprelot@gmail.com> * @author Thomas Prelot <tprelot@gmail.com>
*/ */
@ -22,7 +22,7 @@ class SliceFetcher implements SliceFetcherInterface
throw new InvalidArgumentTypeException($queryBuilder, 'Doctrine\ORM\QueryBuilder'); throw new InvalidArgumentTypeException($queryBuilder, 'Doctrine\ORM\QueryBuilder');
} }
/** /*
* An orderBy DQL part is required to avoid feching the same row twice. * An orderBy DQL part is required to avoid feching the same row twice.
* @see http://stackoverflow.com/questions/6314879/does-limit-offset-length-require-order-by-for-pagination * @see http://stackoverflow.com/questions/6314879/does-limit-offset-length-require-order-by-for-pagination
* @see http://www.postgresql.org/docs/current/static/queries-limit.html * @see http://www.postgresql.org/docs/current/static/queries-limit.html
@ -31,7 +31,7 @@ class SliceFetcher implements SliceFetcherInterface
$orderBy = $queryBuilder->getDQLPart('orderBy'); $orderBy = $queryBuilder->getDQLPart('orderBy');
if (empty($orderBy)) { if (empty($orderBy)) {
$rootAliases = $queryBuilder->getRootAliases(); $rootAliases = $queryBuilder->getRootAliases();
foreach ($identifierFieldNames as $fieldName) { foreach ($identifierFieldNames as $fieldName) {
$queryBuilder->addOrderBy($rootAliases[0].'.'.$fieldName); $queryBuilder->addOrderBy($rootAliases[0].'.'.$fieldName);
} }

View file

@ -3,7 +3,7 @@
namespace FOS\ElasticaBundle\Doctrine; namespace FOS\ElasticaBundle\Doctrine;
/** /**
* Fetches a slice of objects * Fetches a slice of objects.
* *
* @author Thomas Prelot <tprelot@gmail.com> * @author Thomas Prelot <tprelot@gmail.com>
*/ */
@ -17,7 +17,8 @@ interface SliceFetcherInterface
* @param integer $offset * @param integer $offset
* @param array $previousSlice * @param array $previousSlice
* @param array $identifierFieldNames * @param array $identifierFieldNames
*
* @return array * @return array
*/ */
function fetch($queryBuilder, $limit, $offset, array $previousSlice, array $identifierFieldNames); public function fetch($queryBuilder, $limit, $offset, array $previousSlice, array $identifierFieldNames);
} }

View file

@ -14,7 +14,7 @@ namespace FOS\ElasticaBundle\Event;
use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\Event;
/** /**
* Index Populate Event * Index Populate Event.
* *
* @author Oleg Andreyev <oleg.andreyev@intexsys.lv> * @author Oleg Andreyev <oleg.andreyev@intexsys.lv>
*/ */
@ -39,9 +39,9 @@ class IndexPopulateEvent extends Event
private $options; private $options;
/** /**
* @param string $index * @param string $index
* @param boolean $reset * @param boolean $reset
* @param array $options * @param array $options
*/ */
public function __construct($index, $reset, $options) public function __construct($index, $reset, $options)
{ {

View file

@ -14,7 +14,7 @@ namespace FOS\ElasticaBundle\Event;
use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\Event;
/** /**
* Index ResetEvent * Index ResetEvent.
* *
* @author Oleg Andreyev <oleg.andreyev@intexsys.lv> * @author Oleg Andreyev <oleg.andreyev@intexsys.lv>
*/ */

View file

@ -14,7 +14,7 @@ namespace FOS\ElasticaBundle\Event;
use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\Event;
/** /**
* Type Populate Event * Type Populate Event.
* *
* @author Oleg Andreyev <oleg.andreyev@intexsys.lv> * @author Oleg Andreyev <oleg.andreyev@intexsys.lv>
*/ */
@ -31,8 +31,8 @@ class TypePopulateEvent extends IndexPopulateEvent
/** /**
* @param string $index * @param string $index
* @param string $type * @param string $type
* @param bool $reset * @param bool $reset
* @param array $options * @param array $options
*/ */
public function __construct($index, $type, $reset, $options) public function __construct($index, $type, $reset, $options)
{ {

View file

@ -14,7 +14,7 @@ namespace FOS\ElasticaBundle\Event;
use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\Event;
/** /**
* Type ResetEvent * Type ResetEvent.
* *
* @author Oleg Andreyev <oleg.andreyev@intexsys.lv> * @author Oleg Andreyev <oleg.andreyev@intexsys.lv>
*/ */

View file

@ -35,9 +35,9 @@ class FantaPaginatorAdapter implements AdapterInterface
{ {
return $this->adapter->getFacets(); return $this->adapter->getFacets();
} }
/** /**
* Returns Aggregations * Returns Aggregations.
* *
* @return mixed * @return mixed
* *

View file

@ -27,9 +27,9 @@ interface PaginatorAdapterInterface
* @return mixed * @return mixed
*/ */
public function getFacets(); public function getFacets();
/** /**
* Returns Aggregations * Returns Aggregations.
* *
* @return mixed * @return mixed
*/ */

View file

@ -24,9 +24,9 @@ interface PartialResultsInterface
* @return array * @return array
*/ */
public function getFacets(); public function getFacets();
/** /**
* Returns the aggregations * Returns the aggregations.
* *
* @return array * @return array
*/ */

View file

@ -36,7 +36,7 @@ class RawPaginatorAdapter implements PaginatorAdapterInterface
* @var array for the facets * @var array for the facets
*/ */
private $facets; private $facets;
/** /**
* @var array for the aggregations * @var array for the aggregations
*/ */
@ -110,9 +110,12 @@ class RawPaginatorAdapter implements PaginatorAdapterInterface
/** /**
* Returns the number of results. * Returns the number of results.
* *
* @param boolean $genuineTotal make the function return the `hits.total` * If genuineTotal is provided as true, total hits is returned from the
* value of the search result in all cases, instead of limiting it to the * hits.total value from the search results instead of just returning
* `size` request parameter. * the requested size.
*
* @param boolean $genuineTotal
*
* @return integer The number of results. * @return integer The number of results.
*/ */
public function getTotalHits($genuineTotal = false) public function getTotalHits($genuineTotal = false)
@ -139,13 +142,14 @@ class RawPaginatorAdapter implements PaginatorAdapterInterface
return $this->facets; return $this->facets;
} }
/** /**
* Returns Aggregations * Returns Aggregations.
* *
* @return mixed * @return mixed
*/ */
public function getAggregations() { public function getAggregations()
{
if (!isset($this->aggregations)) { if (!isset($this->aggregations)) {
$this->aggregations = $this->searchable->search($this->query)->getAggregations(); $this->aggregations = $this->searchable->search($this->query)->getAggregations();
} }

View file

@ -71,6 +71,7 @@ interface ObjectPersisterInterface
* If the object persister handles the given object. * If the object persister handles the given object.
* *
* @param object $object * @param object $object
*
* @return bool * @return bool
*/ */
public function handlesObject($object); public function handlesObject($object);

View file

@ -72,6 +72,7 @@ abstract class AbstractProvider implements ProviderInterface
* Get string with RAM usage information (current and peak). * Get string with RAM usage information (current and peak).
* *
* @deprecated To be removed in 4.0 * @deprecated To be removed in 4.0
*
* @return string * @return string
*/ */
protected function getMemoryUsage() protected function getMemoryUsage()

View file

@ -11,7 +11,7 @@
<parameter key="fos_elastica.elastica_to_model_transformer.prototype.orm.class">FOS\ElasticaBundle\Doctrine\ORM\ElasticaToModelTransformer</parameter> <parameter key="fos_elastica.elastica_to_model_transformer.prototype.orm.class">FOS\ElasticaBundle\Doctrine\ORM\ElasticaToModelTransformer</parameter>
<parameter key="fos_elastica.manager.orm.class">FOS\ElasticaBundle\Doctrine\RepositoryManager</parameter> <parameter key="fos_elastica.manager.orm.class">FOS\ElasticaBundle\Doctrine\RepositoryManager</parameter>
</parameters> </parameters>
<services> <services>
<service id="fos_elastica.slice_fetcher.orm" class="%fos_elastica.slice_fetcher.orm.class%"> <service id="fos_elastica.slice_fetcher.orm" class="%fos_elastica.slice_fetcher.orm.class%">
</service> </service>

View file

@ -57,8 +57,9 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase
/** /**
* @param string $testQuery * @param string $testQuery
* @param int $testLimit * @param int $testLimit
* @param string $method * @param string $method
*
* @return \FOS\ElasticaBundle\Finder\TransformedFinder|\PHPUnit_Framework_MockObject_MockObject * @return \FOS\ElasticaBundle\Finder\TransformedFinder|\PHPUnit_Framework_MockObject_MockObject
*/ */
private function getFinderMock($testQuery, $testLimit = null, $method = 'find') private function getFinderMock($testQuery, $testLimit = null, $method = 'find')

View file

@ -411,6 +411,7 @@ class ModelToElasticaAutoTransformerTest extends \PHPUnit_Framework_TestCase
/** /**
* @param null|\Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher * @param null|\Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
*
* @return ModelToElasticaAutoTransformer * @return ModelToElasticaAutoTransformer
*/ */
private function getTransformer($dispatcher = null) private function getTransformer($dispatcher = null)

View file

@ -38,7 +38,7 @@ class ModelToElasticaAutoTransformer implements ModelToElasticaTransformerInterf
/** /**
* Instanciates a new Mapper. * Instanciates a new Mapper.
* *
* @param array $options * @param array $options
* @param EventDispatcherInterface $dispatcher * @param EventDispatcherInterface $dispatcher
*/ */
public function __construct(array $options = array(), EventDispatcherInterface $dispatcher = null) public function __construct(array $options = array(), EventDispatcherInterface $dispatcher = null)