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;
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)
{

View file

@ -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)

View file

@ -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('<error>%s</error>', $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)

View file

@ -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 <tprelot@gmail.com>
*/

View file

@ -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 <tprelot@gmail.com>
*/
@ -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);
}

View file

@ -3,7 +3,7 @@
namespace FOS\ElasticaBundle\Doctrine;
/**
* Fetches a slice of objects
* Fetches a slice of objects.
*
* @author Thomas Prelot <tprelot@gmail.com>
*/
@ -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);
}

View file

@ -14,7 +14,7 @@ namespace FOS\ElasticaBundle\Event;
use Symfony\Component\EventDispatcher\Event;
/**
* Index Populate Event
* Index Populate Event.
*
* @author Oleg Andreyev <oleg.andreyev@intexsys.lv>
*/
@ -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)
{

View file

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

View file

@ -14,7 +14,7 @@ namespace FOS\ElasticaBundle\Event;
use Symfony\Component\EventDispatcher\Event;
/**
* Type Populate Event
* Type Populate Event.
*
* @author Oleg Andreyev <oleg.andreyev@intexsys.lv>
*/
@ -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)
{

View file

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

View file

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

View file

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

View file

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

View file

@ -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();
}

View file

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

View file

@ -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()

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.manager.orm.class">FOS\ElasticaBundle\Doctrine\RepositoryManager</parameter>
</parameters>
<services>
<service id="fos_elastica.slice_fetcher.orm" class="%fos_elastica.slice_fetcher.orm.class%">
</service>

View file

@ -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')

View file

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

View file

@ -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)