1
0
mirror of synced 2025-02-13 02:39:25 +03:00

Fixed many small phpcs issues

This commit is contained in:
Jeroen Thora 2014-12-19 22:27:26 +01:00 committed by Marco Pivetta
parent 3971e8c55b
commit 6dcb97a20e
80 changed files with 358 additions and 294 deletions

View File

@ -178,7 +178,6 @@ abstract class AbstractQuery
}
/**
*
* Enable/disable second level query (result) caching for this query.
*
* @param boolean $cacheable
@ -243,7 +242,7 @@ abstract class AbstractQuery
*
* @param integer $lifetime
*
* @return static This query instance.
* @return \Doctrine\ORM\AbstractQuery This query instance.
*/
public function setLifetime($lifetime)
{
@ -263,7 +262,7 @@ abstract class AbstractQuery
/**
* @param integer $cacheMode
*
* @return static This query instance.
* @return \Doctrine\ORM\AbstractQuery This query instance.
*/
public function setCacheMode($cacheMode)
{

View File

@ -58,6 +58,8 @@ class AssociationCacheEntry implements CacheEntry
* This method allow Doctrine\Common\Cache\PhpFileCache compatibility
*
* @param array $values array containing property values
*
* @return AssociationCacheEntry
*/
public static function __set_state(array $values)
{

View File

@ -62,8 +62,9 @@ class CacheException extends ORMException
/**
* @param string $entityName
* @param string $field
*
* @return \Doctrine\ORM\Cache\CacheException
* @return CacheException
*/
public static function nonCacheableEntityAssociation($entityName, $field)
{

View File

@ -50,7 +50,7 @@ class CollectionCacheEntry implements CacheEntry
*
* @param array $values array containing property values
*
* @return self
* @return CollectionCacheEntry
*/
public static function __set_state(array $values)
{

View File

@ -60,6 +60,8 @@ class EntityCacheEntry implements CacheEntry
* This method allow Doctrine\Common\Cache\PhpFileCache compatibility
*
* @param array $values array containing property values
*
* @return EntityCacheEntry
*/
public static function __set_state(array $values)
{

View File

@ -40,6 +40,7 @@ interface CachedEntityPersister extends CachedPersister, EntityPersister
/**
* @param object $entity
* @param \Doctrine\ORM\Cache\EntityCacheKey $key
*
* @return boolean
*/
public function storeEntityCache($entity, EntityCacheKey $key);

View File

@ -54,6 +54,8 @@ class QueryCacheEntry implements CacheEntry
/**
* @param array $values
*
* @return QueryCacheEntry
*/
public static function __set_state(array $values)
{

View File

@ -114,7 +114,7 @@ class FileLockRegion implements ConcurrentRegion
/**
* @param \Doctrine\ORM\Cache\CacheKey $key
*
* return string
* @return string
*/
private function getLockFileName(CacheKey $key)
{
@ -124,7 +124,7 @@ class FileLockRegion implements ConcurrentRegion
/**
* @param string $filename
*
* return string
* @return string
*/
private function getLockContent($filename)
{
@ -134,7 +134,7 @@ class FileLockRegion implements ConcurrentRegion
/**
* @param string $filename
*
* return integer
* @return integer
*/
private function getLockTime($filename)
{
@ -142,7 +142,7 @@ class FileLockRegion implements ConcurrentRegion
}
/**
* {inheritdoc}
* {@inheritdoc}
*/
public function getName()
{
@ -150,7 +150,7 @@ class FileLockRegion implements ConcurrentRegion
}
/**
* {inheritdoc}
* {@inheritdoc}
*/
public function contains(CacheKey $key)
{
@ -162,7 +162,7 @@ class FileLockRegion implements ConcurrentRegion
}
/**
* {inheritdoc}
* {@inheritdoc}
*/
public function get(CacheKey $key)
{
@ -186,7 +186,7 @@ class FileLockRegion implements ConcurrentRegion
}
/**
* {inheritdoc}
* {@inheritdoc}
*/
public function put(CacheKey $key, CacheEntry $entry, Lock $lock = null)
{
@ -198,7 +198,7 @@ class FileLockRegion implements ConcurrentRegion
}
/**
* {inheritdoc}
* {@inheritdoc}
*/
public function evict(CacheKey $key)
{
@ -210,7 +210,7 @@ class FileLockRegion implements ConcurrentRegion
}
/**
* {inheritdoc}
* {@inheritdoc}
*/
public function evictAll()
{
@ -228,7 +228,7 @@ class FileLockRegion implements ConcurrentRegion
}
/**
* {inheritdoc}
* {@inheritdoc}
*/
public function lock(CacheKey $key)
{
@ -248,7 +248,7 @@ class FileLockRegion implements ConcurrentRegion
}
/**
* {inheritdoc}
* {@inheritdoc}
*/
public function unlock(CacheKey $key, Lock $lock)
{

View File

@ -49,6 +49,8 @@ class TimestampCacheEntry implements CacheEntry
* This method allow Doctrine\Common\Cache\PhpFileCache compatibility
*
* @param array $values array containing property values
*
* @return TimestampCacheEntry
*/
public static function __set_state(array $values)
{

View File

@ -36,6 +36,7 @@ class UuidGenerator extends AbstractIdGenerator
{
$conn = $em->getConnection();
$sql = 'SELECT ' . $conn->getDatabasePlatform()->getGuidExpression();
return $conn->query($sql)->fetchColumn(0);
}
}

View File

@ -80,6 +80,7 @@ class IterableResult implements \Iterator
{
$this->_current = $this->_hydrator->hydrateRow();
$this->_key++;
return $this->_current;
}

View File

@ -100,6 +100,7 @@ class LazyCriteriaCollection extends AbstractLazyCollection implements Selectabl
* Do an optimized search of an element
*
* @param object $element
*
* @return bool
*/
public function contains($element)

View File

@ -63,6 +63,7 @@ class AssociationBuilder
public function mappedBy($fieldName)
{
$this->mapping['mappedBy'] = $fieldName;
return $this;
}
@ -74,6 +75,7 @@ class AssociationBuilder
public function inversedBy($fieldName)
{
$this->mapping['inversedBy'] = $fieldName;
return $this;
}
@ -83,6 +85,7 @@ class AssociationBuilder
public function cascadeAll()
{
$this->mapping['cascade'] = array("ALL");
return $this;
}
@ -92,6 +95,7 @@ class AssociationBuilder
public function cascadePersist()
{
$this->mapping['cascade'][] = "persist";
return $this;
}
@ -101,6 +105,7 @@ class AssociationBuilder
public function cascadeRemove()
{
$this->mapping['cascade'][] = "remove";
return $this;
}
@ -110,6 +115,7 @@ class AssociationBuilder
public function cascadeMerge()
{
$this->mapping['cascade'][] = "merge";
return $this;
}
@ -119,6 +125,7 @@ class AssociationBuilder
public function cascadeDetach()
{
$this->mapping['cascade'][] = "detach";
return $this;
}
@ -128,6 +135,7 @@ class AssociationBuilder
public function cascadeRefresh()
{
$this->mapping['cascade'][] = "refresh";
return $this;
}
@ -137,6 +145,7 @@ class AssociationBuilder
public function fetchExtraLazy()
{
$this->mapping['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY;
return $this;
}
@ -146,6 +155,7 @@ class AssociationBuilder
public function fetchEager()
{
$this->mapping['fetch'] = ClassMetadata::FETCH_EAGER;
return $this;
}
@ -155,6 +165,7 @@ class AssociationBuilder
public function fetchLazy()
{
$this->mapping['fetch'] = ClassMetadata::FETCH_LAZY;
return $this;
}
@ -180,6 +191,7 @@ class AssociationBuilder
'onDelete' => $onDelete,
'columnDefinition' => $columnDef,
);
return $this;
}
@ -226,6 +238,7 @@ class AssociationBuilder
} else {
throw new \InvalidArgumentException("Type should be a ToOne Association here");
}
return $this->builder;
}
}

View File

@ -79,6 +79,7 @@ class FieldBuilder
public function length($length)
{
$this->mapping['length'] = $length;
return $this;
}
@ -92,6 +93,7 @@ class FieldBuilder
public function nullable($flag = true)
{
$this->mapping['nullable'] = (bool) $flag;
return $this;
}
@ -105,6 +107,7 @@ class FieldBuilder
public function unique($flag = true)
{
$this->mapping['unique'] = (bool) $flag;
return $this;
}
@ -118,6 +121,7 @@ class FieldBuilder
public function columnName($name)
{
$this->mapping['columnName'] = $name;
return $this;
}
@ -131,6 +135,7 @@ class FieldBuilder
public function precision($p)
{
$this->mapping['precision'] = $p;
return $this;
}
@ -144,6 +149,7 @@ class FieldBuilder
public function scale($s)
{
$this->mapping['scale'] = $s;
return $this;
}
@ -166,6 +172,7 @@ class FieldBuilder
public function makePrimaryKey()
{
$this->mapping['id'] = true;
return $this;
}
@ -180,6 +187,7 @@ class FieldBuilder
public function option($name, $value)
{
$this->mapping['options'][$name] = $value;
return $this;
}
@ -191,6 +199,7 @@ class FieldBuilder
public function generatedValue($strategy = 'AUTO')
{
$this->generatedValue = $strategy;
return $this;
}
@ -202,6 +211,7 @@ class FieldBuilder
public function isVersionField()
{
$this->version = true;
return $this;
}
@ -221,6 +231,7 @@ class FieldBuilder
'allocationSize' => $allocationSize,
'initialValue' => $initialValue,
);
return $this;
}
@ -234,6 +245,7 @@ class FieldBuilder
public function columnDefinition($def)
{
$this->mapping['columnDefinition'] = $def;
return $this;
}

View File

@ -47,6 +47,7 @@ class ManyToManyAssociationBuilder extends OneToManyAssociationBuilder
public function setJoinTable($name)
{
$this->joinTableName = $name;
return $this;
}
@ -72,6 +73,7 @@ class ManyToManyAssociationBuilder extends OneToManyAssociationBuilder
'onDelete' => $onDelete,
'columnDefinition' => $columnDef,
);
return $this;
}
@ -93,6 +95,7 @@ class ManyToManyAssociationBuilder extends OneToManyAssociationBuilder
}
$cm = $this->builder->getClassMetadata();
$cm->mapManyToMany($mapping);
return $this->builder;
}
}

View File

@ -37,6 +37,7 @@ class OneToManyAssociationBuilder extends AssociationBuilder
public function setOrderBy(array $fieldNames)
{
$this->mapping['orderBy'] = $fieldNames;
return $this;
}
@ -48,6 +49,7 @@ class OneToManyAssociationBuilder extends AssociationBuilder
public function setIndexBy($fieldName)
{
$this->mapping['indexBy'] = $fieldName;
return $this;
}
@ -62,6 +64,7 @@ class OneToManyAssociationBuilder extends AssociationBuilder
}
$cm = $this->builder->getClassMetadata();
$cm->mapOneToMany($mapping);
return $this->builder;
}
}

View File

@ -386,6 +386,7 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
}
$parts = explode("\\", $className);
return strtolower(end($parts));
}

View File

@ -698,6 +698,7 @@ class ClassMetadataInfo implements ClassMetadata
if ($this->isIdentifierComposite) {
throw new BadMethodCallException("Class " . $this->name . " has a composite identifier.");
}
return $this->reflFields[$this->identifier[0]];
}
@ -3248,6 +3249,7 @@ class ClassMetadataInfo implements ClassMetadata
/**
* @param string|null $className
*
* @return string|null null if the input value is null
*/
public function fullyQualifiedClassName($className)
@ -3268,7 +3270,8 @@ class ClassMetadataInfo implements ClassMetadata
*
* @return mixed
*/
public function getMetadataValue($name) {
public function getMetadataValue($name)
{
if (isset($this->$name)) {
return $this->$name;
@ -3281,6 +3284,7 @@ class ClassMetadataInfo implements ClassMetadata
* Map Embedded Class
*
* @param array $mapping
*
* @throws MappingException
* @return void
*/

View File

@ -550,6 +550,7 @@ class DatabaseDriver implements MappingDriver
if ($fk) {
$columnName = str_replace('_id', '', $columnName);
}
return Inflector::camelize($columnName);
}
}

View File

@ -808,6 +808,7 @@ class XmlDriver extends FileDriver
// anything about the supported cascading actions
$cascades[] = str_replace('cascade-', '', $action->getName());
}
return $cascades;
}

View File

@ -772,6 +772,7 @@ class MappingException extends \Doctrine\ORM\ORMException
public static function invalidCascadeOption(array $cascades, $className, $propertyName)
{
$cascades = implode(", ", array_map(function ($e) { return "'" . $e . "'"; }, $cascades));
return new self(sprintf(
"You have specified invalid cascade options for %s::$%s: %s; available options: 'remove', 'persist', 'refresh', 'merge', and 'detach'",
$className,

View File

@ -95,9 +95,7 @@ class ORMInvalidArgumentException extends \InvalidArgumentException
. " To solve this issue: Either explicitly call EntityManager#persist()"
. " on this unknown entity or configure cascade persist "
. " this association in the mapping for example @ManyToOne(..,cascade={\"persist\"})."
. (method_exists($entry, '__toString') ?
"":
" If you cannot find out which entity causes the problem"
. (method_exists($entry, '__toString') ? "": " If you cannot find out which entity causes the problem"
. " implement '" . $assoc['targetEntity'] . "#__toString()' to get a clue."));
}

View File

@ -75,6 +75,7 @@ class OptimisticLockException extends ORMException
{
$expectedLockVersion = ($expectedLockVersion instanceof \DateTime) ? $expectedLockVersion->getTimestamp() : $expectedLockVersion;
$actualLockVersion = ($actualLockVersion instanceof \DateTime) ? $actualLockVersion->getTimestamp() : $actualLockVersion;
return new self("The optimistic lock failed, version " . $expectedLockVersion . " was expected, but is actually ".$actualLockVersion, $entity);
}

View File

@ -2047,6 +2047,7 @@ class BasicEntityPersister implements EntityPersister
}
$sql = implode(' AND ', $filterClauses);
return $sql ? "(" . $sql . ")" : ""; // Wrap again to avoid "X or Y and FilterConditionSQL"
}

View File

@ -78,6 +78,7 @@ interface EntityPersister
* Get the COUNT SQL to count entities (optionally based on a criteria)
*
* @param array|\Doctrine\Common\Collections\Criteria $criteria
*
* @return string
*/
public function getCountSQL($criteria = array());

View File

@ -590,6 +590,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
/**
* @param string $baseTableAlias
*
* @return string
*/
private function getJoinSql($baseTableAlias)

View File

@ -40,6 +40,7 @@ class BitAndFunction extends FunctionNode
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{
$platform = $sqlWalker->getConnection()->getDatabasePlatform();
return $platform->getBitAndComparisonExpression(
$this->firstArithmetic->dispatch($sqlWalker),
$this->secondArithmetic->dispatch($sqlWalker)

View File

@ -40,6 +40,7 @@ class BitOrFunction extends FunctionNode
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{
$platform = $sqlWalker->getConnection()->getDatabasePlatform();
return $platform->getBitOrComparisonExpression(
$this->firstArithmetic->dispatch($sqlWalker),
$this->secondArithmetic->dispatch($sqlWalker)

View File

@ -105,8 +105,6 @@ class TrimFunction extends FunctionNode
}
/**
* @param \Doctrine\ORM\Query\Parser $parser
*
* @return integer
*/
private function getTrimMode()

View File

@ -449,6 +449,7 @@ class Expr
}
}
}
return new Expr\Func($x . ' IN', (array) $y);
}
@ -469,6 +470,7 @@ class Expr
}
}
}
return new Expr\Func($x . ' NOT IN', (array) $y);
}
@ -550,6 +552,7 @@ class Expr
if (null !== $len) {
$args[] = $len;
}
return new Expr\Func('SUBSTRING', $args);
}

View File

@ -125,7 +125,7 @@ class Lexer extends \Doctrine\Common\Lexer
}
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function getCatchablePatterns()
{
@ -139,7 +139,7 @@ class Lexer extends \Doctrine\Common\Lexer
}
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function getNonCatchablePatterns()
{
@ -147,7 +147,7 @@ class Lexer extends \Doctrine\Common\Lexer
}
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function getType(&$value)
{

View File

@ -1611,7 +1611,6 @@ class Parser
}
/**
*
* SubselectIdentificationVariableDeclaration ::= IdentificationVariableDeclaration
*
* {Internal note: WARNING: Solution is harder than a bare implementation.
@ -1963,7 +1962,6 @@ class Parser
case $this->isMathOperator($peek):
// :param + u.value
return $this->SimpleArithmeticExpression();
default:
return $this->InputParameter();
}
@ -2669,22 +2667,22 @@ class Parser
switch ($this->lexer->lookahead['type']) {
case Lexer::T_STRING:
$this->match(Lexer::T_STRING);
return new AST\Literal(AST\Literal::STRING, $this->lexer->token['value']);
return new AST\Literal(AST\Literal::STRING, $this->lexer->token['value']);
case Lexer::T_INTEGER:
case Lexer::T_FLOAT:
$this->match(
$this->lexer->isNextToken(Lexer::T_INTEGER) ? Lexer::T_INTEGER : Lexer::T_FLOAT
);
return new AST\Literal(AST\Literal::NUMERIC, $this->lexer->token['value']);
return new AST\Literal(AST\Literal::NUMERIC, $this->lexer->token['value']);
case Lexer::T_TRUE:
case Lexer::T_FALSE:
$this->match(
$this->lexer->isNextToken(Lexer::T_TRUE) ? Lexer::T_TRUE : Lexer::T_FALSE
);
return new AST\Literal(AST\Literal::BOOLEAN, $this->lexer->token['value']);
return new AST\Literal(AST\Literal::BOOLEAN, $this->lexer->token['value']);
default:
$this->syntaxError('Literal');
}

View File

@ -160,36 +160,37 @@ class QueryExpressionVisitor extends ExpressionVisitor
switch ($comparison->getOperator()) {
case Comparison::IN:
$this->parameters[] = $parameter;
return $this->expr->in($field, $placeholder);
return $this->expr->in($field, $placeholder);
case Comparison::NIN:
$this->parameters[] = $parameter;
return $this->expr->notIn($field, $placeholder);
return $this->expr->notIn($field, $placeholder);
case Comparison::EQ:
case Comparison::IS:
if ($this->walkValue($comparison->getValue()) === null) {
return $this->expr->isNull($field);
}
$this->parameters[] = $parameter;
return $this->expr->eq($field, $placeholder);
return $this->expr->eq($field, $placeholder);
case Comparison::NEQ:
if ($this->walkValue($comparison->getValue()) === null) {
return $this->expr->isNotNull($field);
}
$this->parameters[] = $parameter;
return $this->expr->neq($field, $placeholder);
return $this->expr->neq($field, $placeholder);
case Comparison::CONTAINS:
$parameter->setValue('%' . $parameter->getValue() . '%', $parameter->getType());
$this->parameters[] = $parameter;
return $this->expr->like($field, $placeholder);
return $this->expr->like($field, $placeholder);
default:
$operator = self::convertComparisonOperator($comparison->getOperator());
if ($operator) {
$this->parameters[] = $parameter;
return new Expr\Comparison(
$field,
$operator,

View File

@ -336,7 +336,7 @@ abstract class TreeWalkerAdapter implements TreeWalker
/**
* {@inheritdoc}
*/
function walkInstanceOfExpression($instanceOfExpr)
public function walkInstanceOfExpression($instanceOfExpr)
{
}

View File

@ -429,7 +429,7 @@ class TreeWalkerChain implements TreeWalker
/**
* {@inheritdoc}
*/
function walkInstanceOfExpression($instanceOfExpr)
public function walkInstanceOfExpression($instanceOfExpr)
{
foreach ($this->_walkers as $walker) {
$walker->walkInstanceOfExpression($instanceOfExpr);

View File

@ -51,7 +51,7 @@ class TreeWalkerChainIterator implements \Iterator, \ArrayAccess
/**
* {@inheritdoc}
*/
function rewind()
public function rewind()
{
return reset($this->walkers);
}
@ -59,7 +59,7 @@ class TreeWalkerChainIterator implements \Iterator, \ArrayAccess
/**
* {@inheritdoc}
*/
function current()
public function current()
{
return $this->offsetGet(key($this->walkers));
}
@ -67,7 +67,7 @@ class TreeWalkerChainIterator implements \Iterator, \ArrayAccess
/**
* {@inheritdoc}
*/
function key()
public function key()
{
return key($this->walkers);
}
@ -75,7 +75,7 @@ class TreeWalkerChainIterator implements \Iterator, \ArrayAccess
/**
* {@inheritdoc}
*/
function next()
public function next()
{
next($this->walkers);
@ -85,7 +85,7 @@ class TreeWalkerChainIterator implements \Iterator, \ArrayAccess
/**
* {@inheritdoc}
*/
function valid()
public function valid()
{
return key($this->walkers) !== null;
}

View File

@ -41,7 +41,7 @@ class AttachEntityListenersListener
* @param string $entityClass The entity to attach the listener.
* @param string $listenerClass The listener class.
* @param string $eventName The entity lifecycle event.
* @param string $listenerCallback|null The listener callback method or NULL to use $eventName.
* @param string|null $listenerCallback The listener callback method or NULL to use $eventName.
*
* @return void
*/

View File

@ -257,7 +257,7 @@ EOT
/**
* Format the association mappings
*
* @param array
* @param array $propertyMappings
*
* @return array
*/

View File

@ -65,6 +65,7 @@ abstract class AbstractCommand extends Command
return $this->executeSchemaCommand($input, $output, $tool, $metadatas);
} else {
$output->writeln('No Metadata Classes to process.');
return 0;
}
}

View File

@ -81,6 +81,7 @@ class DebugUnitOfWorkListener
$fh = fopen($this->file, "x+");
if (count($identityMap) == 0) {
fwrite($fh, "Flush Operation [".$this->context."] - Empty identity map.\n");
return;
}

View File

@ -1100,6 +1100,7 @@ public function __construct(<params>)
}
$annotations[] = '@' . $this->annotationsPrefix . $constraintName . '(name="' . $name . '", columns={' . implode(', ', $columns) . '})';
}
return implode(', ', $annotations);
}
@ -1811,6 +1812,8 @@ public function __construct(<params>)
* Exports (nested) option elements.
*
* @param array $options
*
* @return string
*/
private function exportTableOptions(array $options)
{

View File

@ -110,6 +110,7 @@ class Paginator implements \Countable, \IteratorAggregate
public function setUseOutputWalkers($useOutputWalkers)
{
$this->useOutputWalkers = $useOutputWalkers;
return $this;
}

View File

@ -109,6 +109,7 @@ class SchemaTool
public function getCreateSchemaSql(array $classes)
{
$schema = $this->getSchemaFromMetadata($classes);
return $schema->toSql($this->platform);
}
@ -622,7 +623,8 @@ class SchemaTool
&$primaryKeyColumns,
&$addedFks,
&$blacklistedFks
) {
)
{
$localColumns = array();
$foreignColumns = array();
$fkOptions = array();

View File

@ -97,6 +97,7 @@ class SchemaValidator
foreach ($class->associationMappings as $fieldName => $assoc) {
if (!class_exists($assoc['targetEntity']) || $cmf->isTransient($assoc['targetEntity'])) {
$ce[] = "The target entity '" . $assoc['targetEntity'] . "' specified on " . $class->name . '#' . $fieldName . ' is unknown or not an entity.';
return $ce;
}