Fix CS from scrutiniser-ci

This commit is contained in:
Tim Nagel 2014-08-24 19:50:56 +10:00
parent c4210a5c6d
commit 1d5fe44ca4
17 changed files with 75 additions and 22 deletions

View file

@ -77,6 +77,9 @@ class TypeConfig
return $this->getConfig('search_analyzer');
}
/**
* @param string $key
*/
private function getConfig($key)
{
return isset($this->config[$key]) ?

View file

@ -30,7 +30,7 @@ class Configuration implements ConfigurationInterface
/**
* Generates the configuration tree.
*
* @return \Symfony\Component\Config\Definition\NodeInterface
* @return TreeBuilder
*/
public function getConfigTreeBuilder()
{

View file

@ -82,7 +82,7 @@ class FOSElasticaExtension extends Extension
/**
* @param array $config
* @param ContainerBuilder $container
* @return Configuration|null|\Symfony\Component\Config\Definition\ConfigurationInterface
* @return Configuration
*/
public function getConfiguration(array $config, ContainerBuilder $container)
{
@ -523,7 +523,7 @@ class FOSElasticaExtension extends Extension
*
* @param array $typeConfig
* @param ContainerBuilder $container
* @param $elasticaToModelId
* @param string $elasticaToModelId
* @param Reference $typeRef
* @param string $indexName
* @param string $typeName

View file

@ -174,27 +174,30 @@ class Listener implements EventSubscriber
}
/**
* Iterate through scheduled actions before flushing to emulate 2.x behavior. Note that the ElasticSearch index
* will fall out of sync with the source data in the event of a crash during flush.
* Iterate through scheduled actions before flushing to emulate 2.x behavior.
* Note that the ElasticSearch index will fall out of sync with the source
* data in the event of a crash during flush.
*
* This method is only called in legacy configurations of the listener.
*/
public function preFlush(EventArgs $eventArgs)
public function preFlush()
{
$this->persistScheduled();
}
/**
* Iterating through scheduled actions *after* flushing ensures that the ElasticSearch index will be affected
* only if the query is successful
* Iterating through scheduled actions *after* flushing ensures that the
* ElasticSearch index will be affected only if the query is successful.
*/
public function postFlush(EventArgs $eventArgs)
public function postFlush()
{
$this->persistScheduled();
}
/**
* Record the specified identifier to delete. Do not need to entire object.
* @param mixed $object
* @return mixed
*
* @param object $object
*/
protected function scheduleForDeletion($object)
{

View file

@ -3,7 +3,6 @@
namespace FOS\ElasticaBundle\Doctrine\ORM;
use Doctrine\ORM\QueryBuilder;
use Elastica\Exception\Bulk\ResponseException as BulkResponseException;
use FOS\ElasticaBundle\Doctrine\AbstractProvider;
use FOS\ElasticaBundle\Exception\InvalidArgumentTypeException;

View file

@ -3,7 +3,6 @@
namespace FOS\ElasticaBundle\Elastica;
use Elastica\Index as BaseIndex;
use Elastica\Type;
/**
* Overridden Elastica Index class that provides dynamic index name changes.
@ -32,6 +31,9 @@ class Index extends BaseIndex
return $this->originalName ?: $this->_name;
}
/**
* @param string $type
*/
public function getType($type)
{
if (isset($this->typeCache[$type])) {

View file

@ -5,9 +5,7 @@ namespace FOS\ElasticaBundle\Index;
use Elastica\Index;
use Elastica\Exception\ResponseException;
use Elastica\Type\Mapping;
use FOS\ElasticaBundle\Configuration\IndexConfig;
use FOS\ElasticaBundle\Configuration\ConfigManager;
use FOS\ElasticaBundle\Elastica\Client;
/**
* Deletes and recreates indexes
@ -110,7 +108,7 @@ class Resetter
/**
* A command run when a population has finished.
*
* @param $indexName
* @param string $indexName
*/
public function postPopulate($indexName)
{

View file

@ -69,6 +69,9 @@ class RepositoryManager implements RepositoryManagerInterface
return 'FOS\ElasticaBundle\Repository';
}
/**
* @param string $entityName
*/
private function createRepository($entityName)
{
if (!class_exists($repositoryName = $this->getRepositoryName($entityName))) {

View file

@ -54,8 +54,8 @@ class RawPaginatorAdapter implements PaginatorAdapterInterface
/**
* Returns the paginated results.
*
* @param $offset
* @param $itemCountPerPage
* @param integer $offset
* @param integer $itemCountPerPage
* @throws \InvalidArgumentException
* @return ResultSet
*/

View file

@ -4,7 +4,6 @@ namespace FOS\ElasticaBundle\Persister;
use Psr\Log\LoggerInterface;
use Elastica\Exception\BulkException;
use Elastica\Exception\NotFoundException;
use FOS\ElasticaBundle\Transformer\ModelToElasticaTransformerInterface;
use Elastica\Type;
use Elastica\Document;

View file

@ -17,6 +17,9 @@ class ObjectSerializerPersister extends ObjectPersister
{
protected $serializer;
/**
* @param string $objectClass
*/
public function __construct(Type $type, ModelToElasticaTransformerInterface $transformer, $objectClass, $serializer)
{
parent::__construct($type, $transformer, $objectClass, array());

View file

@ -170,6 +170,7 @@ class ElasticaToModelTransformer implements ElasticaToModelTransformerInterface
/**
* @see https://github.com/doctrine/common/blob/master/lib/Doctrine/Common/Util/Inflector.php
* @param string $str
*/
private function camelize($str)
{

View file

@ -19,21 +19,43 @@ class Repository
$this->finder = $finder;
}
/**
* @param mixed $query
* @param integer $limit
* @param array $options
* @return array
*/
public function find($query, $limit = null, $options = array())
{
return $this->finder->find($query, $limit, $options);
}
/**
* @param mixed $query
* @param integer $limit
* @param array $options
* @return mixed
*/
public function findHybrid($query, $limit = null, $options = array())
{
return $this->finder->findHybrid($query, $limit, $options);
}
/**
* @param mixed $query
* @param array $options
* @return \Pagerfanta\Pagerfanta
*/
public function findPaginated($query, $options = array())
{
return $this->finder->findPaginated($query, $options);
}
/**
* @param string $query
* @param array $options
* @return Paginator\PaginatorAdapterInterface
*/
public function createPaginatorAdapter($query, $options = array())
{
return $this->finder->createPaginatorAdapter($query, $options);

View file

@ -173,8 +173,14 @@ abstract class ListenerTest extends \PHPUnit_Framework_TestCase
abstract protected function getListenerClass();
/**
* @return string
*/
abstract protected function getObjectManagerClass();
/**
* @return string
*/
abstract protected function getClassMetadataClass();
private function createLifecycleEventArgs()
@ -205,6 +211,11 @@ abstract class ListenerTest extends \PHPUnit_Framework_TestCase
->getMock();
}
/**
* @param Listener\Entity $object
* @param string $indexName
* @param string $typeName
*/
private function getMockPersister($object, $indexName, $typeName)
{
$mock = $this->getMockBuilder('FOS\ElasticaBundle\Persister\ObjectPersister')
@ -235,6 +246,12 @@ abstract class ListenerTest extends \PHPUnit_Framework_TestCase
return $mock;
}
/**
* @param string $indexName
* @param string $typeName
* @param Listener\Entity $object
* @param boolean $return
*/
private function getMockIndexable($indexName, $typeName, $object, $return = null)
{
$mock = $this->getMock('FOS\ElasticaBundle\Provider\IndexableInterface');
@ -256,6 +273,9 @@ class Entity
{
private $id;
/**
* @param integer $id
*/
public function __construct($id)
{
$this->id = $id;

View file

@ -3,7 +3,6 @@
namespace FOS\ElasticaBundle\Tests\Resetter;
use FOS\ElasticaBundle\FOSElasticaBundle;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
class FOSElasticaBundleTest extends \PHPUnit_Framework_TestCase
{

View file

@ -2,9 +2,7 @@
namespace FOS\ElasticaBundle\Tests\ObjectSerializerPersister;
use FOS\ElasticaBundle\Persister\ObjectPersister;
use FOS\ElasticaBundle\Persister\ObjectSerializerPersister;
use FOS\ElasticaBundle\Transformer\ModelToElasticaAutoTransformer;
use FOS\ElasticaBundle\Transformer\ModelToElasticaIdentifierTransformer;
use Symfony\Component\PropertyAccess\PropertyAccess;

View file

@ -157,6 +157,9 @@ class POPO
public $id;
public $data;
/**
* @param integer $id
*/
public function __construct($id, $data)
{
$this->data = $data;