From 89db88c2a026809e65f4bd53f5e11c19df6e8a02 Mon Sep 17 00:00:00 2001 From: Tim Nagel Date: Thu, 12 Mar 2015 21:45:24 +1100 Subject: [PATCH] CS fixes for 3.1 --- Command/PopulateCommand.php | 5 ++--- Command/ProgressClosureBuilder.php | 14 ++++++++------ Doctrine/AbstractProvider.php | 7 ++++--- Doctrine/MongoDB/SliceFetcher.php | 2 +- Doctrine/ORM/SliceFetcher.php | 6 +++--- Doctrine/SliceFetcherInterface.php | 5 +++-- Event/IndexPopulateEvent.php | 8 ++++---- Event/IndexResetEvent.php | 2 +- Event/TypePopulateEvent.php | 6 +++--- Event/TypeResetEvent.php | 2 +- Paginator/FantaPaginatorAdapter.php | 4 ++-- Paginator/PaginatorAdapterInterface.php | 4 ++-- Paginator/PartialResultsInterface.php | 4 ++-- Paginator/RawPaginatorAdapter.php | 18 +++++++++++------- Persister/ObjectPersisterInterface.php | 1 + Provider/AbstractProvider.php | 1 + Resources/config/orm.xml | 2 +- Tests/RepositoryTest.php | 3 ++- .../ModelToElasticaAutoTransformerTest.php | 1 + Transformer/ModelToElasticaAutoTransformer.php | 2 +- 20 files changed, 54 insertions(+), 43 deletions(-) diff --git a/Command/PopulateCommand.php b/Command/PopulateCommand.php index 092a1e1..e3d2918 100644 --- a/Command/PopulateCommand.php +++ b/Command/PopulateCommand.php @@ -3,7 +3,6 @@ namespace FOS\ElasticaBundle\Command; use FOS\ElasticaBundle\Event\IndexPopulateEvent; -use FOS\ElasticaBundle\Event\PopulateEvent; use FOS\ElasticaBundle\Event\TypePopulateEvent; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Console\Helper\DialogHelper; @@ -181,8 +180,8 @@ class PopulateCommand extends ContainerAwareCommand * Refreshes an index. * * @param OutputInterface $output - * @param string $index - * @param bool $postPopulate + * @param string $index + * @param bool $postPopulate */ private function refreshIndex(OutputInterface $output, $index, $postPopulate = true) { diff --git a/Command/ProgressClosureBuilder.php b/Command/ProgressClosureBuilder.php index 53bcb18..f244bc3 100644 --- a/Command/ProgressClosureBuilder.php +++ b/Command/ProgressClosureBuilder.php @@ -21,9 +21,10 @@ class ProgressClosureBuilder * line. * * @param OutputInterface $output - * @param string $action - * @param string $index - * @param string $type + * @param string $action + * @param string $index + * @param string $type + * * @return callable */ public function build(OutputInterface $output, $action, $index, $type) @@ -58,9 +59,10 @@ class ProgressClosureBuilder * methods to support what we need. * * @param OutputInterface $output - * @param string $action - * @param string $index - * @param string $type + * @param string $action + * @param string $index + * @param string $type + * * @return callable */ private function buildLegacy(OutputInterface $output, $action, $index, $type) diff --git a/Doctrine/AbstractProvider.php b/Doctrine/AbstractProvider.php index 28fba5d..e250e56 100644 --- a/Doctrine/AbstractProvider.php +++ b/Doctrine/AbstractProvider.php @@ -77,7 +77,7 @@ abstract class AbstractProvider extends BaseAbstractProvider } else { try { $this->objectPersister->insertMany($objects); - } catch(BulkResponseException $e) { + } catch (BulkResponseException $e) { if ($loggerClosure) { $loggerClosure($batchSize, $nbObjects, sprintf('%s', $e->getMessage())); } @@ -106,9 +106,10 @@ abstract class AbstractProvider extends BaseAbstractProvider * the fetchSlice methods defined in the ORM/MongoDB subclasses. * * @param $queryBuilder - * @param int $limit - * @param int $offset + * @param int $limit + * @param int $offset * @param array $lastSlice + * * @return array */ protected function getSlice($queryBuilder, $limit, $offset, $lastSlice) diff --git a/Doctrine/MongoDB/SliceFetcher.php b/Doctrine/MongoDB/SliceFetcher.php index f90783e..4723da6 100644 --- a/Doctrine/MongoDB/SliceFetcher.php +++ b/Doctrine/MongoDB/SliceFetcher.php @@ -7,7 +7,7 @@ use FOS\ElasticaBundle\Exception\InvalidArgumentTypeException; use FOS\ElasticaBundle\Doctrine\SliceFetcherInterface; /** - * Fetches a slice of objects + * Fetches a slice of objects. * * @author Thomas Prelot */ diff --git a/Doctrine/ORM/SliceFetcher.php b/Doctrine/ORM/SliceFetcher.php index d7f81e1..86ad1b4 100644 --- a/Doctrine/ORM/SliceFetcher.php +++ b/Doctrine/ORM/SliceFetcher.php @@ -7,7 +7,7 @@ use FOS\ElasticaBundle\Exception\InvalidArgumentTypeException; use FOS\ElasticaBundle\Doctrine\SliceFetcherInterface; /** - * Fetches a slice of objects + * Fetches a slice of objects. * * @author Thomas Prelot */ @@ -22,7 +22,7 @@ class SliceFetcher implements SliceFetcherInterface throw new InvalidArgumentTypeException($queryBuilder, 'Doctrine\ORM\QueryBuilder'); } - /** + /* * 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://www.postgresql.org/docs/current/static/queries-limit.html @@ -31,7 +31,7 @@ class SliceFetcher implements SliceFetcherInterface $orderBy = $queryBuilder->getDQLPart('orderBy'); if (empty($orderBy)) { $rootAliases = $queryBuilder->getRootAliases(); - + foreach ($identifierFieldNames as $fieldName) { $queryBuilder->addOrderBy($rootAliases[0].'.'.$fieldName); } diff --git a/Doctrine/SliceFetcherInterface.php b/Doctrine/SliceFetcherInterface.php index 9df7152..a028abf 100644 --- a/Doctrine/SliceFetcherInterface.php +++ b/Doctrine/SliceFetcherInterface.php @@ -3,7 +3,7 @@ namespace FOS\ElasticaBundle\Doctrine; /** - * Fetches a slice of objects + * Fetches a slice of objects. * * @author Thomas Prelot */ @@ -17,7 +17,8 @@ interface SliceFetcherInterface * @param integer $offset * @param array $previousSlice * @param array $identifierFieldNames + * * @return array */ - function fetch($queryBuilder, $limit, $offset, array $previousSlice, array $identifierFieldNames); + public function fetch($queryBuilder, $limit, $offset, array $previousSlice, array $identifierFieldNames); } diff --git a/Event/IndexPopulateEvent.php b/Event/IndexPopulateEvent.php index 56b1e83..ab61f0a 100644 --- a/Event/IndexPopulateEvent.php +++ b/Event/IndexPopulateEvent.php @@ -14,7 +14,7 @@ namespace FOS\ElasticaBundle\Event; use Symfony\Component\EventDispatcher\Event; /** - * Index Populate Event + * Index Populate Event. * * @author Oleg Andreyev */ @@ -39,9 +39,9 @@ class IndexPopulateEvent extends Event private $options; /** - * @param string $index - * @param boolean $reset - * @param array $options + * @param string $index + * @param boolean $reset + * @param array $options */ public function __construct($index, $reset, $options) { diff --git a/Event/IndexResetEvent.php b/Event/IndexResetEvent.php index 0caf241..3fb3625 100644 --- a/Event/IndexResetEvent.php +++ b/Event/IndexResetEvent.php @@ -14,7 +14,7 @@ namespace FOS\ElasticaBundle\Event; use Symfony\Component\EventDispatcher\Event; /** - * Index ResetEvent + * Index ResetEvent. * * @author Oleg Andreyev */ diff --git a/Event/TypePopulateEvent.php b/Event/TypePopulateEvent.php index e04bdd8..dd744f5 100644 --- a/Event/TypePopulateEvent.php +++ b/Event/TypePopulateEvent.php @@ -14,7 +14,7 @@ namespace FOS\ElasticaBundle\Event; use Symfony\Component\EventDispatcher\Event; /** - * Type Populate Event + * Type Populate Event. * * @author Oleg Andreyev */ @@ -31,8 +31,8 @@ class TypePopulateEvent extends IndexPopulateEvent /** * @param string $index * @param string $type - * @param bool $reset - * @param array $options + * @param bool $reset + * @param array $options */ public function __construct($index, $type, $reset, $options) { diff --git a/Event/TypeResetEvent.php b/Event/TypeResetEvent.php index 37c2cf8..0b21a06 100644 --- a/Event/TypeResetEvent.php +++ b/Event/TypeResetEvent.php @@ -14,7 +14,7 @@ namespace FOS\ElasticaBundle\Event; use Symfony\Component\EventDispatcher\Event; /** - * Type ResetEvent + * Type ResetEvent. * * @author Oleg Andreyev */ diff --git a/Paginator/FantaPaginatorAdapter.php b/Paginator/FantaPaginatorAdapter.php index 60e46bf..8f9a60a 100644 --- a/Paginator/FantaPaginatorAdapter.php +++ b/Paginator/FantaPaginatorAdapter.php @@ -35,9 +35,9 @@ class FantaPaginatorAdapter implements AdapterInterface { return $this->adapter->getFacets(); } - + /** - * Returns Aggregations + * Returns Aggregations. * * @return mixed * diff --git a/Paginator/PaginatorAdapterInterface.php b/Paginator/PaginatorAdapterInterface.php index 47f7f53..adf7df2 100644 --- a/Paginator/PaginatorAdapterInterface.php +++ b/Paginator/PaginatorAdapterInterface.php @@ -27,9 +27,9 @@ interface PaginatorAdapterInterface * @return mixed */ public function getFacets(); - + /** - * Returns Aggregations + * Returns Aggregations. * * @return mixed */ diff --git a/Paginator/PartialResultsInterface.php b/Paginator/PartialResultsInterface.php index f8434cc..156d27f 100644 --- a/Paginator/PartialResultsInterface.php +++ b/Paginator/PartialResultsInterface.php @@ -24,9 +24,9 @@ interface PartialResultsInterface * @return array */ public function getFacets(); - + /** - * Returns the aggregations + * Returns the aggregations. * * @return array */ diff --git a/Paginator/RawPaginatorAdapter.php b/Paginator/RawPaginatorAdapter.php index dd3acee..4dfb32a 100644 --- a/Paginator/RawPaginatorAdapter.php +++ b/Paginator/RawPaginatorAdapter.php @@ -36,7 +36,7 @@ class RawPaginatorAdapter implements PaginatorAdapterInterface * @var array for the facets */ private $facets; - + /** * @var array for the aggregations */ @@ -110,9 +110,12 @@ class RawPaginatorAdapter implements PaginatorAdapterInterface /** * Returns the number of results. * - * @param boolean $genuineTotal make the function return the `hits.total` - * value of the search result in all cases, instead of limiting it to the - * `size` request parameter. + * If genuineTotal is provided as true, total hits is returned from the + * hits.total value from the search results instead of just returning + * the requested size. + * + * @param boolean $genuineTotal + * * @return integer The number of results. */ public function getTotalHits($genuineTotal = false) @@ -139,13 +142,14 @@ class RawPaginatorAdapter implements PaginatorAdapterInterface return $this->facets; } - + /** - * Returns Aggregations + * Returns Aggregations. * * @return mixed */ - public function getAggregations() { + public function getAggregations() + { if (!isset($this->aggregations)) { $this->aggregations = $this->searchable->search($this->query)->getAggregations(); } diff --git a/Persister/ObjectPersisterInterface.php b/Persister/ObjectPersisterInterface.php index e9df2b2..9163320 100644 --- a/Persister/ObjectPersisterInterface.php +++ b/Persister/ObjectPersisterInterface.php @@ -71,6 +71,7 @@ interface ObjectPersisterInterface * If the object persister handles the given object. * * @param object $object + * * @return bool */ public function handlesObject($object); diff --git a/Provider/AbstractProvider.php b/Provider/AbstractProvider.php index 6de96ca..05fa525 100644 --- a/Provider/AbstractProvider.php +++ b/Provider/AbstractProvider.php @@ -72,6 +72,7 @@ abstract class AbstractProvider implements ProviderInterface * Get string with RAM usage information (current and peak). * * @deprecated To be removed in 4.0 + * * @return string */ protected function getMemoryUsage() diff --git a/Resources/config/orm.xml b/Resources/config/orm.xml index 19a2bf5..4172500 100644 --- a/Resources/config/orm.xml +++ b/Resources/config/orm.xml @@ -11,7 +11,7 @@ FOS\ElasticaBundle\Doctrine\ORM\ElasticaToModelTransformer FOS\ElasticaBundle\Doctrine\RepositoryManager - + diff --git a/Tests/RepositoryTest.php b/Tests/RepositoryTest.php index 2d5bc66..3f0509a 100644 --- a/Tests/RepositoryTest.php +++ b/Tests/RepositoryTest.php @@ -57,8 +57,9 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase /** * @param string $testQuery - * @param int $testLimit + * @param int $testLimit * @param string $method + * * @return \FOS\ElasticaBundle\Finder\TransformedFinder|\PHPUnit_Framework_MockObject_MockObject */ private function getFinderMock($testQuery, $testLimit = null, $method = 'find') diff --git a/Tests/Transformer/ModelToElasticaAutoTransformerTest.php b/Tests/Transformer/ModelToElasticaAutoTransformerTest.php index 6148749..8d07aeb 100644 --- a/Tests/Transformer/ModelToElasticaAutoTransformerTest.php +++ b/Tests/Transformer/ModelToElasticaAutoTransformerTest.php @@ -411,6 +411,7 @@ class ModelToElasticaAutoTransformerTest extends \PHPUnit_Framework_TestCase /** * @param null|\Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher + * * @return ModelToElasticaAutoTransformer */ private function getTransformer($dispatcher = null) diff --git a/Transformer/ModelToElasticaAutoTransformer.php b/Transformer/ModelToElasticaAutoTransformer.php index 8884e62..6452a1f 100644 --- a/Transformer/ModelToElasticaAutoTransformer.php +++ b/Transformer/ModelToElasticaAutoTransformer.php @@ -38,7 +38,7 @@ class ModelToElasticaAutoTransformer implements ModelToElasticaTransformerInterf /** * Instanciates a new Mapper. * - * @param array $options + * @param array $options * @param EventDispatcherInterface $dispatcher */ public function __construct(array $options = array(), EventDispatcherInterface $dispatcher = null)