1
0
mirror of synced 2025-02-02 21:41:45 +03:00

Use short-array syntax on "lib" directory

This commit is contained in:
Luís Cobucci 2016-12-08 00:31:12 +01:00
parent c609072ce1
commit 234989d069
No known key found for this signature in database
GPG Key ID: 8042585A7DBC92E1
139 changed files with 1532 additions and 1445 deletions

View File

@ -96,7 +96,7 @@ abstract class AbstractQuery
*
* @var array
*/
protected $_hints = array();
protected $_hints = [];
/**
* The hydration mode.
@ -955,7 +955,7 @@ abstract class AbstractQuery
}
if ( ! $result) {
$result = array();
$result = [];
}
$setCacheEntry = function($data) use ($cache, $result, $cacheKey, $realCacheKey, $queryCacheProfile) {
@ -1049,7 +1049,7 @@ abstract class AbstractQuery
*/
protected function getHydrationCacheId()
{
$parameters = array();
$parameters = [];
foreach ($this->getParameters() as $parameter) {
$parameters[$parameter->getName()] = $this->processParameterValue($parameter->getValue());
@ -1111,7 +1111,7 @@ abstract class AbstractQuery
{
$this->parameters = new ArrayCollection();
$this->_hints = array();
$this->_hints = [];
$this->_hints = $this->_em->getConfiguration()->getDefaultQueryHints();
}

View File

@ -53,7 +53,7 @@ class DefaultCache implements Cache
/**
* @var \Doctrine\ORM\Cache\QueryCache[]
*/
private $queryCaches = array();
private $queryCaches = [];
/**
* @var \Doctrine\ORM\Cache\QueryCache
@ -336,7 +336,7 @@ class DefaultCache implements Cache
}
}
return array($metadata->identifier[0] => $identifier);
return [$metadata->identifier[0] => $identifier];
}
}

View File

@ -64,7 +64,7 @@ class DefaultCacheFactory implements CacheFactory
/**
* @var \Doctrine\ORM\Cache\Region[]
*/
private $regions = array();
private $regions = [];
/**
* @var string|null
@ -167,10 +167,10 @@ class DefaultCacheFactory implements CacheFactory
return new DefaultQueryCache(
$em,
$this->getRegion(
array(
[
'region' => $regionName ?: Cache::DEFAULT_QUERY_REGION_NAME,
'usage' => ClassMetadata::CACHE_USAGE_NONSTRICT_READ_WRITE
)
]
)
);
}

View File

@ -46,7 +46,7 @@ class DefaultCollectionHydrator implements CollectionHydrator
/**
* @var array
*/
private static $hints = array(Query::HINT_CACHE_ENABLED => true);
private static $hints = [Query::HINT_CACHE_ENABLED => true];
/**
* @param \Doctrine\ORM\EntityManagerInterface $em The entity manager.
@ -62,7 +62,7 @@ class DefaultCollectionHydrator implements CollectionHydrator
*/
public function buildCacheEntry(ClassMetadata $metadata, CollectionCacheKey $key, $collection)
{
$data = array();
$data = [];
foreach ($collection as $index => $entity) {
$data[$index] = new EntityCacheKey($metadata->name, $this->uow->getEntityIdentifier($entity));
@ -79,7 +79,7 @@ class DefaultCollectionHydrator implements CollectionHydrator
/* @var $targetPersister \Doctrine\ORM\Cache\Persister\CachedPersister */
$targetPersister = $this->uow->getEntityPersister($assoc['targetEntity']);
$targetRegion = $targetPersister->getCacheRegion();
$list = array();
$list = [];
$entityEntries = $targetRegion->getMultiple($entry);

View File

@ -55,7 +55,7 @@ class DefaultEntityHydrator implements EntityHydrator
/**
* @var array
*/
private static $hints = array(Query::HINT_CACHE_ENABLED => true);
private static $hints = [Query::HINT_CACHE_ENABLED => true];
/**
* @param \Doctrine\ORM\EntityManagerInterface $em The entity manager.
@ -138,7 +138,7 @@ class DefaultEntityHydrator implements EntityHydrator
$data[reset($assoc['joinColumnFieldNames'])] = $targetId;
$targetEntity = $this->em->getClassMetadata($assoc['targetEntity']);
$targetId = array($targetEntity->identifier[0] => $targetId);
$targetId = [$targetEntity->identifier[0] => $targetId];
}
$data[$name] = new AssociationCacheEntry($assoc['targetEntity'], $targetId);

View File

@ -66,7 +66,7 @@ class DefaultQueryCache implements QueryCache
/**
* @var array
*/
private static $hints = array(Query::HINT_CACHE_ENABLED => true);
private static $hints = [Query::HINT_CACHE_ENABLED => true];
/**
* @param \Doctrine\ORM\EntityManagerInterface $em The entity manager.
@ -86,7 +86,7 @@ class DefaultQueryCache implements QueryCache
/**
* {@inheritdoc}
*/
public function get(QueryCacheKey $key, ResultSetMapping $rsm, array $hints = array())
public function get(QueryCacheKey $key, ResultSetMapping $rsm, array $hints = [])
{
if ( ! ($key->cacheMode & Cache::MODE_GET)) {
return null;
@ -104,7 +104,7 @@ class DefaultQueryCache implements QueryCache
return null;
}
$result = array();
$result = [];
$entityName = reset($rsm->aliasMap);
$hasRelation = ( ! empty($rsm->relationMap));
$persister = $this->uow->getEntityPersister($entityName);
@ -209,7 +209,7 @@ class DefaultQueryCache implements QueryCache
/**
* {@inheritdoc}
*/
public function put(QueryCacheKey $key, ResultSetMapping $rsm, $result, array $hints = array())
public function put(QueryCacheKey $key, ResultSetMapping $rsm, $result, array $hints = [])
{
if ($rsm->scalarMappings) {
throw new CacheException("Second level cache does not support scalar results.");
@ -231,7 +231,7 @@ class DefaultQueryCache implements QueryCache
return false;
}
$data = array();
$data = [];
$entityName = reset($rsm->aliasMap);
$rootAlias = key($rsm->aliasMap);
$hasRelation = ( ! empty($rsm->relationMap));
@ -247,7 +247,7 @@ class DefaultQueryCache implements QueryCache
$identifier = $this->uow->getEntityIdentifier($entity);
$entityKey = new EntityCacheKey($entityName, $identifier);
$data[$index]['identifier'] = $identifier;
$data[$index]['associations'] = array();
$data[$index]['associations'] = [];
if (($key->cacheMode & Cache::MODE_REFRESH) || ! $region->contains($entityKey)) {
// Cancel put result if entity put fail
@ -332,15 +332,15 @@ class DefaultQueryCache implements QueryCache
}
}
return array(
return [
'targetEntity' => $assocMetadata->rootEntityName,
'identifier' => $assocIdentifier,
'type' => $assoc['type']
);
];
}
// Handle *-to-many associations
$list = array();
$list = [];
foreach ($assocValue as $assocItemIndex => $assocItem) {
$assocIdentifier = $this->uow->getEntityIdentifier($assocItem);
@ -356,11 +356,11 @@ class DefaultQueryCache implements QueryCache
$list[$assocItemIndex] = $assocIdentifier;
}
return array(
return [
'targetEntity' => $assocMetadata->rootEntityName,
'type' => $assoc['type'],
'list' => $list,
);
];
}
/**
@ -372,7 +372,7 @@ class DefaultQueryCache implements QueryCache
*/
private function getAssociationValue(ResultSetMapping $rsm, $assocAlias, $entity)
{
$path = array();
$path = [];
$alias = $assocAlias;
while (isset($rsm->parentAliasMap[$alias])) {
@ -380,10 +380,11 @@ class DefaultQueryCache implements QueryCache
$field = $rsm->relationMap[$alias];
$class = $rsm->aliasMap[$parent];
array_unshift($path, array(
array_unshift($path, [
'field' => $field,
'class' => $class
));
]
);
$alias = $parent;
}
@ -417,7 +418,7 @@ class DefaultQueryCache implements QueryCache
return $this->getAssociationPathValue($value, $path);
}
$values = array();
$values = [];
foreach ($value as $item) {
$values[] = $this->getAssociationPathValue($item, $path);

View File

@ -35,7 +35,7 @@ class CacheLoggerChain implements CacheLogger
/**
* @var array<\Doctrine\ORM\Cache\Logging\CacheLogger>
*/
private $loggers = array();
private $loggers = [];
/**
* @param string $name

View File

@ -35,17 +35,17 @@ class StatisticsCacheLogger implements CacheLogger
/**
* @var array
*/
private $cacheMissCountMap = array();
private $cacheMissCountMap = [];
/**
* @var array
*/
private $cacheHitCountMap = array();
private $cacheHitCountMap = [];
/**
* @var array
*/
private $cachePutCountMap = array();
private $cachePutCountMap = [];
/**
* {@inheritdoc}
@ -214,9 +214,9 @@ class StatisticsCacheLogger implements CacheLogger
*/
public function clearStats()
{
$this->cachePutCountMap = array();
$this->cacheHitCountMap = array();
$this->cacheMissCountMap = array();
$this->cachePutCountMap = [];
$this->cacheHitCountMap = [];
$this->cacheMissCountMap = [];
}
/**

View File

@ -70,7 +70,7 @@ abstract class AbstractCollectionPersister implements CachedCollectionPersister
/**
* @var array
*/
protected $queuedCache = array();
protected $queuedCache = [];
/**
* @var \Doctrine\ORM\Cache\Region

View File

@ -46,7 +46,7 @@ class NonStrictReadWriteCachedCollectionPersister extends AbstractCollectionPers
}
}
$this->queuedCache = array();
$this->queuedCache = [];
}
/**
@ -54,7 +54,7 @@ class NonStrictReadWriteCachedCollectionPersister extends AbstractCollectionPers
*/
public function afterTransactionRolledBack()
{
$this->queuedCache = array();
$this->queuedCache = [];
}
/**
@ -96,9 +96,9 @@ class NonStrictReadWriteCachedCollectionPersister extends AbstractCollectionPers
$this->persister->update($collection);
$this->queuedCache['update'][spl_object_hash($collection)] = array(
$this->queuedCache['update'][spl_object_hash($collection)] = [
'key' => $key,
'list' => $collection
);
];
}
}

View File

@ -60,7 +60,7 @@ class ReadWriteCachedCollectionPersister extends AbstractCollectionPersister
}
}
$this->queuedCache = array();
$this->queuedCache = [];
}
/**
@ -80,7 +80,7 @@ class ReadWriteCachedCollectionPersister extends AbstractCollectionPersister
}
}
$this->queuedCache = array();
$this->queuedCache = [];
}
/**
@ -98,10 +98,10 @@ class ReadWriteCachedCollectionPersister extends AbstractCollectionPersister
return;
}
$this->queuedCache['delete'][spl_object_hash($collection)] = array(
$this->queuedCache['delete'][spl_object_hash($collection)] = [
'key' => $key,
'lock' => $lock
);
];
}
/**
@ -126,9 +126,9 @@ class ReadWriteCachedCollectionPersister extends AbstractCollectionPersister
return;
}
$this->queuedCache['update'][spl_object_hash($collection)] = array(
$this->queuedCache['update'][spl_object_hash($collection)] = [
'key' => $key,
'lock' => $lock
);
];
}
}

View File

@ -64,7 +64,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
/**
* @var array
*/
protected $queuedCache = array();
protected $queuedCache = [];
/**
* @var \Doctrine\ORM\Cache\Region
@ -160,7 +160,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
/**
* {@inheritDoc}
*/
public function getCountSQL($criteria = array())
public function getCountSQL($criteria = [])
{
return $this->persister->getCountSQL($criteria);
}
@ -249,7 +249,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
private function storeJoinedAssociations($entity)
{
if ($this->joinedAssociations === null) {
$associations = array();
$associations = [];
foreach ($this->class->associationMappings as $name => $assoc) {
if (isset($assoc['cache']) &&
@ -360,7 +360,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
/**
* {@inheritdoc}
*/
public function load(array $criteria, $entity = null, $assoc = null, array $hints = array(), $lockMode = null, $limit = null, array $orderBy = null)
public function load(array $criteria, $entity = null, $assoc = null, array $hints = [], $lockMode = null, $limit = null, array $orderBy = null)
{
if ($entity !== null || $assoc !== null || ! empty($hints) || $lockMode !== null) {
return $this->persister->load($criteria, $entity, $assoc, $hints, $lockMode, $limit, $orderBy);
@ -386,7 +386,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
return null;
}
$cached = $queryCache->put($queryKey, $rsm, array($result));
$cached = $queryCache->put($queryKey, $rsm, [$result]);
if ($this->cacheLogger) {
if ($result) {
@ -404,7 +404,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
/**
* {@inheritdoc}
*/
public function loadAll(array $criteria = array(), array $orderBy = null, $limit = null, $offset = null)
public function loadAll(array $criteria = [], array $orderBy = null, $limit = null, $offset = null)
{
$query = $this->persister->getSelectSQL($criteria, null, null, $limit, $offset, $orderBy);
$hash = $this->getHash($query, $criteria, null, null, null);
@ -494,7 +494,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
/**
* {@inheritDoc}
*/
public function count($criteria = array())
public function count($criteria = [])
{
return $this->persister->count($criteria);
}
@ -612,7 +612,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
/**
* {@inheritdoc}
*/
public function loadOneToOneEntity(array $assoc, $sourceEntity, array $identifier = array())
public function loadOneToOneEntity(array $assoc, $sourceEntity, array $identifier = [])
{
return $this->persister->loadOneToOneEntity($assoc, $sourceEntity, $identifier);
}

View File

@ -62,7 +62,7 @@ class NonStrictReadWriteCachedEntityPersister extends AbstractEntityPersister
$this->timestampRegion->update($this->timestampKey);
}
$this->queuedCache = array();
$this->queuedCache = [];
}
/**
@ -70,7 +70,7 @@ class NonStrictReadWriteCachedEntityPersister extends AbstractEntityPersister
*/
public function afterTransactionRolledBack()
{
$this->queuedCache = array();
$this->queuedCache = [];
}
/**

View File

@ -73,7 +73,7 @@ class ReadWriteCachedEntityPersister extends AbstractEntityPersister
$this->timestampRegion->update($this->timestampKey);
}
$this->queuedCache = array();
$this->queuedCache = [];
}
/**
@ -93,7 +93,7 @@ class ReadWriteCachedEntityPersister extends AbstractEntityPersister
}
}
$this->queuedCache = array();
$this->queuedCache = [];
}
/**
@ -113,10 +113,10 @@ class ReadWriteCachedEntityPersister extends AbstractEntityPersister
return $deleted;
}
$this->queuedCache['delete'][] = array(
$this->queuedCache['delete'][] = [
'lock' => $lock,
'key' => $key
);
];
return $deleted;
}
@ -135,9 +135,9 @@ class ReadWriteCachedEntityPersister extends AbstractEntityPersister
return;
}
$this->queuedCache['update'][] = array(
$this->queuedCache['update'][] = [
'lock' => $lock,
'key' => $key
);
];
}
}

View File

@ -44,7 +44,7 @@ interface QueryCache
*
* @return boolean
*/
public function put(QueryCacheKey $key, ResultSetMapping $rsm, $result, array $hints = array());
public function put(QueryCacheKey $key, ResultSetMapping $rsm, $result, array $hints = []);
/**
* @param \Doctrine\ORM\Cache\QueryCacheKey $key
@ -53,7 +53,7 @@ interface QueryCache
*
* @return array|null
*/
public function get(QueryCacheKey $key, ResultSetMapping $rsm, array $hints = array());
public function get(QueryCacheKey $key, ResultSetMapping $rsm, array $hints = []);
/**
* @return \Doctrine\ORM\Cache\Region

View File

@ -56,7 +56,7 @@ class DefaultMultiGetRegion extends DefaultRegion
*/
public function getMultiple(CollectionCacheEntry $collection)
{
$keysToRetrieve = array();
$keysToRetrieve = [];
foreach ($collection->identifiers as $index => $key) {
$keysToRetrieve[$index] = $this->getCacheEntryKey($key);
@ -67,7 +67,7 @@ class DefaultMultiGetRegion extends DefaultRegion
return null;
}
$returnableItems = array();
$returnableItems = [];
foreach ($keysToRetrieve as $index => $key) {
$returnableItems[$index] = $items[$key];
}

View File

@ -102,7 +102,7 @@ class DefaultRegion implements Region
*/
public function getMultiple(CollectionCacheEntry $collection)
{
$result = array();
$result = [];
foreach ($collection->identifiers as $key) {
$entryKey = $this->getCacheEntryKey($key);

View File

@ -31,12 +31,12 @@ class RegionsConfiguration
/**
* @var array
*/
private $lifetimes = array();
private $lifetimes = [];
/**
* @var array
*/
private $lockLifetimes = array();
private $lockLifetimes = [];
/**
* @var integer

View File

@ -149,7 +149,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
*
* @return AnnotationDriver
*/
public function newDefaultAnnotationDriver($paths = array(), $useSimpleAnnotationReader = true)
public function newDefaultAnnotationDriver($paths = [], $useSimpleAnnotationReader = true)
{
AnnotationRegistry::registerFile(__DIR__ . '/Mapping/Driver/DoctrineAnnotations.php');
@ -349,7 +349,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
*/
public function addNamedNativeQuery($name, $sql, Query\ResultSetMapping $rsm)
{
$this->_attributes['namedNativeQueries'][$name] = array($sql, $rsm);
$this->_attributes['namedNativeQueries'][$name] = [$sql, $rsm];
}
/**
@ -590,7 +590,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
*/
public function setCustomHydrationModes($modes)
{
$this->_attributes['customHydrationModes'] = array();
$this->_attributes['customHydrationModes'] = [];
foreach ($modes as $modeName => $hydrator) {
$this->addCustomHydrationMode($modeName, $hydrator);
@ -881,7 +881,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
*/
public function getDefaultQueryHints()
{
return isset($this->_attributes['defaultQueryHints']) ? $this->_attributes['defaultQueryHints'] : array();
return isset($this->_attributes['defaultQueryHints']) ? $this->_attributes['defaultQueryHints'] : [];
}
/**

View File

@ -386,7 +386,7 @@ use Doctrine\Common\Util\ClassUtils;
throw ORMInvalidArgumentException::invalidCompositeIdentifier();
}
$id = array($class->identifier[0] => $id);
$id = [$class->identifier[0] => $id];
}
foreach ($id as $i => $value) {
@ -399,7 +399,7 @@ use Doctrine\Common\Util\ClassUtils;
}
}
$sortedId = array();
$sortedId = [];
foreach ($class->identifier as $identifier) {
if ( ! isset($id[$identifier])) {
@ -458,7 +458,7 @@ use Doctrine\Common\Util\ClassUtils;
throw TransactionRequiredException::transactionRequired();
}
return $persister->load($sortedId, null, null, array(), $lockMode);
return $persister->load($sortedId, null, null, [], $lockMode);
default:
return $persister->loadById($sortedId);
@ -473,10 +473,10 @@ use Doctrine\Common\Util\ClassUtils;
$class = $this->metadataFactory->getMetadataFor(ltrim($entityName, '\\'));
if ( ! is_array($id)) {
$id = array($class->identifier[0] => $id);
$id = [$class->identifier[0] => $id];
}
$sortedId = array();
$sortedId = [];
foreach ($class->identifier as $identifier) {
if ( ! isset($id[$identifier])) {
@ -502,7 +502,7 @@ use Doctrine\Common\Util\ClassUtils;
$entity = $this->proxyFactory->getProxy($class->name, $sortedId);
$this->unitOfWork->registerManaged($entity, $sortedId, array());
$this->unitOfWork->registerManaged($entity, $sortedId, []);
return $entity;
}
@ -520,14 +520,14 @@ use Doctrine\Common\Util\ClassUtils;
}
if ( ! is_array($identifier)) {
$identifier = array($class->identifier[0] => $identifier);
$identifier = [$class->identifier[0] => $identifier];
}
$entity = $class->newInstance();
$class->setIdentifierValues($entity, $identifier);
$this->unitOfWork->registerManaged($entity, $identifier, array());
$this->unitOfWork->registerManaged($entity, $identifier, []);
$this->unitOfWork->markReadOnly($entity);
return $entity;

View File

@ -37,7 +37,7 @@ class EntityNotFoundException extends ORMException
*/
public static function fromClassNameAndIdentifier($className, array $id)
{
$ids = array();
$ids = [];
foreach ($id as $key => $value) {
$ids[] = $key . '(' . $value . ')';

View File

@ -161,7 +161,7 @@ class EntityRepository implements ObjectRepository, Selectable
*/
public function findAll()
{
return $this->findBy(array());
return $this->findBy([]);
}
/**
@ -193,7 +193,7 @@ class EntityRepository implements ObjectRepository, Selectable
{
$persister = $this->_em->getUnitOfWork()->getEntityPersister($this->_entityName);
return $persister->load($criteria, null, null, array(), null, 1, $orderBy);
return $persister->load($criteria, null, null, [], null, 1, $orderBy);
}
/**

View File

@ -44,7 +44,7 @@ class AssignedGenerator extends AbstractIdGenerator
{
$class = $em->getClassMetadata(get_class($entity));
$idFields = $class->getIdentifierFieldNames();
$identifier = array();
$identifier = [];
foreach ($idFields as $idField) {
$value = $class->getFieldValue($entity, $idField);

View File

@ -108,10 +108,12 @@ class SequenceGenerator extends AbstractIdGenerator implements Serializable
*/
public function serialize()
{
return serialize(array(
return serialize(
[
'allocationSize' => $this->_allocationSize,
'sequenceName' => $this->_sequenceName
));
]
);
}
/**

View File

@ -92,7 +92,7 @@ class TableGenerator extends AbstractIdGenerator
$this->_tableName, $this->_sequenceName, $this->_allocationSize
);
if ($conn->executeUpdate($updateSql, array(1 => $currentLevel, 2 => $currentLevel+1)) !== 1) {
if ($conn->executeUpdate($updateSql, [1 => $currentLevel, 2 => $currentLevel+1]) !== 1) {
// no affected rows, concurrency issue, throw exception
}
} else {

View File

@ -54,14 +54,14 @@ class CommitOrderCalculator
*
* @var array<stdClass>
*/
private $nodeList = array();
private $nodeList = [];
/**
* Volatile variable holding calculated nodes during sorting process.
*
* @var array
*/
private $sortedNodeList = array();
private $sortedNodeList = [];
/**
* Checks for node (vertex) existence in graph.
@ -90,7 +90,7 @@ class CommitOrderCalculator
$vertex->hash = $hash;
$vertex->state = self::NOT_VISITED;
$vertex->value = $node;
$vertex->dependencyList = array();
$vertex->dependencyList = [];
$this->nodeList[$hash] = $vertex;
}
@ -136,8 +136,8 @@ class CommitOrderCalculator
$sortedList = $this->sortedNodeList;
$this->nodeList = array();
$this->sortedNodeList = array();
$this->nodeList = [];
$this->sortedNodeList = [];
return array_reverse($sortedList);
}

View File

@ -69,14 +69,14 @@ abstract class AbstractHydrator
*
* @var array
*/
protected $_metadataCache = array();
protected $_metadataCache = [];
/**
* The cache used during row-by-row hydration.
*
* @var array
*/
protected $_cache = array();
protected $_cache = [];
/**
* The statement that provides the data to hydrate.
@ -113,7 +113,7 @@ abstract class AbstractHydrator
*
* @return IterableResult
*/
public function iterate($stmt, $resultSetMapping, array $hints = array())
public function iterate($stmt, $resultSetMapping, array $hints = [])
{
$this->_stmt = $stmt;
$this->_rsm = $resultSetMapping;
@ -121,7 +121,7 @@ abstract class AbstractHydrator
$evm = $this->_em->getEventManager();
$evm->addEventListener(array(Events::onClear), $this);
$evm->addEventListener([Events::onClear], $this);
$this->prepare();
@ -137,7 +137,7 @@ abstract class AbstractHydrator
*
* @return array
*/
public function hydrateAll($stmt, $resultSetMapping, array $hints = array())
public function hydrateAll($stmt, $resultSetMapping, array $hints = [])
{
$this->_stmt = $stmt;
$this->_rsm = $resultSetMapping;
@ -168,7 +168,7 @@ abstract class AbstractHydrator
return false;
}
$result = array();
$result = [];
$this->hydrateRowData($row, $result);
@ -209,8 +209,8 @@ abstract class AbstractHydrator
$this->_stmt = null;
$this->_rsm = null;
$this->_cache = array();
$this->_metadataCache = array();
$this->_cache = [];
$this->_metadataCache = [];
}
/**
@ -255,7 +255,7 @@ abstract class AbstractHydrator
*/
protected function gatherRowData(array $data, array &$id, array &$nonemptyComponents)
{
$rowData = array('data' => array());
$rowData = ['data' => []];
foreach ($data as $key => $value) {
if (($cacheKeyInfo = $this->hydrateColumnInfo($key)) === null) {
@ -323,7 +323,7 @@ abstract class AbstractHydrator
*/
protected function gatherScalarRowData(&$data)
{
$rowData = array();
$rowData = [];
foreach ($data as $key => $value) {
if (($cacheKeyInfo = $this->hydrateColumnInfo($key)) === null) {
@ -369,18 +369,18 @@ abstract class AbstractHydrator
$fieldName = $this->_rsm->fieldMappings[$key];
$fieldMapping = $classMetadata->fieldMappings[$fieldName];
return $this->_cache[$key] = array(
return $this->_cache[$key] = [
'isIdentifier' => in_array($fieldName, $classMetadata->identifier),
'fieldName' => $fieldName,
'type' => Type::getType($fieldMapping['type']),
'dqlAlias' => $this->_rsm->columnOwnerMap[$key],
);
];
case (isset($this->_rsm->newObjectMappings[$key])):
// WARNING: A NEW object is also a scalar, so it must be declared before!
$mapping = $this->_rsm->newObjectMappings[$key];
return $this->_cache[$key] = array(
return $this->_cache[$key] = [
'isScalar' => true,
'isNewObjectParameter' => true,
'fieldName' => $this->_rsm->scalarMappings[$key],
@ -388,14 +388,14 @@ abstract class AbstractHydrator
'argIndex' => $mapping['argIndex'],
'objIndex' => $mapping['objIndex'],
'class' => new \ReflectionClass($mapping['className']),
);
];
case (isset($this->_rsm->scalarMappings[$key])):
return $this->_cache[$key] = array(
return $this->_cache[$key] = [
'isScalar' => true,
'fieldName' => $this->_rsm->scalarMappings[$key],
'type' => Type::getType($this->_rsm->typeMappings[$key]),
);
];
case (isset($this->_rsm->metaMappings[$key])):
// Meta column (has meaning in relational schema only, i.e. foreign keys or discriminator columns).
@ -408,13 +408,13 @@ abstract class AbstractHydrator
// Cache metadata fetch
$this->getClassMetadata($this->_rsm->aliasMap[$dqlAlias]);
return $this->_cache[$key] = array(
return $this->_cache[$key] = [
'isIdentifier' => isset($this->_rsm->isIdentifierColumn[$dqlAlias][$key]),
'isMetaColumn' => true,
'fieldName' => $fieldName,
'type' => $type,
'dqlAlias' => $dqlAlias,
);
];
}
// this column is a left over, maybe from a LIMIT query hack for example in Oracle or DB2
@ -452,7 +452,7 @@ abstract class AbstractHydrator
protected function registerManaged(ClassMetadata $class, $entity, array $data)
{
if ($class->isIdentifierComposite) {
$id = array();
$id = [];
foreach ($class->identifier as $fieldName) {
$id[$fieldName] = isset($class->associationMappings[$fieldName])
@ -461,11 +461,11 @@ abstract class AbstractHydrator
}
} else {
$fieldName = $class->identifier[0];
$id = array(
$id = [
$fieldName => isset($class->associationMappings[$fieldName])
? $data[$class->associationMappings[$fieldName]['joinColumns'][0]['name']]
: $data[$fieldName]
);
];
}
$this->_em->getUnitOfWork()->registerManaged($entity, $id, $data);

View File

@ -35,7 +35,7 @@ class ArrayHydrator extends AbstractHydrator
/**
* @var array
*/
private $_rootAliases = array();
private $_rootAliases = [];
/**
* @var bool
@ -45,17 +45,17 @@ class ArrayHydrator extends AbstractHydrator
/**
* @var array
*/
private $_identifierMap = array();
private $_identifierMap = [];
/**
* @var array
*/
private $_resultPointers = array();
private $_resultPointers = [];
/**
* @var array
*/
private $_idTemplate = array();
private $_idTemplate = [];
/**
* @var int
@ -70,8 +70,8 @@ class ArrayHydrator extends AbstractHydrator
$this->_isSimpleQuery = count($this->_rsm->aliasMap) <= 1;
foreach ($this->_rsm->aliasMap as $dqlAlias => $className) {
$this->_identifierMap[$dqlAlias] = array();
$this->_resultPointers[$dqlAlias] = array();
$this->_identifierMap[$dqlAlias] = [];
$this->_resultPointers[$dqlAlias] = [];
$this->_idTemplate[$dqlAlias] = '';
}
}
@ -81,7 +81,7 @@ class ArrayHydrator extends AbstractHydrator
*/
protected function hydrateAllData()
{
$result = array();
$result = [];
while ($data = $this->_stmt->fetch(PDO::FETCH_ASSOC)) {
$this->hydrateRowData($data, $result);
@ -97,7 +97,7 @@ class ArrayHydrator extends AbstractHydrator
{
// 1) Initialize
$id = $this->_idTemplate; // initialize the id-memory
$nonemptyComponents = array();
$nonemptyComponents = [];
$rowData = $this->gatherRowData($row, $id, $nonemptyComponents);
// 2) Now hydrate the data found in the current row.
@ -138,7 +138,7 @@ class ArrayHydrator extends AbstractHydrator
$oneToOne = false;
if ( ! isset($baseElement[$relationAlias])) {
$baseElement[$relationAlias] = array();
$baseElement[$relationAlias] = [];
}
if (isset($nonemptyComponents[$dqlAlias])) {
@ -187,7 +187,7 @@ class ArrayHydrator extends AbstractHydrator
// if this row has a NULL value for the root result id then make it a null result.
if ( ! isset($nonemptyComponents[$dqlAlias]) ) {
$result[] = $this->_rsm->isMixed
? array($entityKey => null)
? [$entityKey => null]
: null;
$resultKey = $this->_resultCounter;
@ -199,7 +199,7 @@ class ArrayHydrator extends AbstractHydrator
// Check for an existing element
if ($this->_isSimpleQuery || ! isset($this->_identifierMap[$dqlAlias][$id[$dqlAlias]])) {
$element = $this->_rsm->isMixed
? array($entityKey => $data)
? [$entityKey => $data]
: $data;
if (isset($this->_rsm->indexByMap[$dqlAlias])) {

View File

@ -42,17 +42,17 @@ class ObjectHydrator extends AbstractHydrator
/**
* @var array
*/
private $identifierMap = array();
private $identifierMap = [];
/**
* @var array
*/
private $resultPointers = array();
private $resultPointers = [];
/**
* @var array
*/
private $idTemplate = array();
private $idTemplate = [];
/**
* @var integer
@ -62,17 +62,17 @@ class ObjectHydrator extends AbstractHydrator
/**
* @var array
*/
private $rootAliases = array();
private $rootAliases = [];
/**
* @var array
*/
private $initializedCollections = array();
private $initializedCollections = [];
/**
* @var array
*/
private $existingCollections = array();
private $existingCollections = [];
/**
* {@inheritdoc}
@ -84,7 +84,7 @@ class ObjectHydrator extends AbstractHydrator
}
foreach ($this->_rsm->aliasMap as $dqlAlias => $className) {
$this->identifierMap[$dqlAlias] = array();
$this->identifierMap[$dqlAlias] = [];
$this->idTemplate[$dqlAlias] = '';
// Remember which associations are "fetch joined", so that we know where to inject
@ -142,7 +142,7 @@ class ObjectHydrator extends AbstractHydrator
$this->identifierMap =
$this->initializedCollections =
$this->existingCollections =
$this->resultPointers = array();
$this->resultPointers = [];
if ($eagerLoad) {
$this->_uow->triggerEagerLoads();
@ -156,7 +156,7 @@ class ObjectHydrator extends AbstractHydrator
*/
protected function hydrateAllData()
{
$result = array();
$result = [];
while ($row = $this->_stmt->fetch(PDO::FETCH_ASSOC)) {
$this->hydrateRowData($row, $result);
@ -326,7 +326,7 @@ class ObjectHydrator extends AbstractHydrator
{
// Initialize
$id = $this->idTemplate; // initialize the id-memory
$nonemptyComponents = array();
$nonemptyComponents = [];
// Split the row data into chunks of class data.
$rowData = $this->gatherRowData($row, $id, $nonemptyComponents);
@ -478,7 +478,7 @@ class ObjectHydrator extends AbstractHydrator
// if this row has a NULL value for the root result id then make it a null result.
if ( ! isset($nonemptyComponents[$dqlAlias]) ) {
if ($this->_rsm->isMixed) {
$result[] = array($entityKey => null);
$result[] = [$entityKey => null];
} else {
$result[] = null;
}
@ -492,7 +492,7 @@ class ObjectHydrator extends AbstractHydrator
$element = $this->getEntity($data, $dqlAlias);
if ($this->_rsm->isMixed) {
$element = array($entityKey => $element);
$element = [$entityKey => $element];
}
if (isset($this->_rsm->indexByMap[$dqlAlias])) {

View File

@ -35,7 +35,7 @@ class ScalarHydrator extends AbstractHydrator
*/
protected function hydrateAllData()
{
$result = array();
$result = [];
while ($data = $this->_stmt->fetch(\PDO::FETCH_ASSOC)) {
$this->hydrateRowData($data, $result);

View File

@ -62,7 +62,7 @@ class SimpleObjectHydrator extends AbstractHydrator
*/
protected function hydrateAllData()
{
$result = array();
$result = [];
while ($row = $this->_stmt->fetch(PDO::FETCH_ASSOC)) {
$this->hydrateRowData($row, $result);
@ -79,7 +79,7 @@ class SimpleObjectHydrator extends AbstractHydrator
protected function hydrateRowData(array $sqlResult, array &$result)
{
$entityName = $this->class->name;
$data = array();
$data = [];
// We need to find the correct entity class name if we have inheritance in resultset
if ($this->class->inheritanceType !== ClassMetadata::INHERITANCE_TYPE_NONE) {

View File

@ -47,7 +47,7 @@ final class HydrationCompleteHandler
/**
* @var array[]
*/
private $deferredPostLoadInvocations = array();
private $deferredPostLoadInvocations = [];
/**
* Constructor for this object
@ -75,7 +75,7 @@ final class HydrationCompleteHandler
return;
}
$this->deferredPostLoadInvocations[] = array($class, $invoke, $entity);
$this->deferredPostLoadInvocations[] = [$class, $invoke, $entity];
}
/**
@ -86,7 +86,7 @@ final class HydrationCompleteHandler
public function hydrationComplete()
{
$toInvoke = $this->deferredPostLoadInvocations;
$this->deferredPostLoadInvocations = array();
$this->deferredPostLoadInvocations = [];
foreach ($toInvoke as $classAndEntity) {
list($class, $invoke, $entity) = $classAndEntity;

View File

@ -84,7 +84,7 @@ class AssociationBuilder
*/
public function cascadeAll()
{
$this->mapping['cascade'] = array("ALL");
$this->mapping['cascade'] = ["ALL"];
return $this;
}
@ -183,14 +183,14 @@ class AssociationBuilder
*/
public function addJoinColumn($columnName, $referencedColumnName, $nullable = true, $unique = false, $onDelete = null, $columnDef = null)
{
$this->joinColumns[] = array(
$this->joinColumns[] = [
'name' => $columnName,
'referencedColumnName' => $referencedColumnName,
'nullable' => $nullable,
'unique' => $unique,
'onDelete' => $onDelete,
'columnDefinition' => $columnDef,
);
];
return $this;
}

View File

@ -91,11 +91,13 @@ class ClassMetadataBuilder
*/
public function addEmbedded($fieldName, $class, $columnPrefix = null)
{
$this->cm->mapEmbedded(array(
$this->cm->mapEmbedded(
[
'fieldName' => $fieldName,
'class' => $class,
'columnPrefix' => $columnPrefix
));
]
);
return $this;
}
@ -135,7 +137,7 @@ class ClassMetadataBuilder
*/
public function setTable($name)
{
$this->cm->setPrimaryTable(array('name' => $name));
$this->cm->setPrimaryTable(['name' => $name]);
return $this;
}
@ -151,10 +153,10 @@ class ClassMetadataBuilder
public function addIndex(array $columns, $name)
{
if (!isset($this->cm->table['indexes'])) {
$this->cm->table['indexes'] = array();
$this->cm->table['indexes'] = [];
}
$this->cm->table['indexes'][$name] = array('columns' => $columns);
$this->cm->table['indexes'][$name] = ['columns' => $columns];
return $this;
}
@ -170,10 +172,10 @@ class ClassMetadataBuilder
public function addUniqueConstraint(array $columns, $name)
{
if ( ! isset($this->cm->table['uniqueConstraints'])) {
$this->cm->table['uniqueConstraints'] = array();
$this->cm->table['uniqueConstraints'] = [];
}
$this->cm->table['uniqueConstraints'][$name] = array('columns' => $columns);
$this->cm->table['uniqueConstraints'][$name] = ['columns' => $columns];
return $this;
}
@ -188,10 +190,12 @@ class ClassMetadataBuilder
*/
public function addNamedQuery($name, $dqlQuery)
{
$this->cm->addNamedQuery(array(
$this->cm->addNamedQuery(
[
'name' => $name,
'query' => $dqlQuery,
));
]
);
return $this;
}
@ -231,11 +235,13 @@ class ClassMetadataBuilder
*/
public function setDiscriminatorColumn($name, $type = 'string', $length = 255)
{
$this->cm->setDiscriminatorColumn(array(
$this->cm->setDiscriminatorColumn(
[
'name' => $name,
'type' => $type,
'length' => $length,
));
]
);
return $this;
}
@ -303,7 +309,7 @@ class ClassMetadataBuilder
*
* @return ClassMetadataBuilder
*/
public function addField($name, $type, array $mapping = array())
public function addField($name, $type, array $mapping = [])
{
$mapping['fieldName'] = $name;
$mapping['type'] = $type;
@ -325,10 +331,10 @@ class ClassMetadataBuilder
{
return new FieldBuilder(
$this,
array(
[
'fieldName' => $name,
'type' => $type
)
]
);
}
@ -344,11 +350,11 @@ class ClassMetadataBuilder
{
return new EmbeddedBuilder(
$this,
array(
[
'fieldName' => $fieldName,
'class' => $class,
'columnPrefix' => null
)
]
);
}
@ -386,10 +392,10 @@ class ClassMetadataBuilder
{
return new AssociationBuilder(
$this,
array(
[
'fieldName' => $name,
'targetEntity' => $targetEntity
),
],
ClassMetadata::MANY_TO_ONE
);
}
@ -406,10 +412,10 @@ class ClassMetadataBuilder
{
return new AssociationBuilder(
$this,
array(
[
'fieldName' => $name,
'targetEntity' => $targetEntity
),
],
ClassMetadata::ONE_TO_ONE
);
}
@ -463,10 +469,10 @@ class ClassMetadataBuilder
{
return new ManyToManyAssociationBuilder(
$this,
array(
[
'fieldName' => $name,
'targetEntity' => $targetEntity
),
],
ClassMetadata::MANY_TO_MANY
);
}
@ -520,10 +526,10 @@ class ClassMetadataBuilder
{
return new OneToManyAssociationBuilder(
$this,
array(
[
'fieldName' => $name,
'targetEntity' => $targetEntity
),
],
ClassMetadata::ONE_TO_MANY
);
}

View File

@ -34,7 +34,7 @@ class EntityListenerBuilder
/**
* @var array Hash-map to handle event names.
*/
static private $events = array(
static private $events = [
Events::preRemove => true,
Events::postRemove => true,
Events::prePersist => true,
@ -43,7 +43,7 @@ class EntityListenerBuilder
Events::postUpdate => true,
Events::postLoad => true,
Events::preFlush => true
);
];
/**
* Lookup the entity class to find methods that match to event lifecycle names

View File

@ -226,11 +226,11 @@ class FieldBuilder
*/
public function setSequenceGenerator($sequenceName, $allocationSize = 1, $initialValue = 1)
{
$this->sequenceDef = array(
$this->sequenceDef = [
'sequenceName' => $sequenceName,
'allocationSize' => $allocationSize,
'initialValue' => $initialValue,
);
];
return $this;
}

View File

@ -37,7 +37,7 @@ class ManyToManyAssociationBuilder extends OneToManyAssociationBuilder
/**
* @var array
*/
private $inverseJoinColumns = array();
private $inverseJoinColumns = [];
/**
* @param string $name
@ -65,14 +65,14 @@ class ManyToManyAssociationBuilder extends OneToManyAssociationBuilder
*/
public function addInverseJoinColumn($columnName, $referencedColumnName, $nullable = true, $unique = false, $onDelete = null, $columnDef = null)
{
$this->inverseJoinColumns[] = array(
$this->inverseJoinColumns[] = [
'name' => $columnName,
'referencedColumnName' => $referencedColumnName,
'nullable' => $nullable,
'unique' => $unique,
'onDelete' => $onDelete,
'columnDefinition' => $columnDef,
);
];
return $this;
}
@ -83,7 +83,7 @@ class ManyToManyAssociationBuilder extends OneToManyAssociationBuilder
public function build()
{
$mapping = $this->mapping;
$mapping['joinTable'] = array();
$mapping['joinTable'] = [];
if ($this->joinColumns) {
$mapping['joinTable']['joinColumns'] = $this->joinColumns;
}

View File

@ -68,7 +68,7 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
/**
* @var array
*/
private $embeddablesActiveNesting = array();
private $embeddablesActiveNesting = [];
/**
* {@inheritDoc}
@ -350,9 +350,9 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
{
$allClasses = $this->driver->getAllClassNames();
$fqcn = $class->getName();
$map = array($this->getShortName($class->name) => $fqcn);
$map = [$this->getShortName($class->name) => $fqcn];
$duplicates = array();
$duplicates = [];
foreach ($allClasses as $subClassCandidate) {
if (is_subclass_of($subClassCandidate, $fqcn)) {
$shortName = $this->getShortName($subClassCandidate);
@ -475,7 +475,8 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
$embeddableMetadata = $this->getMetadataFor($embeddableClass['class']);
$parentClass->mapEmbedded(array(
$parentClass->mapEmbedded(
[
'fieldName' => $prefix . '.' . $property,
'class' => $embeddableMetadata->name,
'columnPrefix' => $embeddableClass['columnPrefix'],
@ -483,7 +484,8 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
? $prefix . '.' . $embeddableClass['declaredField']
: $prefix,
'originalField' => $embeddableClass['originalField'] ?: $property,
));
]
);
}
}
@ -501,7 +503,7 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
return;
}
foreach (array('uniqueConstraints', 'indexes') as $indexType) {
foreach (['uniqueConstraints', 'indexes'] as $indexType) {
if (isset($parentClass->table[$indexType])) {
foreach ($parentClass->table[$indexType] as $indexName => $index) {
if (isset($subClass->table[$indexType][$indexName])) {
@ -528,10 +530,12 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
{
foreach ($parentClass->namedQueries as $name => $query) {
if ( ! isset ($subClass->namedQueries[$name])) {
$subClass->addNamedQuery(array(
$subClass->addNamedQuery(
[
'name' => $query['name'],
'query' => $query['query']
));
]
);
}
}
}
@ -550,13 +554,15 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
{
foreach ($parentClass->namedNativeQueries as $name => $query) {
if ( ! isset ($subClass->namedNativeQueries[$name])) {
$subClass->addNamedNativeQuery(array(
$subClass->addNamedNativeQuery(
[
'name' => $query['name'],
'query' => $query['query'],
'isSelfClass' => $query['isSelfClass'],
'resultSetMapping' => $query['resultSetMapping'],
'resultClass' => $query['isSelfClass'] ? $subClass->name : $query['resultClass'],
));
]
);
}
}
}
@ -575,21 +581,23 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
{
foreach ($parentClass->sqlResultSetMappings as $name => $mapping) {
if ( ! isset ($subClass->sqlResultSetMappings[$name])) {
$entities = array();
$entities = [];
foreach ($mapping['entities'] as $entity) {
$entities[] = array(
$entities[] = [
'fields' => $entity['fields'],
'isSelfClass' => $entity['isSelfClass'],
'discriminatorColumn' => $entity['discriminatorColumn'],
'entityClass' => $entity['isSelfClass'] ? $subClass->name : $entity['entityClass'],
);
];
}
$subClass->addSqlResultSetMapping(array(
$subClass->addSqlResultSetMapping(
[
'name' => $mapping['name'],
'columns' => $mapping['columns'],
'entities' => $entities,
));
]
);
}
}
}
@ -629,9 +637,9 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
$quoted = isset($class->fieldMappings[$fieldName]['quoted']) || isset($class->table['quoted']);
$sequencePrefix = $class->getSequencePrefix($this->getTargetPlatform());
$sequenceName = $this->getTargetPlatform()->getIdentitySequenceName($sequencePrefix, $columnName);
$definition = array(
$definition = [
'sequenceName' => $this->getTargetPlatform()->fixSchemaElementName($sequenceName)
);
];
if ($quoted) {
$definition['quoted'] = true;
@ -661,11 +669,11 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory
$sequenceName = $class->getSequenceName($this->getTargetPlatform());
$quoted = isset($class->fieldMappings[$fieldName]['quoted']) || isset($class->table['quoted']);
$definition = array(
$definition = [
'sequenceName' => $this->getTargetPlatform()->fixSchemaElementName($sequenceName),
'allocationSize' => 1,
'initialValue' => 1,
);
];
if ($quoted) {
$definition['quoted'] = true;

View File

@ -275,28 +275,28 @@ class ClassMetadataInfo implements ClassMetadata
*
* @var array
*/
public $parentClasses = array();
public $parentClasses = [];
/**
* READ-ONLY: The names of all subclasses (descendants).
*
* @var array
*/
public $subClasses = array();
public $subClasses = [];
/**
* READ-ONLY: The names of all embedded classes based on properties.
*
* @var array
*/
public $embeddedClasses = array();
public $embeddedClasses = [];
/**
* READ-ONLY: The named queries allowed to be called directly from Repository.
*
* @var array
*/
public $namedQueries = array();
public $namedQueries = [];
/**
* READ-ONLY: The named native queries allowed to be called directly from Repository.
@ -313,7 +313,7 @@ class ClassMetadataInfo implements ClassMetadata
*
* @var array
*/
public $namedNativeQueries = array();
public $namedNativeQueries = [];
/**
* READ-ONLY: The mappings of the results of native SQL queries.
@ -329,7 +329,7 @@ class ClassMetadataInfo implements ClassMetadata
*
* @var array
*/
public $sqlResultSetMappings = array();
public $sqlResultSetMappings = [];
/**
* READ-ONLY: The field names of all fields that are part of the identifier/primary key
@ -337,7 +337,7 @@ class ClassMetadataInfo implements ClassMetadata
*
* @var array
*/
public $identifier = array();
public $identifier = [];
/**
* READ-ONLY: The inheritance mapping type used by the class.
@ -394,7 +394,7 @@ class ClassMetadataInfo implements ClassMetadata
*
* @var array
*/
public $fieldMappings = array();
public $fieldMappings = [];
/**
* READ-ONLY: An array of field names. Used to look up field names from column names.
@ -402,7 +402,7 @@ class ClassMetadataInfo implements ClassMetadata
*
* @var array
*/
public $fieldNames = array();
public $fieldNames = [];
/**
* READ-ONLY: A map of field names to column names. Keys are field names and values column names.
@ -413,7 +413,7 @@ class ClassMetadataInfo implements ClassMetadata
*
* @deprecated 3.0 Remove this.
*/
public $columnNames = array();
public $columnNames = [];
/**
* READ-ONLY: The discriminator value of this class.
@ -437,7 +437,7 @@ class ClassMetadataInfo implements ClassMetadata
*
* @see discriminatorColumn
*/
public $discriminatorMap = array();
public $discriminatorMap = [];
/**
* READ-ONLY: The definition of the discriminator column used in JOINED and SINGLE_TABLE
@ -465,14 +465,14 @@ class ClassMetadataInfo implements ClassMetadata
*
* @var array[]
*/
public $lifecycleCallbacks = array();
public $lifecycleCallbacks = [];
/**
* READ-ONLY: The registered entity listeners.
*
* @var array
*/
public $entityListeners = array();
public $entityListeners = [];
/**
* READ-ONLY: The association mappings of this class.
@ -529,7 +529,7 @@ class ClassMetadataInfo implements ClassMetadata
*
* @var array
*/
public $associationMappings = array();
public $associationMappings = [];
/**
* READ-ONLY: Flag indicating whether the identifier/primary key of the class is composite.
@ -642,7 +642,7 @@ class ClassMetadataInfo implements ClassMetadata
*
* @var \ReflectionProperty[]
*/
public $reflFields = array();
public $reflFields = [];
/**
* @var \Doctrine\Instantiator\InstantiatorInterface|null
@ -715,7 +715,7 @@ class ClassMetadataInfo implements ClassMetadata
public function getIdentifierValues($entity)
{
if ($this->isIdentifierComposite) {
$id = array();
$id = [];
foreach ($this->identifier as $idField) {
$value = $this->reflFields[$idField]->getValue($entity);
@ -732,10 +732,10 @@ class ClassMetadataInfo implements ClassMetadata
$value = $this->reflFields[$id]->getValue($entity);
if (null === $value) {
return array();
return [];
}
return array($id => $value);
return [$id => $value];
}
/**
@ -810,7 +810,7 @@ class ClassMetadataInfo implements ClassMetadata
public function __sleep()
{
// This metadata is always serialized/cached.
$serialized = array(
$serialized = [
'associationMappings',
'columnNames', //TODO: 3.0 Remove this. Can use fieldMappings[$fieldName]['columnName']
'fieldMappings',
@ -823,7 +823,7 @@ class ClassMetadataInfo implements ClassMetadata
'table',
'rootEntityName',
'idGenerator', //TODO: Does not really need to be serialized. Could be moved to runtime.
);
];
// The rest of the metadata is only serialized if necessary.
if ($this->changeTrackingPolicy != self::CHANGETRACKING_DEFERRED_IMPLICIT) {
@ -925,7 +925,7 @@ class ClassMetadataInfo implements ClassMetadata
$this->reflClass = $reflService->getClass($this->name);
$this->instantiator = $this->instantiator ?: new Instantiator();
$parentReflFields = array();
$parentReflFields = [];
foreach ($this->embeddedClasses as $property => $embeddedClass) {
if (isset($embeddedClass['declaredField'])) {
@ -1533,9 +1533,9 @@ class ClassMetadataInfo implements ClassMetadata
}
// Cascades
$cascades = isset($mapping['cascade']) ? array_map('strtolower', $mapping['cascade']) : array();
$cascades = isset($mapping['cascade']) ? array_map('strtolower', $mapping['cascade']) : [];
$allCascades = array('remove', 'persist', 'refresh', 'merge', 'detach');
$allCascades = ['remove', 'persist', 'refresh', 'merge', 'detach'];
if (in_array('all', $cascades)) {
$cascades = $allCascades;
} elseif (count($cascades) !== count(array_intersect($cascades, $allCascades))) {
@ -1577,15 +1577,15 @@ class ClassMetadataInfo implements ClassMetadata
if ($mapping['isOwningSide']) {
if (empty($mapping['joinColumns'])) {
// Apply default join column
$mapping['joinColumns'] = array(
array(
$mapping['joinColumns'] = [
[
'name' => $this->namingStrategy->joinColumnName($mapping['fieldName'], $this->name),
'referencedColumnName' => $this->namingStrategy->referenceColumnName()
)
);
]
];
}
$uniqueConstraintColumns = array();
$uniqueConstraintColumns = [];
foreach ($mapping['joinColumns'] as &$joinColumn) {
if ($mapping['type'] === self::ONE_TO_ONE && ! $this->isInheritanceTypeSingleTable()) {
@ -1627,9 +1627,9 @@ class ClassMetadataInfo implements ClassMetadata
throw new RuntimeException("ClassMetadataInfo::setTable() has to be called before defining a one to one relationship.");
}
$this->table['uniqueConstraints'][$mapping['fieldName'] . "_uniq"] = array(
$this->table['uniqueConstraints'][$mapping['fieldName'] . "_uniq"] = [
'columns' => $uniqueConstraintColumns
);
];
}
$mapping['targetToSourceKeyColumns'] = array_flip($mapping['sourceToTargetKeyColumns']);
@ -1699,26 +1699,26 @@ class ClassMetadataInfo implements ClassMetadata
&& (! (isset($mapping['joinTable']['joinColumns']) || isset($mapping['joinTable']['inverseJoinColumns'])));
if ( ! isset($mapping['joinTable']['joinColumns'])) {
$mapping['joinTable']['joinColumns'] = array(
array(
$mapping['joinTable']['joinColumns'] = [
[
'name' => $this->namingStrategy->joinKeyColumnName($mapping['sourceEntity'], $selfReferencingEntityWithoutJoinColumns ? 'source' : null),
'referencedColumnName' => $this->namingStrategy->referenceColumnName(),
'onDelete' => 'CASCADE'
)
);
]
];
}
if ( ! isset($mapping['joinTable']['inverseJoinColumns'])) {
$mapping['joinTable']['inverseJoinColumns'] = array(
array(
$mapping['joinTable']['inverseJoinColumns'] = [
[
'name' => $this->namingStrategy->joinKeyColumnName($mapping['targetEntity'], $selfReferencingEntityWithoutJoinColumns ? 'target' : null),
'referencedColumnName' => $this->namingStrategy->referenceColumnName(),
'onDelete' => 'CASCADE'
)
);
]
];
}
$mapping['joinTableColumns'] = array();
$mapping['joinTableColumns'] = [];
foreach ($mapping['joinTable']['joinColumns'] as &$joinColumn) {
if (empty($joinColumn['name'])) {
@ -1874,7 +1874,7 @@ class ClassMetadataInfo implements ClassMetadata
*/
public function getIdentifierColumnNames()
{
$columnNames = array();
$columnNames = [];
foreach ($this->identifier as $idProperty) {
if (isset($this->fieldMappings[$idProperty])) {
@ -2411,11 +2411,11 @@ class ClassMetadataInfo implements ClassMetadata
$query = $queryMapping['query'];
$dql = str_replace('__CLASS__', $this->name, $query);
$this->namedQueries[$name] = array(
$this->namedQueries[$name] = [
'name' => $name,
'query' => $query,
'dql' => $dql,
);
];
}
/**
@ -2657,7 +2657,7 @@ class ClassMetadataInfo implements ClassMetadata
*/
public function getLifecycleCallbacks($event)
{
return isset($this->lifecycleCallbacks[$event]) ? $this->lifecycleCallbacks[$event] : array();
return isset($this->lifecycleCallbacks[$event]) ? $this->lifecycleCallbacks[$event] : [];
}
/**
@ -2703,10 +2703,10 @@ class ClassMetadataInfo implements ClassMetadata
{
$class = $this->fullyQualifiedClassName($class);
$listener = array(
$listener = [
'class' => $class,
'method' => $method,
);
];
if ( ! class_exists($class)) {
throw MappingException::entityListenerClassNotFound($class, $this->name);
@ -2753,7 +2753,7 @@ class ClassMetadataInfo implements ClassMetadata
$columnDef['type'] = "string";
}
if (in_array($columnDef['type'], array("boolean", "array", "object", "datetime", "time", "date"))) {
if (in_array($columnDef['type'], ["boolean", "array", "object", "datetime", "time", "date"])) {
throw MappingException::invalidDiscriminatorColumnType($this->name, $columnDef['type']);
}
@ -3021,7 +3021,7 @@ class ClassMetadataInfo implements ClassMetadata
$this->versionField = $mapping['fieldName'];
if ( ! isset($mapping['default'])) {
if (in_array($mapping['type'], array('integer', 'bigint', 'smallint'))) {
if (in_array($mapping['type'], ['integer', 'bigint', 'smallint'])) {
$mapping['default'] = 1;
} else if ($mapping['type'] == 'datetime') {
$mapping['default'] = 'CURRENT_TIMESTAMP';
@ -3115,7 +3115,7 @@ class ClassMetadataInfo implements ClassMetadata
*/
public function getQuotedIdentifierColumnNames($platform)
{
$quotedColumnNames = array();
$quotedColumnNames = [];
foreach ($this->identifier as $idProperty) {
if (isset($this->fieldMappings[$idProperty])) {
@ -3217,7 +3217,7 @@ class ClassMetadataInfo implements ClassMetadata
*/
public function getAssociationsByTargetClass($targetClass)
{
$relations = array();
$relations = [];
foreach ($this->associationMappings as $mapping) {
if ($mapping['targetEntity'] == $targetClass) {
@ -3273,12 +3273,12 @@ class ClassMetadataInfo implements ClassMetadata
{
$this->assertFieldNotMapped($mapping['fieldName']);
$this->embeddedClasses[$mapping['fieldName']] = array(
$this->embeddedClasses[$mapping['fieldName']] = [
'class' => $this->fullyQualifiedClassName($mapping['class']),
'columnPrefix' => $mapping['columnPrefix'],
'declaredField' => isset($mapping['declaredField']) ? $mapping['declaredField'] : null,
'originalField' => isset($mapping['originalField']) ? $mapping['originalField'] : null,
);
];
}
/**

View File

@ -67,7 +67,7 @@ final class Column implements Annotation
/**
* @var array
*/
public $options = array();
public $options = [];
/**
* @var string

View File

@ -31,7 +31,7 @@ class DefaultEntityListenerResolver implements EntityListenerResolver
/**
* @var array Map to store entity listener instances.
*/
private $instances = array();
private $instances = [];
/**
* {@inheritdoc}
@ -39,7 +39,7 @@ class DefaultEntityListenerResolver implements EntityListenerResolver
public function clear($className = null)
{
if ($className === null) {
$this->instances = array();
$this->instances = [];
return;
}

View File

@ -116,7 +116,7 @@ class DefaultQuoteStrategy implements QuoteStrategy
*/
public function getIdentifierColumnNames(ClassMetadata $class, AbstractPlatform $platform)
{
$quotedColumnNames = array();
$quotedColumnNames = [];
foreach ($class->identifier as $fieldName) {
if (isset($class->fieldMappings[$fieldName])) {

View File

@ -42,10 +42,10 @@ class AnnotationDriver extends AbstractAnnotationDriver
/**
* {@inheritDoc}
*/
protected $entityAnnotationClasses = array(
protected $entityAnnotationClasses = [
'Doctrine\ORM\Mapping\Entity' => 1,
'Doctrine\ORM\Mapping\MappedSuperclass' => 2,
);
];
/**
* {@inheritDoc}
@ -97,14 +97,14 @@ class AnnotationDriver extends AbstractAnnotationDriver
// Evaluate Table annotation
if (isset($classAnnotations['Doctrine\ORM\Mapping\Table'])) {
$tableAnnot = $classAnnotations['Doctrine\ORM\Mapping\Table'];
$primaryTable = array(
$primaryTable = [
'name' => $tableAnnot->name,
'schema' => $tableAnnot->schema
);
];
if ($tableAnnot->indexes !== null) {
foreach ($tableAnnot->indexes as $indexAnnot) {
$index = array('columns' => $indexAnnot->columns);
$index = ['columns' => $indexAnnot->columns];
if ( ! empty($indexAnnot->flags)) {
$index['flags'] = $indexAnnot->flags;
@ -124,7 +124,7 @@ class AnnotationDriver extends AbstractAnnotationDriver
if ($tableAnnot->uniqueConstraints !== null) {
foreach ($tableAnnot->uniqueConstraints as $uniqueConstraintAnnot) {
$uniqueConstraint = array('columns' => $uniqueConstraintAnnot->columns);
$uniqueConstraint = ['columns' => $uniqueConstraintAnnot->columns];
if ( ! empty($uniqueConstraintAnnot->options)) {
$uniqueConstraint['options'] = $uniqueConstraintAnnot->options;
@ -148,10 +148,10 @@ class AnnotationDriver extends AbstractAnnotationDriver
// Evaluate @Cache annotation
if (isset($classAnnotations['Doctrine\ORM\Mapping\Cache'])) {
$cacheAnnot = $classAnnotations['Doctrine\ORM\Mapping\Cache'];
$cacheMap = array(
$cacheMap = [
'region' => $cacheAnnot->region,
'usage' => constant('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $cacheAnnot->usage),
);
];
$metadata->enableCache($cacheMap);
}
@ -161,12 +161,14 @@ class AnnotationDriver extends AbstractAnnotationDriver
$namedNativeQueriesAnnot = $classAnnotations['Doctrine\ORM\Mapping\NamedNativeQueries'];
foreach ($namedNativeQueriesAnnot->value as $namedNativeQuery) {
$metadata->addNamedNativeQuery(array(
$metadata->addNamedNativeQuery(
[
'name' => $namedNativeQuery->name,
'query' => $namedNativeQuery->query,
'resultClass' => $namedNativeQuery->resultClass,
'resultSetMapping' => $namedNativeQuery->resultSetMapping,
));
]
);
}
}
@ -175,36 +177,38 @@ class AnnotationDriver extends AbstractAnnotationDriver
$sqlResultSetMappingsAnnot = $classAnnotations['Doctrine\ORM\Mapping\SqlResultSetMappings'];
foreach ($sqlResultSetMappingsAnnot->value as $resultSetMapping) {
$entities = array();
$columns = array();
$entities = [];
$columns = [];
foreach ($resultSetMapping->entities as $entityResultAnnot) {
$entityResult = array(
'fields' => array(),
$entityResult = [
'fields' => [],
'entityClass' => $entityResultAnnot->entityClass,
'discriminatorColumn' => $entityResultAnnot->discriminatorColumn,
);
];
foreach ($entityResultAnnot->fields as $fieldResultAnnot) {
$entityResult['fields'][] = array(
$entityResult['fields'][] = [
'name' => $fieldResultAnnot->name,
'column' => $fieldResultAnnot->column
);
];
}
$entities[] = $entityResult;
}
foreach ($resultSetMapping->columns as $columnResultAnnot) {
$columns[] = array(
$columns[] = [
'name' => $columnResultAnnot->name,
);
];
}
$metadata->addSqlResultSetMapping(array(
$metadata->addSqlResultSetMapping(
[
'name' => $resultSetMapping->name,
'entities' => $entities,
'columns' => $columns
));
]
);
}
}
@ -220,10 +224,12 @@ class AnnotationDriver extends AbstractAnnotationDriver
if ( ! ($namedQuery instanceof \Doctrine\ORM\Mapping\NamedQuery)) {
throw new \UnexpectedValueException("@NamedQueries should contain an array of @NamedQuery annotations.");
}
$metadata->addNamedQuery(array(
$metadata->addNamedQuery(
[
'name' => $namedQuery->name,
'query' => $namedQuery->query
));
]
);
}
}
@ -240,14 +246,16 @@ class AnnotationDriver extends AbstractAnnotationDriver
if (isset($classAnnotations['Doctrine\ORM\Mapping\DiscriminatorColumn'])) {
$discrColumnAnnot = $classAnnotations['Doctrine\ORM\Mapping\DiscriminatorColumn'];
$metadata->setDiscriminatorColumn(array(
$metadata->setDiscriminatorColumn(
[
'name' => $discrColumnAnnot->name,
'type' => $discrColumnAnnot->type ?: 'string',
'length' => $discrColumnAnnot->length ?: 255,
'columnDefinition' => $discrColumnAnnot->columnDefinition,
));
]
);
} else {
$metadata->setDiscriminatorColumn(array('name' => 'dtype', 'type' => 'string', 'length' => 255));
$metadata->setDiscriminatorColumn(['name' => 'dtype', 'type' => 'string', 'length' => 255]);
}
// Evaluate DiscriminatorMap annotation
@ -278,18 +286,21 @@ class AnnotationDriver extends AbstractAnnotationDriver
continue;
}
$mapping = array();
$mapping = [];
$mapping['fieldName'] = $property->getName();
// Evaluate @Cache annotation
if (($cacheAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\Cache')) !== null) {
$mapping['cache'] = $metadata->getAssociationCacheDefaults($mapping['fieldName'], array(
$mapping['cache'] = $metadata->getAssociationCacheDefaults(
$mapping['fieldName'],
[
'usage' => constant('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $cacheAnnot->usage),
'region' => $cacheAnnot->region,
));
]
);
}
// Check for JoinColumn/JoinColumns annotations
$joinColumns = array();
$joinColumns = [];
if ($joinColumnAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\JoinColumn')) {
$joinColumns[] = $this->joinColumnToArray($joinColumnAnnot);
@ -324,17 +335,21 @@ class AnnotationDriver extends AbstractAnnotationDriver
// Check for SequenceGenerator/TableGenerator definition
if ($seqGeneratorAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\SequenceGenerator')) {
$metadata->setSequenceGeneratorDefinition(array(
$metadata->setSequenceGeneratorDefinition(
[
'sequenceName' => $seqGeneratorAnnot->sequenceName,
'allocationSize' => $seqGeneratorAnnot->allocationSize,
'initialValue' => $seqGeneratorAnnot->initialValue
));
]
);
} else if ($this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\TableGenerator')) {
throw MappingException::tableIdGeneratorNotImplemented($className);
} else if ($customGeneratorAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\CustomIdGenerator')) {
$metadata->setCustomGeneratorDefinition(array(
$metadata->setCustomGeneratorDefinition(
[
'class' => $customGeneratorAnnot->class
));
]
);
}
} else if ($oneToOneAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\OneToOne')) {
if ($idAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\Id')) {
@ -374,13 +389,13 @@ class AnnotationDriver extends AbstractAnnotationDriver
$mapping['fetch'] = $this->getFetchMode($className, $manyToOneAnnot->fetch);
$metadata->mapManyToOne($mapping);
} else if ($manyToManyAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\ManyToMany')) {
$joinTable = array();
$joinTable = [];
if ($joinTableAnnot = $this->reader->getPropertyAnnotation($property, 'Doctrine\ORM\Mapping\JoinTable')) {
$joinTable = array(
$joinTable = [
'name' => $joinTableAnnot->name,
'schema' => $joinTableAnnot->schema
);
];
foreach ($joinTableAnnot->joinColumns as $joinColumn) {
$joinTable['joinColumns'][] = $this->joinColumnToArray($joinColumn);
@ -418,12 +433,12 @@ class AnnotationDriver extends AbstractAnnotationDriver
$associationOverridesAnnot = $classAnnotations['Doctrine\ORM\Mapping\AssociationOverrides'];
foreach ($associationOverridesAnnot->value as $associationOverride) {
$override = array();
$override = [];
$fieldName = $associationOverride->name;
// Check for JoinColumn/JoinColumns annotations
if ($associationOverride->joinColumns) {
$joinColumns = array();
$joinColumns = [];
foreach ($associationOverride->joinColumns as $joinColumn) {
$joinColumns[] = $this->joinColumnToArray($joinColumn);
@ -435,10 +450,10 @@ class AnnotationDriver extends AbstractAnnotationDriver
// Check for JoinTable annotations
if ($associationOverride->joinTable) {
$joinTableAnnot = $associationOverride->joinTable;
$joinTable = array(
$joinTable = [
'name' => $joinTableAnnot->name,
'schema' => $joinTableAnnot->schema
);
];
foreach ($joinTableAnnot->joinColumns as $joinColumn) {
$joinTable['joinColumns'][] = $this->joinColumnToArray($joinColumn);
@ -542,40 +557,40 @@ class AnnotationDriver extends AbstractAnnotationDriver
*/
private function getMethodCallbacks(\ReflectionMethod $method)
{
$callbacks = array();
$callbacks = [];
$annotations = $this->reader->getMethodAnnotations($method);
foreach ($annotations as $annot) {
if ($annot instanceof \Doctrine\ORM\Mapping\PrePersist) {
$callbacks[] = array($method->name, Events::prePersist);
$callbacks[] = [$method->name, Events::prePersist];
}
if ($annot instanceof \Doctrine\ORM\Mapping\PostPersist) {
$callbacks[] = array($method->name, Events::postPersist);
$callbacks[] = [$method->name, Events::postPersist];
}
if ($annot instanceof \Doctrine\ORM\Mapping\PreUpdate) {
$callbacks[] = array($method->name, Events::preUpdate);
$callbacks[] = [$method->name, Events::preUpdate];
}
if ($annot instanceof \Doctrine\ORM\Mapping\PostUpdate) {
$callbacks[] = array($method->name, Events::postUpdate);
$callbacks[] = [$method->name, Events::postUpdate];
}
if ($annot instanceof \Doctrine\ORM\Mapping\PreRemove) {
$callbacks[] = array($method->name, Events::preRemove);
$callbacks[] = [$method->name, Events::preRemove];
}
if ($annot instanceof \Doctrine\ORM\Mapping\PostRemove) {
$callbacks[] = array($method->name, Events::postRemove);
$callbacks[] = [$method->name, Events::postRemove];
}
if ($annot instanceof \Doctrine\ORM\Mapping\PostLoad) {
$callbacks[] = array($method->name, Events::postLoad);
$callbacks[] = [$method->name, Events::postLoad];
}
if ($annot instanceof \Doctrine\ORM\Mapping\PreFlush) {
$callbacks[] = array($method->name, Events::preFlush);
$callbacks[] = [$method->name, Events::preFlush];
}
}
@ -590,14 +605,14 @@ class AnnotationDriver extends AbstractAnnotationDriver
*/
private function joinColumnToArray(JoinColumn $joinColumn)
{
return array(
return [
'name' => $joinColumn->name,
'unique' => $joinColumn->unique,
'nullable' => $joinColumn->nullable,
'onDelete' => $joinColumn->onDelete,
'columnDefinition' => $joinColumn->columnDefinition,
'referencedColumnName' => $joinColumn->referencedColumnName,
);
];
}
/**
@ -610,7 +625,7 @@ class AnnotationDriver extends AbstractAnnotationDriver
*/
private function columnToArray($fieldName, Column $column)
{
$mapping = array(
$mapping = [
'fieldName' => $fieldName,
'type' => $column->type,
'scale' => $column->scale,
@ -618,7 +633,7 @@ class AnnotationDriver extends AbstractAnnotationDriver
'unique' => $column->unique,
'nullable' => $column->nullable,
'precision' => $column->precision
);
];
if ($column->options) {
$mapping['options'] = $column->options;
@ -643,7 +658,7 @@ class AnnotationDriver extends AbstractAnnotationDriver
*
* @return AnnotationDriver
*/
static public function create($paths = array(), AnnotationReader $reader = null)
static public function create($paths = [], AnnotationReader $reader = null)
{
if ($reader == null) {
$reader = new AnnotationReader();

View File

@ -54,22 +54,22 @@ class DatabaseDriver implements MappingDriver
/**
* @var array
*/
private $classToTableNames = array();
private $classToTableNames = [];
/**
* @var array
*/
private $manyToManyTables = array();
private $manyToManyTables = [];
/**
* @var array
*/
private $classNamesForTables = array();
private $classNamesForTables = [];
/**
* @var array
*/
private $fieldNamesForColumns = array();
private $fieldNamesForColumns = [];
/**
* The namespace for the generated entities.
@ -153,7 +153,7 @@ class DatabaseDriver implements MappingDriver
*/
public function setTables($entityTables, $manyToManyTables)
{
$this->tables = $this->manyToManyTables = $this->classToTableNames = array();
$this->tables = $this->manyToManyTables = $this->classToTableNames = [];
foreach ($entityTables as $table) {
$className = $this->getClassNameForTable($table->getName());
@ -212,36 +212,36 @@ class DatabaseDriver implements MappingDriver
$localColumn = current($myFk->getColumns());
$associationMapping = array();
$associationMapping = [];
$associationMapping['fieldName'] = $this->getFieldNameForColumn($manyTable->getName(), current($otherFk->getColumns()), true);
$associationMapping['targetEntity'] = $this->getClassNameForTable($otherFk->getForeignTableName());
if (current($manyTable->getColumns())->getName() == $localColumn) {
$associationMapping['inversedBy'] = $this->getFieldNameForColumn($manyTable->getName(), current($myFk->getColumns()), true);
$associationMapping['joinTable'] = array(
$associationMapping['joinTable'] = [
'name' => strtolower($manyTable->getName()),
'joinColumns' => array(),
'inverseJoinColumns' => array(),
);
'joinColumns' => [],
'inverseJoinColumns' => [],
];
$fkCols = $myFk->getForeignColumns();
$cols = $myFk->getColumns();
for ($i = 0, $colsCount = count($cols); $i < $colsCount; $i++) {
$associationMapping['joinTable']['joinColumns'][] = array(
$associationMapping['joinTable']['joinColumns'][] = [
'name' => $cols[$i],
'referencedColumnName' => $fkCols[$i],
);
];
}
$fkCols = $otherFk->getForeignColumns();
$cols = $otherFk->getColumns();
for ($i = 0, $colsCount = count($cols); $i < $colsCount; $i++) {
$associationMapping['joinTable']['inverseJoinColumns'][] = array(
$associationMapping['joinTable']['inverseJoinColumns'][] = [
'name' => $cols[$i],
'referencedColumnName' => $fkCols[$i],
);
];
}
} else {
$associationMapping['mappedBy'] = $this->getFieldNameForColumn($manyTable->getName(), current($myFk->getColumns()), true);
@ -265,20 +265,20 @@ class DatabaseDriver implements MappingDriver
return;
}
$tables = array();
$tables = [];
foreach ($this->_sm->listTableNames() as $tableName) {
$tables[$tableName] = $this->_sm->listTableDetails($tableName);
}
$this->tables = $this->manyToManyTables = $this->classToTableNames = array();
$this->tables = $this->manyToManyTables = $this->classToTableNames = [];
foreach ($tables as $tableName => $table) {
$foreignKeys = ($this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints())
? $table->getForeignKeys()
: array();
: [];
$allForeignKeyColumns = array();
$allForeignKeyColumns = [];
foreach ($foreignKeys as $foreignKey) {
$allForeignKeyColumns = array_merge($allForeignKeyColumns, $foreignKey->getLocalColumns());
@ -345,14 +345,14 @@ class DatabaseDriver implements MappingDriver
$columns = $this->tables[$tableName]->getColumns();
$primaryKeys = $this->getTablePrimaryKeys($this->tables[$tableName]);
$foreignKeys = $this->getTableForeignKeys($this->tables[$tableName]);
$allForeignKeys = array();
$allForeignKeys = [];
foreach ($foreignKeys as $foreignKey) {
$allForeignKeys = array_merge($allForeignKeys, $foreignKey->getLocalColumns());
}
$ids = array();
$fieldMappings = array();
$ids = [];
$fieldMappings = [];
foreach ($columns as $column) {
if (in_array($column->getName(), $allForeignKeys)) {
@ -389,12 +389,12 @@ class DatabaseDriver implements MappingDriver
*/
private function buildFieldMapping($tableName, Column $column)
{
$fieldMapping = array(
$fieldMapping = [
'fieldName' => $this->getFieldNameForColumn($tableName, $column->getName(), false),
'columnName' => $column->getName(),
'type' => $column->getType()->getName(),
'nullable' => ( ! $column->getNotNull()),
);
];
// Type specific elements
switch ($fieldMapping['type']) {
@ -452,10 +452,10 @@ class DatabaseDriver implements MappingDriver
$fkColumns = $foreignKey->getColumns();
$fkForeignColumns = $foreignKey->getForeignColumns();
$localColumn = current($fkColumns);
$associationMapping = array(
$associationMapping = [
'fieldName' => $this->getFieldNameForColumn($tableName, $localColumn, true),
'targetEntity' => $this->getClassNameForTable($foreignTableName),
);
];
if (isset($metadata->fieldMappings[$associationMapping['fieldName']])) {
$associationMapping['fieldName'] .= '2'; // "foo" => "foo2"
@ -466,10 +466,10 @@ class DatabaseDriver implements MappingDriver
}
for ($i = 0, $fkColumnsCount = count($fkColumns); $i < $fkColumnsCount; $i++) {
$associationMapping['joinColumns'][] = array(
$associationMapping['joinColumns'][] = [
'name' => $fkColumns[$i],
'referencedColumnName' => $fkForeignColumns[$i],
);
];
}
// Here we need to check if $fkColumns are the same as $primaryKeys
@ -492,7 +492,7 @@ class DatabaseDriver implements MappingDriver
{
return ($this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints())
? $table->getForeignKeys()
: array();
: [];
}
/**
@ -510,7 +510,7 @@ class DatabaseDriver implements MappingDriver
// Do nothing
}
return array();
return [];
}
/**

View File

@ -76,7 +76,7 @@ class XmlDriver extends FileDriver
}
// Evaluate <entity...> attributes
$primaryTable = array();
$primaryTable = [];
if (isset($xmlRoot['table'])) {
$primaryTable['name'] = (string) $xmlRoot['table'];
@ -96,44 +96,48 @@ class XmlDriver extends FileDriver
// Evaluate named queries
if (isset($xmlRoot->{'named-queries'})) {
foreach ($xmlRoot->{'named-queries'}->{'named-query'} as $namedQueryElement) {
$metadata->addNamedQuery(array(
$metadata->addNamedQuery(
[
'name' => (string) $namedQueryElement['name'],
'query' => (string) $namedQueryElement['query']
));
]
);
}
}
// Evaluate native named queries
if (isset($xmlRoot->{'named-native-queries'})) {
foreach ($xmlRoot->{'named-native-queries'}->{'named-native-query'} as $nativeQueryElement) {
$metadata->addNamedNativeQuery(array(
$metadata->addNamedNativeQuery(
[
'name' => isset($nativeQueryElement['name']) ? (string) $nativeQueryElement['name'] : null,
'query' => isset($nativeQueryElement->query) ? (string) $nativeQueryElement->query : null,
'resultClass' => isset($nativeQueryElement['result-class']) ? (string) $nativeQueryElement['result-class'] : null,
'resultSetMapping' => isset($nativeQueryElement['result-set-mapping']) ? (string) $nativeQueryElement['result-set-mapping'] : null,
));
]
);
}
}
// Evaluate sql result set mapping
if (isset($xmlRoot->{'sql-result-set-mappings'})) {
foreach ($xmlRoot->{'sql-result-set-mappings'}->{'sql-result-set-mapping'} as $rsmElement) {
$entities = array();
$columns = array();
$entities = [];
$columns = [];
foreach ($rsmElement as $entityElement) {
//<entity-result/>
if (isset($entityElement['entity-class'])) {
$entityResult = array(
'fields' => array(),
$entityResult = [
'fields' => [],
'entityClass' => (string) $entityElement['entity-class'],
'discriminatorColumn' => isset($entityElement['discriminator-column']) ? (string) $entityElement['discriminator-column'] : null,
);
];
foreach ($entityElement as $fieldElement) {
$entityResult['fields'][] = array(
$entityResult['fields'][] = [
'name' => isset($fieldElement['name']) ? (string) $fieldElement['name'] : null,
'column' => isset($fieldElement['column']) ? (string) $fieldElement['column'] : null,
);
];
}
$entities[] = $entityResult;
@ -141,17 +145,19 @@ class XmlDriver extends FileDriver
//<column-result/>
if (isset($entityElement['name'])) {
$columns[] = array(
$columns[] = [
'name' => (string) $entityElement['name'],
);
];
}
}
$metadata->addSqlResultSetMapping(array(
$metadata->addSqlResultSetMapping(
[
'name' => (string) $rsmElement['name'],
'entities' => $entities,
'columns' => $columns
));
]
);
}
}
@ -163,19 +169,21 @@ class XmlDriver extends FileDriver
// Evaluate <discriminator-column...>
if (isset($xmlRoot->{'discriminator-column'})) {
$discrColumn = $xmlRoot->{'discriminator-column'};
$metadata->setDiscriminatorColumn(array(
$metadata->setDiscriminatorColumn(
[
'name' => isset($discrColumn['name']) ? (string) $discrColumn['name'] : null,
'type' => isset($discrColumn['type']) ? (string) $discrColumn['type'] : 'string',
'length' => isset($discrColumn['length']) ? (string) $discrColumn['length'] : 255,
'columnDefinition' => isset($discrColumn['column-definition']) ? (string) $discrColumn['column-definition'] : null
));
]
);
} else {
$metadata->setDiscriminatorColumn(array('name' => 'dtype', 'type' => 'string', 'length' => 255));
$metadata->setDiscriminatorColumn(['name' => 'dtype', 'type' => 'string', 'length' => 255]);
}
// Evaluate <discriminator-map...>
if (isset($xmlRoot->{'discriminator-map'})) {
$map = array();
$map = [];
foreach ($xmlRoot->{'discriminator-map'}->{'discriminator-mapping'} as $discrMapElement) {
$map[(string) $discrMapElement['value']] = (string) $discrMapElement['class'];
}
@ -193,9 +201,9 @@ class XmlDriver extends FileDriver
// Evaluate <indexes...>
if (isset($xmlRoot->indexes)) {
$metadata->table['indexes'] = array();
$metadata->table['indexes'] = [];
foreach ($xmlRoot->indexes->index as $indexXml) {
$index = array('columns' => explode(',', (string) $indexXml['columns']));
$index = ['columns' => explode(',', (string) $indexXml['columns'])];
if (isset($indexXml['flags'])) {
$index['flags'] = explode(',', (string) $indexXml['flags']);
@ -215,10 +223,9 @@ class XmlDriver extends FileDriver
// Evaluate <unique-constraints..>
if (isset($xmlRoot->{'unique-constraints'})) {
$metadata->table['uniqueConstraints'] = array();
$metadata->table['uniqueConstraints'] = [];
foreach ($xmlRoot->{'unique-constraints'}->{'unique-constraint'} as $uniqueXml) {
$unique = array('columns' => explode(',', (string) $uniqueXml['columns']));
$unique = ['columns' => explode(',', (string) $uniqueXml['columns'])];
if (isset($uniqueXml->options)) {
$unique['options'] = $this->_parseOptions($uniqueXml->options->children());
@ -238,7 +245,7 @@ class XmlDriver extends FileDriver
// The mapping assignment is done in 2 times as a bug might occurs on some php/xml lib versions
// The internal SimpleXmlIterator get resetted, to this generate a duplicate field exception
$mappings = array();
$mappings = [];
// Evaluate <field ...> mappings
if (isset($xmlRoot->field)) {
foreach ($xmlRoot->field as $fieldMapping) {
@ -263,11 +270,11 @@ class XmlDriver extends FileDriver
? $this->evaluateBoolean($embeddedMapping['use-column-prefix'])
: true;
$mapping = array(
$mapping = [
'fieldName' => (string) $embeddedMapping['name'],
'class' => (string) $embeddedMapping['class'],
'columnPrefix' => $useColumnPrefix ? $columnPrefix : false
);
];
$metadata->mapEmbedded($mapping);
}
@ -282,17 +289,17 @@ class XmlDriver extends FileDriver
}
// Evaluate <id ...> mappings
$associationIds = array();
$associationIds = [];
foreach ($xmlRoot->id as $idElement) {
if (isset($idElement['association-key']) && $this->evaluateBoolean($idElement['association-key'])) {
$associationIds[(string) $idElement['name']] = true;
continue;
}
$mapping = array(
$mapping = [
'id' => true,
'fieldName' => (string) $idElement['name']
);
];
if (isset($idElement['type'])) {
$mapping['type'] = (string) $idElement['type'];
@ -326,16 +333,20 @@ class XmlDriver extends FileDriver
// Check for SequenceGenerator/TableGenerator definition
if (isset($idElement->{'sequence-generator'})) {
$seqGenerator = $idElement->{'sequence-generator'};
$metadata->setSequenceGeneratorDefinition(array(
$metadata->setSequenceGeneratorDefinition(
[
'sequenceName' => (string) $seqGenerator['sequence-name'],
'allocationSize' => (string) $seqGenerator['allocation-size'],
'initialValue' => (string) $seqGenerator['initial-value']
));
]
);
} else if (isset($idElement->{'custom-id-generator'})) {
$customGenerator = $idElement->{'custom-id-generator'};
$metadata->setCustomGeneratorDefinition(array(
$metadata->setCustomGeneratorDefinition(
[
'class' => (string) $customGenerator['class']
));
]
);
} else if (isset($idElement->{'table-generator'})) {
throw MappingException::tableIdGeneratorNotImplemented($className);
}
@ -344,10 +355,10 @@ class XmlDriver extends FileDriver
// Evaluate <one-to-one ...> mappings
if (isset($xmlRoot->{'one-to-one'})) {
foreach ($xmlRoot->{'one-to-one'} as $oneToOneElement) {
$mapping = array(
$mapping = [
'fieldName' => (string) $oneToOneElement['field'],
'targetEntity' => (string) $oneToOneElement['target-entity']
);
];
if (isset($associationIds[$mapping['fieldName']])) {
$mapping['id'] = true;
@ -363,7 +374,7 @@ class XmlDriver extends FileDriver
if (isset($oneToOneElement['inversed-by'])) {
$mapping['inversedBy'] = (string) $oneToOneElement['inversed-by'];
}
$joinColumns = array();
$joinColumns = [];
if (isset($oneToOneElement->{'join-column'})) {
$joinColumns[] = $this->joinColumnToArray($oneToOneElement->{'join-column'});
@ -396,11 +407,11 @@ class XmlDriver extends FileDriver
// Evaluate <one-to-many ...> mappings
if (isset($xmlRoot->{'one-to-many'})) {
foreach ($xmlRoot->{'one-to-many'} as $oneToManyElement) {
$mapping = array(
$mapping = [
'fieldName' => (string) $oneToManyElement['field'],
'targetEntity' => (string) $oneToManyElement['target-entity'],
'mappedBy' => (string) $oneToManyElement['mapped-by']
);
];
if (isset($oneToManyElement['fetch'])) {
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string) $oneToManyElement['fetch']);
@ -415,7 +426,7 @@ class XmlDriver extends FileDriver
}
if (isset($oneToManyElement->{'order-by'})) {
$orderBy = array();
$orderBy = [];
foreach ($oneToManyElement->{'order-by'}->{'order-by-field'} as $orderByField) {
$orderBy[(string) $orderByField['name']] = (string) $orderByField['direction'];
}
@ -440,10 +451,10 @@ class XmlDriver extends FileDriver
// Evaluate <many-to-one ...> mappings
if (isset($xmlRoot->{'many-to-one'})) {
foreach ($xmlRoot->{'many-to-one'} as $manyToOneElement) {
$mapping = array(
$mapping = [
'fieldName' => (string) $manyToOneElement['field'],
'targetEntity' => (string) $manyToOneElement['target-entity']
);
];
if (isset($associationIds[$mapping['fieldName']])) {
$mapping['id'] = true;
@ -457,7 +468,7 @@ class XmlDriver extends FileDriver
$mapping['inversedBy'] = (string) $manyToOneElement['inversed-by'];
}
$joinColumns = array();
$joinColumns = [];
if (isset($manyToOneElement->{'join-column'})) {
$joinColumns[] = $this->joinColumnToArray($manyToOneElement->{'join-column'});
@ -486,10 +497,10 @@ class XmlDriver extends FileDriver
// Evaluate <many-to-many ...> mappings
if (isset($xmlRoot->{'many-to-many'})) {
foreach ($xmlRoot->{'many-to-many'} as $manyToManyElement) {
$mapping = array(
$mapping = [
'fieldName' => (string) $manyToManyElement['field'],
'targetEntity' => (string) $manyToManyElement['target-entity']
);
];
if (isset($manyToManyElement['fetch'])) {
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string) $manyToManyElement['fetch']);
@ -507,9 +518,9 @@ class XmlDriver extends FileDriver
}
$joinTableElement = $manyToManyElement->{'join-table'};
$joinTable = array(
$joinTable = [
'name' => (string) $joinTableElement['name']
);
];
if (isset($joinTableElement['schema'])) {
$joinTable['schema'] = (string) $joinTableElement['schema'];
@ -531,7 +542,7 @@ class XmlDriver extends FileDriver
}
if (isset($manyToManyElement->{'order-by'})) {
$orderBy = array();
$orderBy = [];
foreach ($manyToManyElement->{'order-by'}->{'order-by-field'} as $orderByField) {
$orderBy[(string) $orderByField['name']] = (string) $orderByField['direction'];
}
@ -569,11 +580,11 @@ class XmlDriver extends FileDriver
if (isset($xmlRoot->{'association-overrides'})) {
foreach ($xmlRoot->{'association-overrides'}->{'association-override'} as $overrideElement) {
$fieldName = (string) $overrideElement['name'];
$override = array();
$override = [];
// Check for join-columns
if (isset($overrideElement->{'join-columns'})) {
$joinColumns = array();
$joinColumns = [];
foreach ($overrideElement->{'join-columns'}->{'join-column'} as $joinColumnElement) {
$joinColumns[] = $this->joinColumnToArray($joinColumnElement);
}
@ -585,10 +596,10 @@ class XmlDriver extends FileDriver
$joinTable = null;
$joinTableElement = $overrideElement->{'join-table'};
$joinTable = array(
$joinTable = [
'name' => (string) $joinTableElement['name'],
'schema' => (string) $joinTableElement['schema']
);
];
if (isset($joinTableElement->{'join-columns'})) {
foreach ($joinTableElement->{'join-columns'}->{'join-column'} as $joinColumnElement) {
@ -651,7 +662,7 @@ class XmlDriver extends FileDriver
*/
private function _parseOptions(SimpleXMLElement $options)
{
$array = array();
$array = [];
/* @var $option SimpleXMLElement */
foreach ($options as $option) {
@ -686,10 +697,10 @@ class XmlDriver extends FileDriver
*/
private function joinColumnToArray(SimpleXMLElement $joinColumnElement)
{
$joinColumn = array(
$joinColumn = [
'name' => (string) $joinColumnElement['name'],
'referencedColumnName' => (string) $joinColumnElement['referenced-column-name']
);
];
if (isset($joinColumnElement['unique'])) {
$joinColumn['unique'] = $this->evaluateBoolean($joinColumnElement['unique']);
@ -719,9 +730,9 @@ class XmlDriver extends FileDriver
*/
private function columnToArray(SimpleXMLElement $fieldMapping)
{
$mapping = array(
$mapping = [
'fieldName' => (string) $fieldMapping['name'],
);
];
if (isset($fieldMapping['type'])) {
$mapping['type'] = (string) $fieldMapping['type'];
@ -786,10 +797,10 @@ class XmlDriver extends FileDriver
$usage = constant('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $usage);
}
return array(
return [
'usage' => $usage,
'region' => $region,
);
];
}
/**
@ -801,7 +812,7 @@ class XmlDriver extends FileDriver
*/
private function _getCascadeMappings(SimpleXMLElement $cascadeElement)
{
$cascades = array();
$cascades = [];
/* @var $action SimpleXmlElement */
foreach ($cascadeElement->children() as $action) {
// According to the JPA specifications, XML uses "cascade-persist"
@ -820,7 +831,7 @@ class XmlDriver extends FileDriver
*/
protected function loadMappingFile($file)
{
$result = array();
$result = [];
$xmlElement = simplexml_load_file($file);
if (isset($xmlElement->entity)) {

View File

@ -73,7 +73,7 @@ class YamlDriver extends FileDriver
}
// Evaluate root level properties
$primaryTable = array();
$primaryTable = [];
if (isset($element['table'])) {
$primaryTable['name'] = $element['table'];
@ -94,7 +94,7 @@ class YamlDriver extends FileDriver
if (isset($element['namedQueries'])) {
foreach ($element['namedQueries'] as $name => $queryMapping) {
if (is_string($queryMapping)) {
$queryMapping = array('query' => $queryMapping);
$queryMapping = ['query' => $queryMapping];
}
if ( ! isset($queryMapping['name'])) {
@ -111,12 +111,14 @@ class YamlDriver extends FileDriver
if (!isset($mappingElement['name'])) {
$mappingElement['name'] = $name;
}
$metadata->addNamedNativeQuery(array(
$metadata->addNamedNativeQuery(
[
'name' => $mappingElement['name'],
'query' => isset($mappingElement['query']) ? $mappingElement['query'] : null,
'resultClass' => isset($mappingElement['resultClass']) ? $mappingElement['resultClass'] : null,
'resultSetMapping' => isset($mappingElement['resultSetMapping']) ? $mappingElement['resultSetMapping'] : null,
));
]
);
}
}
@ -127,22 +129,22 @@ class YamlDriver extends FileDriver
$resultSetMapping['name'] = $name;
}
$entities = array();
$columns = array();
$entities = [];
$columns = [];
if (isset($resultSetMapping['entityResult'])) {
foreach ($resultSetMapping['entityResult'] as $entityResultElement) {
$entityResult = array(
'fields' => array(),
$entityResult = [
'fields' => [],
'entityClass' => isset($entityResultElement['entityClass']) ? $entityResultElement['entityClass'] : null,
'discriminatorColumn' => isset($entityResultElement['discriminatorColumn']) ? $entityResultElement['discriminatorColumn'] : null,
);
];
if (isset($entityResultElement['fieldResult'])) {
foreach ($entityResultElement['fieldResult'] as $fieldResultElement) {
$entityResult['fields'][] = array(
$entityResult['fields'][] = [
'name' => isset($fieldResultElement['name']) ? $fieldResultElement['name'] : null,
'column' => isset($fieldResultElement['column']) ? $fieldResultElement['column'] : null,
);
];
}
}
@ -153,17 +155,19 @@ class YamlDriver extends FileDriver
if (isset($resultSetMapping['columnResult'])) {
foreach ($resultSetMapping['columnResult'] as $columnResultAnnot) {
$columns[] = array(
$columns[] = [
'name' => isset($columnResultAnnot['name']) ? $columnResultAnnot['name'] : null,
);
];
}
}
$metadata->addSqlResultSetMapping(array(
$metadata->addSqlResultSetMapping(
[
'name' => $resultSetMapping['name'],
'entities' => $entities,
'columns' => $columns
));
]
);
}
}
@ -174,14 +178,16 @@ class YamlDriver extends FileDriver
// Evaluate discriminatorColumn
if (isset($element['discriminatorColumn'])) {
$discrColumn = $element['discriminatorColumn'];
$metadata->setDiscriminatorColumn(array(
$metadata->setDiscriminatorColumn(
[
'name' => isset($discrColumn['name']) ? (string) $discrColumn['name'] : null,
'type' => isset($discrColumn['type']) ? (string) $discrColumn['type'] : 'string',
'length' => isset($discrColumn['length']) ? (string) $discrColumn['length'] : 255,
'columnDefinition' => isset($discrColumn['columnDefinition']) ? (string) $discrColumn['columnDefinition'] : null
));
]
);
} else {
$metadata->setDiscriminatorColumn(array('name' => 'dtype', 'type' => 'string', 'length' => 255));
$metadata->setDiscriminatorColumn(['name' => 'dtype', 'type' => 'string', 'length' => 255]);
}
// Evaluate discriminatorMap
@ -206,9 +212,9 @@ class YamlDriver extends FileDriver
}
if (is_string($indexYml['columns'])) {
$index = array('columns' => array_map('trim', explode(',', $indexYml['columns'])));
$index = ['columns' => array_map('trim', explode(',', $indexYml['columns']))];
} else {
$index = array('columns' => $indexYml['columns']);
$index = ['columns' => $indexYml['columns']];
}
if (isset($indexYml['flags'])) {
@ -235,9 +241,9 @@ class YamlDriver extends FileDriver
}
if (is_string($uniqueYml['columns'])) {
$unique = array('columns' => array_map('trim', explode(',', $uniqueYml['columns'])));
$unique = ['columns' => array_map('trim', explode(',', $uniqueYml['columns']))];
} else {
$unique = array('columns' => $uniqueYml['columns']);
$unique = ['columns' => $uniqueYml['columns']];
}
if (isset($uniqueYml['options'])) {
@ -252,7 +258,7 @@ class YamlDriver extends FileDriver
$metadata->table['options'] = $element['options'];
}
$associationIds = array();
$associationIds = [];
if (isset($element['id'])) {
// Evaluate identifier settings
foreach ($element['id'] as $name => $idElement) {
@ -261,10 +267,10 @@ class YamlDriver extends FileDriver
continue;
}
$mapping = array(
$mapping = [
'id' => true,
'fieldName' => $name
);
];
if (isset($idElement['type'])) {
$mapping['type'] = $idElement['type'];
@ -297,9 +303,11 @@ class YamlDriver extends FileDriver
$metadata->setSequenceGeneratorDefinition($idElement['sequenceGenerator']);
} else if (isset($idElement['customIdGenerator'])) {
$customGenerator = $idElement['customIdGenerator'];
$metadata->setCustomGeneratorDefinition(array(
$metadata->setCustomGeneratorDefinition(
[
'class' => (string) $customGenerator['class']
));
]
);
} else if (isset($idElement['tableGenerator'])) {
throw MappingException::tableIdGeneratorNotImplemented($className);
}
@ -331,11 +339,11 @@ class YamlDriver extends FileDriver
if (isset($element['embedded'])) {
foreach ($element['embedded'] as $name => $embeddedMapping) {
$mapping = array(
$mapping = [
'fieldName' => $name,
'class' => $embeddedMapping['class'],
'columnPrefix' => isset($embeddedMapping['columnPrefix']) ? $embeddedMapping['columnPrefix'] : null,
);
];
$metadata->mapEmbedded($mapping);
}
}
@ -343,10 +351,10 @@ class YamlDriver extends FileDriver
// Evaluate oneToOne relationships
if (isset($element['oneToOne'])) {
foreach ($element['oneToOne'] as $name => $oneToOneElement) {
$mapping = array(
$mapping = [
'fieldName' => $name,
'targetEntity' => $oneToOneElement['targetEntity']
);
];
if (isset($associationIds[$mapping['fieldName']])) {
$mapping['id'] = true;
@ -363,7 +371,7 @@ class YamlDriver extends FileDriver
$mapping['inversedBy'] = $oneToOneElement['inversedBy'];
}
$joinColumns = array();
$joinColumns = [];
if (isset($oneToOneElement['joinColumn'])) {
$joinColumns[] = $this->joinColumnToArray($oneToOneElement['joinColumn']);
@ -400,11 +408,11 @@ class YamlDriver extends FileDriver
// Evaluate oneToMany relationships
if (isset($element['oneToMany'])) {
foreach ($element['oneToMany'] as $name => $oneToManyElement) {
$mapping = array(
$mapping = [
'fieldName' => $name,
'targetEntity' => $oneToManyElement['targetEntity'],
'mappedBy' => $oneToManyElement['mappedBy']
);
];
if (isset($oneToManyElement['fetch'])) {
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $oneToManyElement['fetch']);
@ -439,10 +447,10 @@ class YamlDriver extends FileDriver
// Evaluate manyToOne relationships
if (isset($element['manyToOne'])) {
foreach ($element['manyToOne'] as $name => $manyToOneElement) {
$mapping = array(
$mapping = [
'fieldName' => $name,
'targetEntity' => $manyToOneElement['targetEntity']
);
];
if (isset($associationIds[$mapping['fieldName']])) {
$mapping['id'] = true;
@ -456,7 +464,7 @@ class YamlDriver extends FileDriver
$mapping['inversedBy'] = $manyToOneElement['inversedBy'];
}
$joinColumns = array();
$joinColumns = [];
if (isset($manyToOneElement['joinColumn'])) {
$joinColumns[] = $this->joinColumnToArray($manyToOneElement['joinColumn']);
@ -488,10 +496,10 @@ class YamlDriver extends FileDriver
// Evaluate manyToMany relationships
if (isset($element['manyToMany'])) {
foreach ($element['manyToMany'] as $name => $manyToManyElement) {
$mapping = array(
$mapping = [
'fieldName' => $name,
'targetEntity' => $manyToManyElement['targetEntity']
);
];
if (isset($manyToManyElement['fetch'])) {
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $manyToManyElement['fetch']);
@ -502,9 +510,9 @@ class YamlDriver extends FileDriver
} else if (isset($manyToManyElement['joinTable'])) {
$joinTableElement = $manyToManyElement['joinTable'];
$joinTable = array(
$joinTable = [
'name' => $joinTableElement['name']
);
];
if (isset($joinTableElement['schema'])) {
$joinTable['schema'] = $joinTableElement['schema'];
@ -564,11 +572,11 @@ class YamlDriver extends FileDriver
if (isset($element['associationOverride']) && is_array($element['associationOverride'])) {
foreach ($element['associationOverride'] as $fieldName => $associationOverrideElement) {
$override = array();
$override = [];
// Check for joinColumn
if (isset($associationOverrideElement['joinColumn'])) {
$joinColumns = array();
$joinColumns = [];
foreach ($associationOverrideElement['joinColumn'] as $name => $joinColumnElement) {
if ( ! isset($joinColumnElement['name'])) {
$joinColumnElement['name'] = $name;
@ -582,9 +590,9 @@ class YamlDriver extends FileDriver
if (isset($associationOverrideElement['joinTable'])) {
$joinTableElement = $associationOverrideElement['joinTable'];
$joinTable = array(
$joinTable = [
'name' => $joinTableElement['name']
);
];
if (isset($joinTableElement['schema'])) {
$joinTable['schema'] = $joinTableElement['schema'];
@ -665,7 +673,7 @@ class YamlDriver extends FileDriver
*/
private function joinColumnToArray($joinColumnElement)
{
$joinColumn = array();
$joinColumn = [];
if (isset($joinColumnElement['referencedColumnName'])) {
$joinColumn['referencedColumnName'] = (string) $joinColumnElement['referencedColumnName'];
}
@ -707,9 +715,9 @@ class YamlDriver extends FileDriver
*/
private function columnToArray($fieldName, $column)
{
$mapping = array(
$mapping = [
'fieldName' => $fieldName
);
];
if (isset($column['type'])) {
$params = explode('(', $column['type']);
@ -781,10 +789,10 @@ class YamlDriver extends FileDriver
$usage = constant('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $usage);
}
return array(
return [
'usage' => $usage,
'region' => $region,
);
];
}
/**

View File

@ -37,5 +37,5 @@ final class EntityListeners implements Annotation
*
* @var array<string>
*/
public $value = array();
public $value = [];
}

View File

@ -45,7 +45,7 @@ final class EntityResult implements Annotation
*
* @var array<\Doctrine\ORM\Mapping\FieldResult>
*/
public $fields = array();
public $fields = [];
/**
* Specifies the column name of the column in the SELECT list that is used to determine the type of the entity instance.

View File

@ -38,10 +38,10 @@ final class JoinTable implements Annotation
/**
* @var array<\Doctrine\ORM\Mapping\JoinColumn>
*/
public $joinColumns = array();
public $joinColumns = [];
/**
* @var array<\Doctrine\ORM\Mapping\JoinColumn>
*/
public $inverseJoinColumns = array();
public $inverseJoinColumns = [];
}

View File

@ -36,5 +36,5 @@ final class NamedNativeQueries implements Annotation
*
* @var array<\Doctrine\ORM\Mapping\NamedNativeQuery>
*/
public $value = array();
public $value = [];
}

View File

@ -43,12 +43,12 @@ final class SqlResultSetMapping implements Annotation
*
* @var array<\Doctrine\ORM\Mapping\EntityResult>
*/
public $entities = array();
public $entities = [];
/**
* Specifies the result set mapping to scalar values.
*
* @var array<\Doctrine\ORM\Mapping\ColumnResult>
*/
public $columns = array();
public $columns = [];
}

View File

@ -36,5 +36,5 @@ final class SqlResultSetMappings implements Annotation
*
* @var array<\Doctrine\ORM\Mapping\SqlResultSetMapping>
*/
public $value = array();
public $value = [];
}

View File

@ -48,5 +48,5 @@ final class Table implements Annotation
/**
* @var array
*/
public $options = array();
public $options = [];
}

View File

@ -63,8 +63,8 @@ final class NativeQuery extends AbstractQuery
*/
protected function _doExecute()
{
$parameters = array();
$types = array();
$parameters = [];
$types = [];
foreach ($this->getParameters() as $parameter) {
$name = $parameter->getName();

View File

@ -49,7 +49,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
*
* @var array
*/
private $snapshot = array();
private $snapshot = [];
/**
* The entity that owns this collection.
@ -585,7 +585,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
*/
public function __sleep()
{
return array('collection', 'initialized');
return ['collection', 'initialized'];
}
/**
@ -633,7 +633,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
$this->initialize();
$this->owner = null;
$this->snapshot = array();
$this->snapshot = [];
$this->changed();
}
@ -695,7 +695,7 @@ final class PersistentCollection extends AbstractLazyCollection implements Selec
protected function doInitialize()
{
// Has NEW objects added through add(). Remember them.
$newObjects = array();
$newObjects = [];
if ($this->isDirty) {
$newObjects = $this->collection->toArray();

View File

@ -47,7 +47,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
return; // ignore inverse side
}
$types = array();
$types = [];
$class = $this->em->getClassMetadata($mapping['sourceEntity']);
foreach ($mapping['joinTable']['joinColumns'] as $joinColumn) {
@ -104,7 +104,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
? $mapping['inversedBy']
: $mapping['mappedBy'];
return $persister->load(array($mappedKey => $collection->getOwner(), $mapping['indexBy'] => $index), null, $mapping, array(), 0, 1);
return $persister->load([$mappedKey => $collection->getOwner(), $mapping['indexBy'] => $index], null, $mapping, [], 0, 1);
}
/**
@ -112,9 +112,9 @@ class ManyToManyPersister extends AbstractCollectionPersister
*/
public function count(PersistentCollection $collection)
{
$conditions = array();
$params = array();
$types = array();
$conditions = [];
$params = [];
$types = [];
$mapping = $collection->getMapping();
$id = $this->uow->getEntityIdentifier($collection->getOwner());
$sourceClass = $this->em->getClassMetadata($mapping['sourceEntity']);
@ -238,7 +238,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
$id = $this->uow->getEntityIdentifier($owner);
$targetClass = $this->em->getClassMetadata($mapping['targetEntity']);
$onConditions = $this->getOnConditionSQL($mapping);
$whereClauses = $params = array();
$whereClauses = $params = [];
if ( ! $mapping['isOwningSide']) {
$associationSourceClass = $targetClass;
@ -311,7 +311,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
$filterSql = $this->generateFilterConditionSQL($rootClass, 'te');
if ('' === $filterSql) {
return array('', '');
return ['', ''];
}
// A join is needed if there is filtering on the target entity
@ -319,7 +319,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
$joinSql = ' JOIN ' . $tableName . ' te'
. ' ON' . implode(' AND ', $this->getOnConditionSQL($mapping));
return array($joinSql, $filterSql);
return [$joinSql, $filterSql];
}
/**
@ -332,7 +332,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
*/
protected function generateFilterConditionSQL(ClassMetadata $targetEntity, $targetTableAlias)
{
$filterClauses = array();
$filterClauses = [];
foreach ($this->em->getFilters()->getEnabledFilters() as $filter) {
if ($filterExpr = $filter->addFilterConstraint($targetEntity, $targetTableAlias)) {
@ -363,7 +363,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
? $association['joinTable']['inverseJoinColumns']
: $association['joinTable']['joinColumns'];
$conditions = array();
$conditions = [];
foreach ($joinColumns as $joinColumn) {
$joinColumnName = $this->quoteStrategy->getJoinColumnName($joinColumn, $targetClass, $this->platform);
@ -382,7 +382,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
*/
protected function getDeleteSQL(PersistentCollection $collection)
{
$columns = array();
$columns = [];
$mapping = $collection->getMapping();
$class = $this->em->getClassMetadata(get_class($collection->getOwner()));
$joinTable = $this->quoteStrategy->getJoinTableName($mapping, $class, $this->platform);
@ -408,12 +408,12 @@ class ManyToManyPersister extends AbstractCollectionPersister
// Optimization for single column identifier
if (count($mapping['relationToSourceKeyColumns']) === 1) {
return array(reset($identifier));
return [reset($identifier)];
}
// Composite identifier
$sourceClass = $this->em->getClassMetadata($mapping['sourceEntity']);
$params = array();
$params = [];
foreach ($mapping['relationToSourceKeyColumns'] as $columnName => $refColumnName) {
$params[] = isset($sourceClass->fieldNames[$refColumnName])
@ -437,8 +437,8 @@ class ManyToManyPersister extends AbstractCollectionPersister
$mapping = $collection->getMapping();
$class = $this->em->getClassMetadata($mapping['sourceEntity']);
$targetClass = $this->em->getClassMetadata($mapping['targetEntity']);
$columns = array();
$types = array();
$columns = [];
$types = [];
foreach ($mapping['joinTable']['joinColumns'] as $joinColumn) {
$columns[] = $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform);
@ -450,11 +450,11 @@ class ManyToManyPersister extends AbstractCollectionPersister
$types[] = PersisterHelper::getTypeOfColumn($joinColumn['referencedColumnName'], $targetClass, $this->em);
}
return array(
return [
'DELETE FROM ' . $this->quoteStrategy->getJoinTableName($mapping, $class, $this->platform)
. ' WHERE ' . implode(' = ? AND ', $columns) . ' = ?',
$types,
);
];
}
/**
@ -483,8 +483,8 @@ class ManyToManyPersister extends AbstractCollectionPersister
*/
protected function getInsertRowSQL(PersistentCollection $collection)
{
$columns = array();
$types = array();
$columns = [];
$types = [];
$mapping = $collection->getMapping();
$class = $this->em->getClassMetadata($mapping['sourceEntity']);
$targetClass = $this->em->getClassMetadata($mapping['targetEntity']);
@ -499,13 +499,13 @@ class ManyToManyPersister extends AbstractCollectionPersister
$types[] = PersisterHelper::getTypeOfColumn($joinColumn['referencedColumnName'], $targetClass, $this->em);
}
return array(
return [
'INSERT INTO ' . $this->quoteStrategy->getJoinTableName($mapping, $class, $this->platform)
. ' (' . implode(', ', $columns) . ')'
. ' VALUES'
. ' (' . implode(', ', array_fill(0, count($columns), '?')) . ')',
$types,
);
];
}
/**
@ -535,7 +535,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
*/
private function collectJoinTableColumnParameters(PersistentCollection $collection, $element)
{
$params = array();
$params = [];
$mapping = $collection->getMapping();
$isComposite = count($mapping['joinTableColumns']) > 2;
@ -602,14 +602,14 @@ class ManyToManyPersister extends AbstractCollectionPersister
}
$quotedJoinTable = $this->quoteStrategy->getJoinTableName($mapping, $associationSourceClass, $this->platform). ' t';
$whereClauses = array();
$params = array();
$types = array();
$whereClauses = [];
$params = [];
$types = [];
$joinNeeded = ! in_array($indexBy, $targetClass->identifier);
if ($joinNeeded) { // extra join needed if indexBy is not a @id
$joinConditions = array();
$joinConditions = [];
foreach ($joinColumns as $joinTableColumn) {
$joinConditions[] = 't.' . $joinTableColumn['name'] . ' = tr.' . $joinTableColumn['referencedColumnName'];
@ -650,7 +650,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
}
}
return array($quotedJoinTable, $whereClauses, $params, $types);
return [$quotedJoinTable, $whereClauses, $params, $types];
}
/**
@ -684,9 +684,9 @@ class ManyToManyPersister extends AbstractCollectionPersister
}
$quotedJoinTable = $this->quoteStrategy->getJoinTableName($mapping, $sourceClass, $this->platform);
$whereClauses = array();
$params = array();
$types = array();
$whereClauses = [];
$params = [];
$types = [];
foreach ($mapping['joinTableColumns'] as $joinTableColumn) {
$whereClauses[] = ($addFilters ? 't.' : '') . $joinTableColumn . ' = ?';
@ -716,7 +716,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
}
}
return array($quotedJoinTable, $whereClauses, $params, $types);
return [$quotedJoinTable, $whereClauses, $params, $types];
}
/**
@ -732,7 +732,7 @@ class ManyToManyPersister extends AbstractCollectionPersister
$expression = $criteria->getWhereExpression();
if ($expression === null) {
return array();
return [];
}
$valueVisitor = new SqlValueVisitor();

View File

@ -83,13 +83,13 @@ class OneToManyPersister extends AbstractCollectionPersister
$persister = $this->uow->getEntityPersister($mapping['targetEntity']);
return $persister->load(
array(
[
$mapping['mappedBy'] => $collection->getOwner(),
$mapping['indexBy'] => $index
),
],
null,
$mapping,
array(),
[],
null,
1
);
@ -249,10 +249,10 @@ class OneToManyPersister extends AbstractCollectionPersister
$columnDefinitions = [];
foreach ($idColumnNames as $idColumnName) {
$columnDefinitions[$idColumnName] = array(
$columnDefinitions[$idColumnName] = [
'notnull' => true,
'type' => Type::getType(PersisterHelper::getTypeOfColumn($idColumnName, $rootClass, $this->em)),
);
];
}
$statement = $this->platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable
@ -271,7 +271,7 @@ class OneToManyPersister extends AbstractCollectionPersister
$numDeleted = $this->conn->executeUpdate($statement, $parameters);
// 3) Delete records on each table in the hierarchy
$classNames = array_merge($targetClass->parentClasses, array($targetClass->name), $targetClass->subClasses);
$classNames = array_merge($targetClass->parentClasses, [$targetClass->name], $targetClass->subClasses);
foreach (array_reverse($classNames) as $className) {
$tableName = $this->quoteStrategy->getTableName($this->em->getClassMetadata($className), $this->platform);

View File

@ -86,7 +86,7 @@ class BasicEntityPersister implements EntityPersister
/**
* @var array
*/
static private $comparisonMap = array(
static private $comparisonMap = [
Comparison::EQ => '= %s',
Comparison::IS => '= %s',
Comparison::NEQ => '!= %s',
@ -97,7 +97,7 @@ class BasicEntityPersister implements EntityPersister
Comparison::IN => 'IN (%s)',
Comparison::NIN => 'NOT IN (%s)',
Comparison::CONTAINS => 'LIKE %s',
);
];
/**
* Metadata object that describes the mapping of the mapped entity class.
@ -132,7 +132,7 @@ class BasicEntityPersister implements EntityPersister
*
* @var array
*/
protected $queuedInserts = array();
protected $queuedInserts = [];
/**
* The map of column names to DBAL mapping types of all prepared columns used
@ -143,7 +143,7 @@ class BasicEntityPersister implements EntityPersister
* @see prepareInsertData($entity)
* @see prepareUpdateData($entity)
*/
protected $columnTypes = array();
protected $columnTypes = [];
/**
* The map of quoted column names.
@ -153,7 +153,7 @@ class BasicEntityPersister implements EntityPersister
* @see prepareInsertData($entity)
* @see prepareUpdateData($entity)
*/
protected $quotedColumns = array();
protected $quotedColumns = [];
/**
* The INSERT SQL statement used for entities handled by this persister.
@ -257,10 +257,10 @@ class BasicEntityPersister implements EntityPersister
public function executeInserts()
{
if ( ! $this->queuedInserts) {
return array();
return [];
}
$postInsertIds = array();
$postInsertIds = [];
$idGenerator = $this->class->idGenerator;
$isPostInsertId = $idGenerator->isPostInsertGenerator();
@ -282,13 +282,13 @@ class BasicEntityPersister implements EntityPersister
if ($isPostInsertId) {
$generatedId = $idGenerator->generate($this->em, $entity);
$id = array(
$id = [
$this->class->identifier[0] => $generatedId
);
$postInsertIds[] = array(
];
$postInsertIds[] = [
'generatedId' => $generatedId,
'entity' => $entity,
);
];
} else {
$id = $this->class->getIdentifierValues($entity);
}
@ -299,7 +299,7 @@ class BasicEntityPersister implements EntityPersister
}
$stmt->closeCursor();
$this->queuedInserts = array();
$this->queuedInserts = [];
return $postInsertIds;
}
@ -389,9 +389,9 @@ class BasicEntityPersister implements EntityPersister
*/
protected final function updateTable($entity, $quotedTableName, array $updateData, $versioned = false)
{
$set = array();
$types = array();
$params = array();
$set = [];
$types = [];
$params = [];
foreach ($updateData as $columnName => $value) {
$placeholder = '?';
@ -420,7 +420,7 @@ class BasicEntityPersister implements EntityPersister
$types[] = $this->columnTypes[$columnName];
}
$where = array();
$where = [];
$identifier = $this->em->getUnitOfWork()->getEntityIdentifier($entity);
foreach ($this->class->identifier as $idField) {
@ -503,9 +503,9 @@ class BasicEntityPersister implements EntityPersister
$selfReferential = ($mapping['targetEntity'] == $mapping['sourceEntity']);
$class = $this->class;
$association = $mapping;
$otherColumns = array();
$otherKeys = array();
$keys = array();
$otherColumns = [];
$otherKeys = [];
$keys = [];
if ( ! $mapping['isOwningSide']) {
$class = $this->em->getClassMetadata($mapping['targetEntity']);
@ -603,7 +603,7 @@ class BasicEntityPersister implements EntityPersister
protected function prepareUpdateData($entity)
{
$versionField = null;
$result = array();
$result = [];
$uow = $this->em->getUnitOfWork();
if (($versioned = $this->class->isVersioned) != false) {
@ -646,7 +646,7 @@ class BasicEntityPersister implements EntityPersister
// The associated entity $newVal is not yet persisted, so we must
// set $newVal = null, in order to insert a null value and schedule an
// extra update on the UnitOfWork.
$uow->scheduleExtraUpdate($entity, array($field => array(null, $newVal)));
$uow->scheduleExtraUpdate($entity, [$field => [null, $newVal]]);
$newVal = null;
}
@ -705,7 +705,7 @@ class BasicEntityPersister implements EntityPersister
/**
* {@inheritdoc}
*/
public function load(array $criteria, $entity = null, $assoc = null, array $hints = array(), $lockMode = null, $limit = null, array $orderBy = null)
public function load(array $criteria, $entity = null, $assoc = null, array $hints = [], $lockMode = null, $limit = null, array $orderBy = null)
{
$this->switchPersisterContext(null, $limit);
@ -735,7 +735,7 @@ class BasicEntityPersister implements EntityPersister
/**
* {@inheritdoc}
*/
public function loadOneToOneEntity(array $assoc, $sourceEntity, array $identifier = array())
public function loadOneToOneEntity(array $assoc, $sourceEntity, array $identifier = [])
{
if (($foundEntity = $this->em->getUnitOfWork()->tryGetById($identifier, $assoc['targetEntity'])) != false) {
return $foundEntity;
@ -748,7 +748,7 @@ class BasicEntityPersister implements EntityPersister
// Mark inverse side as fetched in the hints, otherwise the UoW would
// try to load it in a separate query (remember: to-one inverse sides can not be lazy).
$hints = array();
$hints = [];
if ($isInverseSingleValued) {
$hints['fetched']["r"][$assoc['inversedBy']] = true;
@ -808,13 +808,13 @@ class BasicEntityPersister implements EntityPersister
$stmt = $this->conn->executeQuery($sql, $params, $types);
$hydrator = $this->em->newHydrator(Query::HYDRATE_OBJECT);
$hydrator->hydrateAll($stmt, $this->currentPersisterContext->rsm, array(Query::HINT_REFRESH => true));
$hydrator->hydrateAll($stmt, $this->currentPersisterContext->rsm, [Query::HINT_REFRESH => true]);
}
/**
* {@inheritDoc}
*/
public function count($criteria = array())
public function count($criteria = [])
{
$sql = $this->getCountSQL($criteria);
@ -840,7 +840,8 @@ class BasicEntityPersister implements EntityPersister
$stmt = $this->conn->executeQuery($query, $params, $types);
$hydrator = $this->em->newHydrator(($this->currentPersisterContext->selectJoinSql) ? Query::HYDRATE_OBJECT : Query::HYDRATE_SIMPLEOBJECT);
return $hydrator->hydrateAll($stmt, $this->currentPersisterContext->rsm, array(UnitOfWork::HINT_DEFEREAGERLOAD => true));
return $hydrator->hydrateAll($stmt, $this->currentPersisterContext->rsm, [UnitOfWork::HINT_DEFEREAGERLOAD => true]
);
}
/**
@ -849,11 +850,11 @@ class BasicEntityPersister implements EntityPersister
public function expandCriteriaParameters(Criteria $criteria)
{
$expression = $criteria->getWhereExpression();
$sqlParams = array();
$sqlTypes = array();
$sqlParams = [];
$sqlTypes = [];
if ($expression === null) {
return array($sqlParams, $sqlTypes);
return [$sqlParams, $sqlTypes];
}
$valueVisitor = new SqlValueVisitor();
@ -871,13 +872,13 @@ class BasicEntityPersister implements EntityPersister
$sqlTypes = array_merge($sqlTypes, $this->getTypes($field, $value, $this->class));
}
return array($sqlParams, $sqlTypes);
return [$sqlParams, $sqlTypes];
}
/**
* {@inheritdoc}
*/
public function loadAll(array $criteria = array(), array $orderBy = null, $limit = null, $offset = null)
public function loadAll(array $criteria = [], array $orderBy = null, $limit = null, $offset = null)
{
$this->switchPersisterContext($offset, $limit);
@ -887,7 +888,8 @@ class BasicEntityPersister implements EntityPersister
$hydrator = $this->em->newHydrator(($this->currentPersisterContext->selectJoinSql) ? Query::HYDRATE_OBJECT : Query::HYDRATE_SIMPLEOBJECT);
return $hydrator->hydrateAll($stmt, $this->currentPersisterContext->rsm, array(UnitOfWork::HINT_DEFEREAGERLOAD => true));
return $hydrator->hydrateAll($stmt, $this->currentPersisterContext->rsm, [UnitOfWork::HINT_DEFEREAGERLOAD => true]
);
}
/**
@ -913,7 +915,7 @@ class BasicEntityPersister implements EntityPersister
private function loadArrayFromStatement($assoc, $stmt)
{
$rsm = $this->currentPersisterContext->rsm;
$hints = array(UnitOfWork::HINT_DEFEREAGERLOAD => true);
$hints = [UnitOfWork::HINT_DEFEREAGERLOAD => true];
if (isset($assoc['indexBy'])) {
$rsm = clone ($this->currentPersisterContext->rsm); // this is necessary because the "default rsm" should be changed.
@ -935,10 +937,10 @@ class BasicEntityPersister implements EntityPersister
private function loadCollectionFromStatement($assoc, $stmt, $coll)
{
$rsm = $this->currentPersisterContext->rsm;
$hints = array(
$hints = [
UnitOfWork::HINT_DEFEREAGERLOAD => true,
'collection' => $coll
);
];
if (isset($assoc['indexBy'])) {
$rsm = clone ($this->currentPersisterContext->rsm); // this is necessary because the "default rsm" should be changed.
@ -975,8 +977,8 @@ class BasicEntityPersister implements EntityPersister
$sourceClass = $this->em->getClassMetadata($assoc['sourceEntity']);
$class = $sourceClass;
$association = $assoc;
$criteria = array();
$parameters = array();
$criteria = [];
$parameters = [];
if ( ! $assoc['isOwningSide']) {
$class = $this->em->getClassMetadata($assoc['targetEntity']);
@ -1018,11 +1020,11 @@ class BasicEntityPersister implements EntityPersister
}
$criteria[$quotedJoinTable . '.' . $quotedKeyColumn] = $value;
$parameters[] = array(
$parameters[] = [
'value' => $value,
'field' => $field,
'class' => $sourceClass,
);
];
}
$sql = $this->getSelectSQL($criteria, $assoc, null, $limit, $offset);
@ -1096,7 +1098,7 @@ class BasicEntityPersister implements EntityPersister
/**
* {@inheritDoc}
*/
public function getCountSQL($criteria = array())
public function getCountSQL($criteria = [])
{
$tableName = $this->quoteStrategy->getTableName($this->class, $this->platform);
$tableAlias = $this->getSQLTableAlias($this->class->name);
@ -1132,7 +1134,7 @@ class BasicEntityPersister implements EntityPersister
*/
protected final function getOrderBySQL(array $orderBy, $baseTableAlias)
{
$orderByList = array();
$orderByList = [];
foreach ($orderBy as $fieldName => $orientation) {
@ -1194,7 +1196,7 @@ class BasicEntityPersister implements EntityPersister
return $this->currentPersisterContext->selectColumnListSql;
}
$columnList = array();
$columnList = [];
$this->currentPersisterContext->rsm->addEntityResult($this->class->name, 'r'); // r for root
// Add regular columns to select list
@ -1247,7 +1249,7 @@ class BasicEntityPersister implements EntityPersister
}
$association = $assoc;
$joinCondition = array();
$joinCondition = [];
if (isset($assoc['indexBy'])) {
$this->currentPersisterContext->rsm->addIndexBy($assocAlias, $assoc['indexBy']);
@ -1315,7 +1317,7 @@ class BasicEntityPersister implements EntityPersister
return '';
}
$columnList = array();
$columnList = [];
$targetClass = $this->em->getClassMetadata($assoc['targetEntity']);
$isIdentifier = isset($assoc['id']) && $assoc['id'] === true;
$sqlTableAlias = $this->getSQLTableAlias($class->name, ($alias == 'r' ? '' : $alias));
@ -1343,7 +1345,7 @@ class BasicEntityPersister implements EntityPersister
*/
protected function getSelectManyToManyJoinSQL(array $manyToMany)
{
$conditions = array();
$conditions = [];
$association = $manyToMany;
$sourceTableAlias = $this->getSQLTableAlias($this->class->name);
@ -1385,7 +1387,7 @@ class BasicEntityPersister implements EntityPersister
return $this->insertSql;
}
$values = array();
$values = [];
$columns = array_unique($columns);
foreach ($columns as $column) {
@ -1419,7 +1421,7 @@ class BasicEntityPersister implements EntityPersister
*/
protected function getInsertColumnList()
{
$columns = array();
$columns = [];
foreach ($this->class->reflFields as $name => $field) {
if ($this->class->isVersioned && $this->class->versionField == $name) {
@ -1579,7 +1581,7 @@ class BasicEntityPersister implements EntityPersister
*/
public function getSelectConditionStatementSQL($field, $value, $assoc = null, $comparison = null)
{
$selectedColumns = array();
$selectedColumns = [];
$columns = $this->getSelectConditionStatementColumnSQL($field, $assoc);
if (count($columns) > 1 && $comparison === Comparison::IN) {
@ -1660,13 +1662,13 @@ class BasicEntityPersister implements EntityPersister
? $this->class->fieldMappings[$field]['inherited']
: $this->class->name;
return array($this->getSQLTableAlias($className) . '.' . $this->quoteStrategy->getColumnName($field, $this->class, $this->platform));
return [$this->getSQLTableAlias($className) . '.' . $this->quoteStrategy->getColumnName($field, $this->class, $this->platform)];
}
if (isset($this->class->associationMappings[$field])) {
$association = $this->class->associationMappings[$field];
// Many-To-Many requires join table check for joinColumn
$columns = array();
$columns = [];
$class = $this->class;
if ($association['type'] === ClassMetadata::MANY_TO_MANY) {
@ -1705,7 +1707,7 @@ class BasicEntityPersister implements EntityPersister
// therefore checking for spaces and function calls which are not allowed.
// found a join column condition, not really a "field"
return array($field);
return [$field];
}
throw ORMException::unrecognizedField($field);
@ -1725,7 +1727,7 @@ class BasicEntityPersister implements EntityPersister
*/
protected function getSelectConditionSQL(array $criteria, $assoc = null)
{
$conditions = array();
$conditions = [];
foreach ($criteria as $field => $value) {
$conditions[] = $this->getSelectConditionStatementSQL($field, $value, $assoc);
@ -1770,8 +1772,8 @@ class BasicEntityPersister implements EntityPersister
{
$this->switchPersisterContext($offset, $limit);
$criteria = array();
$parameters = array();
$criteria = [];
$parameters = [];
$owningAssoc = $this->class->associationMappings[$assoc['mappedBy']];
$sourceClass = $this->em->getClassMetadata($assoc['sourceEntity']);
$tableAlias = $this->getSQLTableAlias(isset($owningAssoc['inherited']) ? $owningAssoc['inherited'] : $this->class->name);
@ -1787,11 +1789,11 @@ class BasicEntityPersister implements EntityPersister
}
$criteria[$tableAlias . "." . $targetKeyColumn] = $value;
$parameters[] = array(
$parameters[] = [
'value' => $value,
'field' => $field,
'class' => $sourceClass,
);
];
continue;
}
@ -1800,11 +1802,11 @@ class BasicEntityPersister implements EntityPersister
$value = $sourceClass->reflFields[$field]->getValue($sourceEntity);
$criteria[$tableAlias . "." . $targetKeyColumn] = $value;
$parameters[] = array(
$parameters[] = [
'value' => $value,
'field' => $field,
'class' => $sourceClass,
);
];
}
@ -1819,8 +1821,8 @@ class BasicEntityPersister implements EntityPersister
*/
public function expandParameters($criteria)
{
$params = array();
$types = array();
$params = [];
$types = [];
foreach ($criteria as $field => $value) {
if ($value === null) {
@ -1831,7 +1833,7 @@ class BasicEntityPersister implements EntityPersister
$params = array_merge($params, $this->getValues($value));
}
return array($params, $types);
return [$params, $types];
}
/**
@ -1848,8 +1850,8 @@ class BasicEntityPersister implements EntityPersister
*/
private function expandToManyParameters($criteria)
{
$params = array();
$types = array();
$params = [];
$types = [];
foreach ($criteria as $criterion) {
if ($criterion['value'] === null) {
@ -1860,7 +1862,7 @@ class BasicEntityPersister implements EntityPersister
$params = array_merge($params, $this->getValues($criterion['value']));
}
return array($params, $types);
return [$params, $types];
}
/**
@ -1875,11 +1877,11 @@ class BasicEntityPersister implements EntityPersister
*/
private function getTypes($field, $value, ClassMetadata $class)
{
$types = array();
$types = [];
switch (true) {
case (isset($class->fieldMappings[$field])):
$types = array_merge($types, array($class->fieldMappings[$field]['type']));
$types = array_merge($types, [$class->fieldMappings[$field]['type']]);
break;
case (isset($class->associationMappings[$field])):
@ -1926,19 +1928,19 @@ class BasicEntityPersister implements EntityPersister
private function getValues($value)
{
if (is_array($value)) {
$newValue = array();
$newValue = [];
foreach ($value as $itemValue) {
$newValue = array_merge($newValue, $this->getValues($itemValue));
}
return array($newValue);
return [$newValue];
}
if (is_object($value) && $this->em->getMetadataFactory()->hasMetadataFor(ClassUtils::getClass($value))) {
$class = $this->em->getClassMetadata(get_class($value));
if ($class->isIdentifierComposite) {
$newValue = array();
$newValue = [];
foreach ($class->getIdentifierValues($value) as $innerValue) {
$newValue = array_merge($newValue, $this->getValues($innerValue));
@ -1948,7 +1950,7 @@ class BasicEntityPersister implements EntityPersister
}
}
return array($this->getIndividualValue($value));
return [$this->getIndividualValue($value)];
}
/**
@ -2038,7 +2040,7 @@ class BasicEntityPersister implements EntityPersister
*/
protected function generateFilterConditionSQL(ClassMetadata $targetEntity, $targetTableAlias)
{
$filterClauses = array();
$filterClauses = [];
foreach ($this->em->getFilters()->getEnabledFilters() as $filter) {
if ('' !== $filterExpr = $filter->addFilterConstraint($targetEntity, $targetTableAlias)) {

View File

@ -76,7 +76,7 @@ class CachedPersisterContext
*
* @var array
*/
public $sqlTableAliases = array();
public $sqlTableAliases = [];
/**
* Whether this persistent context is considering limit operations applied to the selection queries

View File

@ -81,7 +81,7 @@ interface EntityPersister
*
* @return string
*/
public function getCountSQL($criteria = array());
public function getCountSQL($criteria = []);
/**
* Expands the parameters from the given criteria and use the correct binding types if found.
@ -165,7 +165,7 @@ interface EntityPersister
*
* @return int
*/
public function count($criteria = array());
public function count($criteria = []);
/**
* Gets the name of the table that owns the column the given field is mapped to.
@ -197,7 +197,7 @@ interface EntityPersister
*
* @todo Check identity map? loadById method? Try to guess whether $criteria is the id?
*/
public function load(array $criteria, $entity = null, $assoc = null, array $hints = array(), $lockMode = null, $limit = null, array $orderBy = null);
public function load(array $criteria, $entity = null, $assoc = null, array $hints = [], $lockMode = null, $limit = null, array $orderBy = null);
/**
* Loads an entity by identifier.
@ -225,7 +225,7 @@ interface EntityPersister
*
* @throws \Doctrine\ORM\Mapping\MappingException
*/
public function loadOneToOneEntity(array $assoc, $sourceEntity, array $identifier = array());
public function loadOneToOneEntity(array $assoc, $sourceEntity, array $identifier = []);
/**
* Refreshes a managed entity.
@ -260,7 +260,7 @@ interface EntityPersister
*
* @return array
*/
public function loadAll(array $criteria = array(), array $orderBy = null, $limit = null, $offset = null);
public function loadAll(array $criteria = [], array $orderBy = null, $limit = null, $offset = null);
/**
* Gets (sliced or full) elements of the given collection.

View File

@ -45,14 +45,14 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
*
* @var array
*/
private $owningTableMap = array();
private $owningTableMap = [];
/**
* Map of table to quoted table names.
*
* @var array
*/
private $quotedTableMap = array();
private $quotedTableMap = [];
/**
* {@inheritdoc}
@ -127,10 +127,10 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
public function executeInserts()
{
if ( ! $this->queuedInserts) {
return array();
return [];
}
$postInsertIds = array();
$postInsertIds = [];
$idGenerator = $this->class->idGenerator;
$isPostInsertId = $idGenerator->isPostInsertGenerator();
$rootClass = ($this->class->name !== $this->class->rootEntityName)
@ -143,7 +143,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
$rootTableStmt = $this->conn->prepare($rootPersister->getInsertSQL());
// Prepare statements for sub tables.
$subTableStmts = array();
$subTableStmts = [];
if ($rootClass !== $this->class) {
$subTableStmts[$this->class->getTableName()] = $this->conn->prepare($this->getInsertSQL());
@ -176,13 +176,13 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
if ($isPostInsertId) {
$generatedId = $idGenerator->generate($this->em, $entity);
$id = array(
$id = [
$this->class->identifier[0] => $generatedId
);
$postInsertIds[] = array(
];
$postInsertIds[] = [
'generatedId' => $generatedId,
'entity' => $entity,
);
];
} else {
$id = $this->em->getUnitOfWork()->getEntityIdentifier($entity);
}
@ -198,7 +198,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
$paramIndex = 1;
$data = isset($insertData[$tableName])
? $insertData[$tableName]
: array();
: [];
foreach ((array) $id as $idName => $idVal) {
$type = isset($this->columnTypes[$idName]) ? $this->columnTypes[$idName] : Type::STRING;
@ -222,7 +222,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
$stmt->closeCursor();
}
$this->queuedInserts = array();
$this->queuedInserts = [];
return $postInsertIds;
}
@ -258,7 +258,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
if ( ! isset($updateData[$versionedTable])) {
$tableName = $this->quoteStrategy->getTableName($versionedClass, $this->platform);
$this->updateTable($entity, $tableName, array(), true);
$this->updateTable($entity, $tableName, [], true);
}
$identifiers = $this->em->getUnitOfWork()->getEntityIdentifier($entity);
@ -369,7 +369,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
/**
* {@inheritDoc}
*/
public function getCountSQL($criteria = array())
public function getCountSQL($criteria = [])
{
$tableName = $this->quoteStrategy->getTableName($this->class, $this->platform);
$baseTableAlias = $this->getSQLTableAlias($this->class->name);
@ -406,7 +406,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
// INNER JOIN parent tables
foreach ($this->class->parentClasses as $parentClassName) {
$conditions = array();
$conditions = [];
$tableAlias = $this->getSQLTableAlias($parentClassName);
$parentClass = $this->em->getClassMetadata($parentClassName);
$joinSql .= ' INNER JOIN ' . $this->quoteStrategy->getTableName($parentClass, $this->platform) . ' ' . $tableAlias . ' ON ';
@ -433,7 +433,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
return $this->currentPersisterContext->selectColumnListSql;
}
$columnList = array();
$columnList = [];
$discrColumn = $this->class->discriminatorColumn['name'];
$discrColumnType = $this->class->discriminatorColumn['type'];
$baseTableAlias = $this->getSQLTableAlias($this->class->name);
@ -545,7 +545,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
// Identifier columns must always come first in the column list of subclasses.
$columns = $this->class->parentClasses
? $this->class->getIdentifierColumnNames()
: array();
: [];
foreach ($this->class->reflFields as $name => $field) {
if (isset($this->class->fieldMappings[$name]['inherited'])
@ -599,7 +599,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
// INNER JOIN parent tables
foreach ($this->class->parentClasses as $parentClassName) {
$conditions = array();
$conditions = [];
$parentClass = $this->em->getClassMetadata($parentClassName);
$tableAlias = $this->getSQLTableAlias($parentClassName);
$joinSql .= ' INNER JOIN ' . $this->quoteStrategy->getTableName($parentClass, $this->platform) . ' ' . $tableAlias . ' ON ';
@ -614,7 +614,7 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
// OUTER JOIN sub tables
foreach ($this->class->subClasses as $subClassName) {
$conditions = array();
$conditions = [];
$subClass = $this->em->getClassMetadata($subClassName);
$tableAlias = $this->getSQLTableAlias($subClassName);
$joinSql .= ' LEFT JOIN ' . $this->quoteStrategy->getTableName($subClass, $this->platform) . ' ' . $tableAlias . ' ON ';

View File

@ -164,7 +164,7 @@ class SingleTablePersister extends AbstractEntityInheritancePersister
*/
protected function getSelectConditionDiscriminatorValueSQL()
{
$values = array();
$values = [];
if ($this->class->discriminatorValue !== null) { // discriminators can be 0
$values[] = $this->conn->quote($this->class->discriminatorValue);

View File

@ -70,7 +70,7 @@ class SqlExpressionVisitor extends ExpressionVisitor
if (isset($this->classMetadata->associationMappings[$field]) &&
$value !== null &&
! is_object($value) &&
! in_array($comparison->getOperator(), array(Comparison::IN, Comparison::NIN))) {
! in_array($comparison->getOperator(), [Comparison::IN, Comparison::NIN])) {
throw PersisterException::matchingAssocationFieldRequiresObject($this->classMetadata->name, $field);
}
@ -89,7 +89,7 @@ class SqlExpressionVisitor extends ExpressionVisitor
*/
public function walkCompositeExpression(CompositeExpression $expr)
{
$expressionList = array();
$expressionList = [];
foreach ($expr->getExpressionList() as $child) {
$expressionList[] = $this->dispatch($child);

View File

@ -34,12 +34,12 @@ class SqlValueVisitor extends ExpressionVisitor
/**
* @var array
*/
private $values = array();
private $values = [];
/**
* @var array
*/
private $types = array();
private $types = [];
/**
* Converts a comparison expression into the target query language output.
@ -61,7 +61,7 @@ class SqlValueVisitor extends ExpressionVisitor
}
$this->values[] = $value;
$this->types[] = array($field, $value);
$this->types[] = [$field, $value];
}
/**
@ -97,7 +97,7 @@ class SqlValueVisitor extends ExpressionVisitor
*/
public function getParamsAndTypes()
{
return array($this->values, $this->types);
return [$this->values, $this->types];
}
/**

View File

@ -135,7 +135,7 @@ final class Query extends AbstractQuery
*
* @var array
*/
private $_parsedTypes = array();
private $_parsedTypes = [];
/**
* Cached DQL query.
@ -241,7 +241,7 @@ final class Query extends AbstractQuery
*/
private function _parse()
{
$types = array();
$types = [];
foreach ($this->parameters as $parameter) {
/** @var Query\Parameter $parameter */
@ -354,8 +354,8 @@ final class Query extends AbstractQuery
*/
private function processParameterMappings($paramMappings)
{
$sqlParams = array();
$types = array();
$sqlParams = [];
$types = [];
foreach ($this->parameters as $parameter) {
$key = $parameter->getName();
@ -383,7 +383,7 @@ final class Query extends AbstractQuery
// optimized multi value sql positions away for now,
// they are not allowed in DQL anyways.
$value = array($value);
$value = [$value];
$countValue = count($value);
for ($i = 0, $l = count($sqlPositions); $i < $l; $i++) {
@ -403,7 +403,7 @@ final class Query extends AbstractQuery
$types = array_values($types);
}
return array($sqlParams, $types);
return [$sqlParams, $types];
}
/**
@ -667,7 +667,7 @@ final class Query extends AbstractQuery
*/
public function setLockMode($lockMode)
{
if (in_array($lockMode, array(LockMode::NONE, LockMode::PESSIMISTIC_READ, LockMode::PESSIMISTIC_WRITE), true)) {
if (in_array($lockMode, [LockMode::NONE, LockMode::PESSIMISTIC_READ, LockMode::PESSIMISTIC_WRITE], true)) {
if ( ! $this->_em->getConnection()->isTransactionActive()) {
throw TransactionRequiredException::transactionRequired();
}

View File

@ -35,7 +35,7 @@ class CoalesceExpression extends Node
/**
* @var array
*/
public $scalarExpressions = array();
public $scalarExpressions = [];
/**
* @param array $scalarExpressions

View File

@ -33,7 +33,7 @@ class ConditionalExpression extends Node
/**
* @var array
*/
public $conditionalTerms = array();
public $conditionalTerms = [];
/**
* @param array $conditionalTerms

View File

@ -32,7 +32,7 @@ class ConditionalTerm extends Node
/**
* @var array
*/
public $conditionalFactors = array();
public $conditionalFactors = [];
/**
* @param array $conditionalFactors

View File

@ -34,7 +34,7 @@ class FromClause extends Node
/**
* @var array
*/
public $identificationVariableDeclarations = array();
public $identificationVariableDeclarations = [];
/**
* @param array $identificationVariableDeclarations

View File

@ -38,7 +38,7 @@ class ConcatFunction extends FunctionNode
public $secondStringPrimary;
public $concatExpressions = array();
public $concatExpressions = [];
/**
* @override
@ -47,13 +47,13 @@ class ConcatFunction extends FunctionNode
{
$platform = $sqlWalker->getConnection()->getDatabasePlatform();
$args = array();
$args = [];
foreach ($this->concatExpressions as $expression) {
$args[] = $sqlWalker->walkStringPrimary($expression);
}
return call_user_func_array(array($platform,'getConcatExpression'), $args);
return call_user_func_array([$platform,'getConcatExpression'], $args);
}
/**

View File

@ -35,7 +35,7 @@ class GeneralCaseExpression extends Node
/**
* @var array
*/
public $whenClauses = array();
public $whenClauses = [];
/**
* @var mixed

View File

@ -33,7 +33,7 @@ class GroupByClause extends Node
/**
* @var array
*/
public $groupByItems = array();
public $groupByItems = [];
/**
* @param array $groupByItems

View File

@ -43,7 +43,7 @@ class IdentificationVariableDeclaration extends Node
/**
* @var array
*/
public $joins = array();
public $joins = [];
/**
* @param RangeVariableDeclaration|null $rangeVariableDecl

View File

@ -42,7 +42,7 @@ class InExpression extends Node
/**
* @var array
*/
public $literals = array();
public $literals = [];
/**
* @var Subselect|null

View File

@ -33,7 +33,7 @@ class OrderByClause extends Node
/**
* @var array
*/
public $orderByItems = array();
public $orderByItems = [];
/**
* @param array $orderByItems

View File

@ -38,7 +38,7 @@ class SelectClause extends Node
/**
* @var array
*/
public $selectExpressions = array();
public $selectExpressions = [];
/**
* @param array $selectExpressions

View File

@ -33,7 +33,7 @@ class SimpleArithmeticExpression extends Node
/**
* @var array
*/
public $arithmeticTerms = array();
public $arithmeticTerms = [];
/**
* @param array $arithmeticTerms

View File

@ -40,7 +40,7 @@ class SimpleCaseExpression extends Node
/**
* @var array
*/
public $simpleWhenClauses = array();
public $simpleWhenClauses = [];
/**
* @var mixed

View File

@ -33,7 +33,7 @@ class SubselectFromClause extends Node
/**
* @var array
*/
public $identificationVariableDeclarations = array();
public $identificationVariableDeclarations = [];
/**
* @param array $identificationVariableDeclarations

View File

@ -43,7 +43,7 @@ class UpdateClause extends Node
/**
* @var array
*/
public $updateItems = array();
public $updateItems = [];
/**
* @param string $abstractSchemaName

View File

@ -81,7 +81,7 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor
. ' SELECT t0.' . implode(', t0.', $idColumnNames);
$rangeDecl = new AST\RangeVariableDeclaration($primaryClass->name, $primaryDqlAlias);
$fromClause = new AST\FromClause(array(new AST\IdentificationVariableDeclaration($rangeDecl, null, array())));
$fromClause = new AST\FromClause([new AST\IdentificationVariableDeclaration($rangeDecl, null, [])]);
$this->_insertSql .= $sqlWalker->walkFromClause($fromClause);
// Append WHERE clause, if there is one.
@ -93,7 +93,7 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor
$idSubselect = 'SELECT ' . $idColumnList . ' FROM ' . $tempTable;
// 3. Create and store DELETE statements
$classNames = array_merge($primaryClass->parentClasses, array($primaryClass->name), $primaryClass->subClasses);
$classNames = array_merge($primaryClass->parentClasses, [$primaryClass->name], $primaryClass->subClasses);
foreach (array_reverse($classNames) as $className) {
$tableName = $quoteStrategy->getTableName($em->getClassMetadata($className), $platform);
$this->_sqlStatements[] = 'DELETE FROM ' . $tableName
@ -101,12 +101,12 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor
}
// 4. Store DDL for temporary identifier table.
$columnDefinitions = array();
$columnDefinitions = [];
foreach ($idColumnNames as $idColumnName) {
$columnDefinitions[$idColumnName] = array(
$columnDefinitions[$idColumnName] = [
'notnull' => true,
'type' => Type::getType(PersisterHelper::getTypeOfColumn($idColumnName, $rootClass, $em)),
);
];
}
$this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' ('
. $platform->getColumnDeclarationListSQL($columnDefinitions) . ')';

View File

@ -52,7 +52,7 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
/**
* @var array
*/
private $_sqlParameters = array();
private $_sqlParameters = [];
/**
* @var int
@ -92,7 +92,7 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
. ' SELECT t0.' . implode(', t0.', $idColumnNames);
$rangeDecl = new AST\RangeVariableDeclaration($primaryClass->name, $updateClause->aliasIdentificationVariable);
$fromClause = new AST\FromClause(array(new AST\IdentificationVariableDeclaration($rangeDecl, null, array())));
$fromClause = new AST\FromClause([new AST\IdentificationVariableDeclaration($rangeDecl, null, [])]);
$this->_insertSql .= $sqlWalker->walkFromClause($fromClause);
@ -100,7 +100,7 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
$idSubselect = 'SELECT ' . $idColumnList . ' FROM ' . $tempTable;
// 3. Create and store UPDATE statements
$classNames = array_merge($primaryClass->parentClasses, array($primaryClass->name), $primaryClass->subClasses);
$classNames = array_merge($primaryClass->parentClasses, [$primaryClass->name], $primaryClass->subClasses);
$i = -1;
foreach (array_reverse($classNames) as $className) {
@ -143,13 +143,13 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
}
// 4. Store DDL for temporary identifier table.
$columnDefinitions = array();
$columnDefinitions = [];
foreach ($idColumnNames as $idColumnName) {
$columnDefinitions[$idColumnName] = array(
$columnDefinitions[$idColumnName] = [
'notnull' => true,
'type' => Type::getType(PersisterHelper::getTypeOfColumn($idColumnName, $rootClass, $em)),
);
];
}
$this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' ('
@ -176,8 +176,8 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
// Execute UPDATE statements
foreach ($this->_sqlStatements as $key => $statement) {
$paramValues = array();
$paramTypes = array();
$paramValues = [];
$paramTypes = [];
if (isset($this->_sqlParameters[$key])) {
foreach ($this->_sqlParameters[$key] as $parameterKey => $parameterName) {

View File

@ -220,7 +220,7 @@ class Expr
*/
public function avg($x)
{
return new Expr\Func('AVG', array($x));
return new Expr\Func('AVG', [$x]);
}
/**
@ -232,7 +232,7 @@ class Expr
*/
public function max($x)
{
return new Expr\Func('MAX', array($x));
return new Expr\Func('MAX', [$x]);
}
/**
@ -244,7 +244,7 @@ class Expr
*/
public function min($x)
{
return new Expr\Func('MIN', array($x));
return new Expr\Func('MIN', [$x]);
}
/**
@ -256,7 +256,7 @@ class Expr
*/
public function count($x)
{
return new Expr\Func('COUNT', array($x));
return new Expr\Func('COUNT', [$x]);
}
/**
@ -280,7 +280,7 @@ class Expr
*/
public function exists($subquery)
{
return new Expr\Func('EXISTS', array($subquery));
return new Expr\Func('EXISTS', [$subquery]);
}
/**
@ -292,7 +292,7 @@ class Expr
*/
public function all($subquery)
{
return new Expr\Func('ALL', array($subquery));
return new Expr\Func('ALL', [$subquery]);
}
/**
@ -304,7 +304,7 @@ class Expr
*/
public function some($subquery)
{
return new Expr\Func('SOME', array($subquery));
return new Expr\Func('SOME', [$subquery]);
}
/**
@ -316,7 +316,7 @@ class Expr
*/
public function any($subquery)
{
return new Expr\Func('ANY', array($subquery));
return new Expr\Func('ANY', [$subquery]);
}
/**
@ -328,7 +328,7 @@ class Expr
*/
public function not($restriction)
{
return new Expr\Func('NOT', array($restriction));
return new Expr\Func('NOT', [$restriction]);
}
/**
@ -340,7 +340,7 @@ class Expr
*/
public function abs($x)
{
return new Expr\Func('ABS', array($x));
return new Expr\Func('ABS', [$x]);
}
/**
@ -429,7 +429,7 @@ class Expr
*/
public function sqrt($x)
{
return new Expr\Func('SQRT', array($x));
return new Expr\Func('SQRT', [$x]);
}
/**
@ -548,7 +548,7 @@ class Expr
*/
public function substring($x, $from, $len = null)
{
$args = array($x, $from);
$args = [$x, $from];
if (null !== $len) {
$args[] = $len;
}
@ -565,7 +565,7 @@ class Expr
*/
public function lower($x)
{
return new Expr\Func('LOWER', array($x));
return new Expr\Func('LOWER', [$x]);
}
/**
@ -577,7 +577,7 @@ class Expr
*/
public function upper($x)
{
return new Expr\Func('UPPER', array($x));
return new Expr\Func('UPPER', [$x]);
}
/**
@ -589,7 +589,7 @@ class Expr
*/
public function length($x)
{
return new Expr\Func('LENGTH', array($x));
return new Expr\Func('LENGTH', [$x]);
}
/**

View File

@ -38,12 +38,12 @@ class Andx extends Composite
/**
* @var array
*/
protected $allowedClasses = array(
protected $allowedClasses = [
'Doctrine\ORM\Query\Expr\Comparison',
'Doctrine\ORM\Query\Expr\Func',
'Doctrine\ORM\Query\Expr\Orx',
'Doctrine\ORM\Query\Expr\Andx',
);
];
/**
* @return array

View File

@ -48,17 +48,17 @@ abstract class Base
/**
* @var array
*/
protected $allowedClasses = array();
protected $allowedClasses = [];
/**
* @var array
*/
protected $parts = array();
protected $parts = [];
/**
* @param array $args
*/
public function __construct($args = array())
public function __construct($args = [])
{
$this->addMultiple($args);
}
@ -68,7 +68,7 @@ abstract class Base
*
* @return Base
*/
public function addMultiple($args = array())
public function addMultiple($args = [])
{
foreach ((array) $args as $arg) {
$this->add($arg);

View File

@ -39,7 +39,7 @@ class Composite extends Base
return (string) $this->parts[0];
}
$components = array();
$components = [];
foreach ($this->parts as $part) {
$components[] = $this->processQueryPart($part);

View File

@ -48,12 +48,12 @@ class OrderBy
/**
* @var array
*/
protected $allowedClasses = array();
protected $allowedClasses = [];
/**
* @var array
*/
protected $parts = array();
protected $parts = [];
/**
* @param string|null $sort

View File

@ -38,12 +38,12 @@ class Orx extends Composite
/**
* @var array
*/
protected $allowedClasses = array(
protected $allowedClasses = [
'Doctrine\ORM\Query\Expr\Comparison',
'Doctrine\ORM\Query\Expr\Func',
'Doctrine\ORM\Query\Expr\Andx',
'Doctrine\ORM\Query\Expr\Orx',
);
];
/**
* @return array

View File

@ -43,9 +43,7 @@ class Select extends Base
/**
* @var array
*/
protected $allowedClasses = array(
'Doctrine\ORM\Query\Expr\Func'
);
protected $allowedClasses = ['Doctrine\ORM\Query\Expr\Func'];
/**
* @return array

View File

@ -75,7 +75,7 @@ abstract class SQLFilter
$type = ParameterTypeInferer::inferType($value);
}
$this->parameters[$name] = array('value' => $value, 'type' => $type);
$this->parameters[$name] = ['value' => $value, 'type' => $type];
// Keep the parameters sorted for the hash
ksort($this->parameters);

View File

@ -59,7 +59,7 @@ class FilterCollection
*
* @var \Doctrine\ORM\Query\Filter\SQLFilter[]
*/
private $enabledFilters = array();
private $enabledFilters = [];
/**
* @var string The filter hash from the last time the query was parsed.

View File

@ -129,13 +129,13 @@ class Lexer extends \Doctrine\Common\Lexer
*/
protected function getCatchablePatterns()
{
return array(
return [
'[a-z_][a-z0-9_]*\:[a-z_][a-z0-9_]*(?:\\\[a-z_][a-z0-9_]*)*', // aliased name
'[a-z_\\\][a-z0-9_]*(?:\\\[a-z_][a-z0-9_]*)*', // identifier or qualified name
'(?:[0-9]+(?:[\.][0-9]+)*)(?:e[+-]?[0-9]+)?', // numbers
"'(?:[^']|'')*'", // quoted strings
'\?[0-9]*|:[a-z_][a-z0-9_]*' // parameters
);
];
}
/**
@ -143,7 +143,7 @@ class Lexer extends \Doctrine\Common\Lexer
*/
protected function getNonCatchablePatterns()
{
return array('\s+', '(.)');
return ['\s+', '(.)'];
}
/**

View File

@ -40,21 +40,21 @@ class Parser
*
* @var array
*/
private static $_STRING_FUNCTIONS = array(
private static $_STRING_FUNCTIONS = [
'concat' => 'Doctrine\ORM\Query\AST\Functions\ConcatFunction',
'substring' => 'Doctrine\ORM\Query\AST\Functions\SubstringFunction',
'trim' => 'Doctrine\ORM\Query\AST\Functions\TrimFunction',
'lower' => 'Doctrine\ORM\Query\AST\Functions\LowerFunction',
'upper' => 'Doctrine\ORM\Query\AST\Functions\UpperFunction',
'identity' => 'Doctrine\ORM\Query\AST\Functions\IdentityFunction',
);
];
/**
* READ-ONLY: Maps BUILT-IN numeric function names to AST class names.
*
* @var array
*/
private static $_NUMERIC_FUNCTIONS = array(
private static $_NUMERIC_FUNCTIONS = [
'length' => 'Doctrine\ORM\Query\AST\Functions\LengthFunction',
'locate' => 'Doctrine\ORM\Query\AST\Functions\LocateFunction',
'abs' => 'Doctrine\ORM\Query\AST\Functions\AbsFunction',
@ -64,20 +64,20 @@ class Parser
'date_diff' => 'Doctrine\ORM\Query\AST\Functions\DateDiffFunction',
'bit_and' => 'Doctrine\ORM\Query\AST\Functions\BitAndFunction',
'bit_or' => 'Doctrine\ORM\Query\AST\Functions\BitOrFunction',
);
];
/**
* READ-ONLY: Maps BUILT-IN datetime function names to AST class names.
*
* @var array
*/
private static $_DATETIME_FUNCTIONS = array(
private static $_DATETIME_FUNCTIONS = [
'current_date' => 'Doctrine\ORM\Query\AST\Functions\CurrentDateFunction',
'current_time' => 'Doctrine\ORM\Query\AST\Functions\CurrentTimeFunction',
'current_timestamp' => 'Doctrine\ORM\Query\AST\Functions\CurrentTimestampFunction',
'date_add' => 'Doctrine\ORM\Query\AST\Functions\DateAddFunction',
'date_sub' => 'Doctrine\ORM\Query\AST\Functions\DateSubFunction',
);
];
/*
* Expressions that were encountered during parsing of identifiers and expressions
@ -87,27 +87,27 @@ class Parser
/**
* @var array
*/
private $deferredIdentificationVariables = array();
private $deferredIdentificationVariables = [];
/**
* @var array
*/
private $deferredPartialObjectExpressions = array();
private $deferredPartialObjectExpressions = [];
/**
* @var array
*/
private $deferredPathExpressions = array();
private $deferredPathExpressions = [];
/**
* @var array
*/
private $deferredResultVariables = array();
private $deferredResultVariables = [];
/**
* @var array
*/
private $deferredNewObjectExpressions = array();
private $deferredNewObjectExpressions = [];
/**
* The lexer.
@ -142,7 +142,7 @@ class Parser
*
* @var array
*/
private $queryComponents = array();
private $queryComponents = [];
/**
* Keeps the nesting level of defined ResultVariables.
@ -156,7 +156,7 @@ class Parser
*
* @var array
*/
private $customTreeWalkers = array();
private $customTreeWalkers = [];
/**
* The custom last tree walker, if any, that is responsible for producing the output.
@ -168,7 +168,7 @@ class Parser
/**
* @var array
*/
private $identVariableExpressions = array();
private $identVariableExpressions = [];
/**
* Checks if a function is internally defined. Used to prevent overwriting
@ -541,7 +541,7 @@ class Parser
*/
private function isMathOperator($token)
{
return in_array($token['type'], array(Lexer::T_PLUS, Lexer::T_MINUS, Lexer::T_DIVIDE, Lexer::T_MULTIPLY));
return in_array($token['type'], [Lexer::T_PLUS, Lexer::T_MINUS, Lexer::T_DIVIDE, Lexer::T_MULTIPLY]);
}
/**
@ -568,7 +568,7 @@ class Parser
*/
private function isAggregateFunction($tokenType)
{
return in_array($tokenType, array(Lexer::T_AVG, Lexer::T_MIN, Lexer::T_MAX, Lexer::T_SUM, Lexer::T_COUNT));
return in_array($tokenType, [Lexer::T_AVG, Lexer::T_MIN, Lexer::T_MAX, Lexer::T_SUM, Lexer::T_COUNT]);
}
/**
@ -578,7 +578,7 @@ class Parser
*/
private function isNextAllAnySome()
{
return in_array($this->lexer->lookahead['type'], array(Lexer::T_ALL, Lexer::T_ANY, Lexer::T_SOME));
return in_array($this->lexer->lookahead['type'], [Lexer::T_ALL, Lexer::T_ANY, Lexer::T_SOME]);
}
/**
@ -787,7 +787,7 @@ class Parser
if ( ! ($expectedType & $fieldType)) {
// We need to recognize which was expected type(s)
$expectedStringTypes = array();
$expectedStringTypes = [];
// Validate state field type
if ($expectedType & AST\PathExpression::TYPE_STATE_FIELD) {
@ -929,11 +929,11 @@ class Parser
$identVariable = $this->lexer->token['value'];
$this->deferredIdentificationVariables[] = array(
$this->deferredIdentificationVariables[] = [
'expression' => $identVariable,
'nestingLevel' => $this->nestingLevel,
'token' => $this->lexer->token,
);
];
return $identVariable;
}
@ -1028,11 +1028,11 @@ class Parser
$resultVariable = $this->lexer->token['value'];
// Defer ResultVariable validation
$this->deferredResultVariables[] = array(
$this->deferredResultVariables[] = [
'expression' => $resultVariable,
'nestingLevel' => $this->nestingLevel,
'token' => $this->lexer->token,
);
];
return $resultVariable;
}
@ -1100,11 +1100,11 @@ class Parser
$pathExpr = new AST\PathExpression($expectedTypes, $identVariable, $field);
// Defer PathExpression validation if requested to be deferred
$this->deferredPathExpressions[] = array(
$this->deferredPathExpressions[] = [
'expression' => $pathExpr,
'nestingLevel' => $this->nestingLevel,
'token' => $this->lexer->token,
);
];
return $pathExpr;
}
@ -1183,7 +1183,7 @@ class Parser
}
// Process SelectExpressions (1..N)
$selectExpressions = array();
$selectExpressions = [];
$selectExpressions[] = $this->SelectExpression();
while ($this->lexer->isNextToken(Lexer::T_COMMA)) {
@ -1237,20 +1237,20 @@ class Parser
$class = $this->em->getClassMetadata($abstractSchemaName);
// Building queryComponent
$queryComponent = array(
$queryComponent = [
'metadata' => $class,
'parent' => null,
'relation' => null,
'map' => null,
'nestingLevel' => $this->nestingLevel,
'token' => $token,
);
];
$this->queryComponents[$aliasIdentificationVariable] = $queryComponent;
$this->match(Lexer::T_SET);
$updateItems = array();
$updateItems = [];
$updateItems[] = $this->UpdateItem();
while ($this->lexer->isNextToken(Lexer::T_COMMA)) {
@ -1295,14 +1295,14 @@ class Parser
$class = $this->em->getClassMetadata($deleteClause->abstractSchemaName);
// Building queryComponent
$queryComponent = array(
$queryComponent = [
'metadata' => $class,
'parent' => null,
'relation' => null,
'map' => null,
'nestingLevel' => $this->nestingLevel,
'token' => $token,
);
];
$this->queryComponents[$aliasIdentificationVariable] = $queryComponent;
@ -1318,7 +1318,7 @@ class Parser
{
$this->match(Lexer::T_FROM);
$identificationVariableDeclarations = array();
$identificationVariableDeclarations = [];
$identificationVariableDeclarations[] = $this->IdentificationVariableDeclaration();
while ($this->lexer->isNextToken(Lexer::T_COMMA)) {
@ -1339,7 +1339,7 @@ class Parser
{
$this->match(Lexer::T_FROM);
$identificationVariables = array();
$identificationVariables = [];
$identificationVariables[] = $this->SubselectIdentificationVariableDeclaration();
while ($this->lexer->isNextToken(Lexer::T_COMMA)) {
@ -1385,7 +1385,7 @@ class Parser
$this->match(Lexer::T_GROUP);
$this->match(Lexer::T_BY);
$groupByItems = array($this->GroupByItem());
$groupByItems = [$this->GroupByItem()];
while ($this->lexer->isNextToken(Lexer::T_COMMA)) {
$this->match(Lexer::T_COMMA);
@ -1406,7 +1406,7 @@ class Parser
$this->match(Lexer::T_ORDER);
$this->match(Lexer::T_BY);
$orderByItems = array();
$orderByItems = [];
$orderByItems[] = $this->OrderByItem();
while ($this->lexer->isNextToken(Lexer::T_COMMA)) {
@ -1583,7 +1583,7 @@ class Parser
*/
public function IdentificationVariableDeclaration()
{
$joins = array();
$joins = [];
$rangeVariableDeclaration = $this->RangeVariableDeclaration();
$indexBy = $this->lexer->isNextToken(Lexer::T_INDEX)
? $this->IndexBy()
@ -1739,14 +1739,14 @@ class Parser
$classMetadata = $this->em->getClassMetadata($abstractSchemaName);
// Building queryComponent
$queryComponent = array(
$queryComponent = [
'metadata' => $classMetadata,
'parent' => null,
'relation' => null,
'map' => null,
'nestingLevel' => $this->nestingLevel,
'token' => $token
);
];
$this->queryComponents[$aliasIdentificationVariable] = $queryComponent;
@ -1776,14 +1776,14 @@ class Parser
$targetClass = $this->em->getClassMetadata($class->associationMappings[$field]['targetEntity']);
// Building queryComponent
$joinQueryComponent = array(
$joinQueryComponent = [
'metadata' => $targetClass,
'parent' => $joinAssociationPathExpression->identificationVariable,
'relation' => $class->getAssociationMapping($field),
'map' => null,
'nestingLevel' => $this->nestingLevel,
'token' => $this->lexer->lookahead
);
];
$this->queryComponents[$aliasIdentificationVariable] = $joinQueryComponent;
@ -1800,7 +1800,7 @@ class Parser
{
$this->match(Lexer::T_PARTIAL);
$partialFieldSet = array();
$partialFieldSet = [];
$identificationVariable = $this->IdentificationVariable();
@ -1839,11 +1839,11 @@ class Parser
$partialObjectExpression = new AST\PartialObjectExpression($identificationVariable, $partialFieldSet);
// Defer PartialObjectExpression validation
$this->deferredPartialObjectExpressions[] = array(
$this->deferredPartialObjectExpressions[] = [
'expression' => $partialObjectExpression,
'nestingLevel' => $this->nestingLevel,
'token' => $this->lexer->token,
);
];
return $partialObjectExpression;
}
@ -1875,11 +1875,11 @@ class Parser
$expression = new AST\NewObjectExpression($className, $args);
// Defer NewObjectExpression validation
$this->deferredNewObjectExpressions[] = array(
$this->deferredNewObjectExpressions[] = [
'token' => $token,
'expression' => $expression,
'nestingLevel' => $this->nestingLevel,
);
];
return $expression;
}
@ -2058,7 +2058,7 @@ class Parser
$this->match(Lexer::T_OPEN_PARENTHESIS);
// Process ScalarExpressions (1..N)
$scalarExpressions = array();
$scalarExpressions = [];
$scalarExpressions[] = $this->ScalarExpression();
while ($this->lexer->isNextToken(Lexer::T_COMMA)) {
@ -2101,7 +2101,7 @@ class Parser
$this->match(Lexer::T_CASE);
// Process WhenClause (1..N)
$whenClauses = array();
$whenClauses = [];
do {
$whenClauses[] = $this->WhenClause();
@ -2126,7 +2126,7 @@ class Parser
$caseOperand = $this->StateFieldPathExpression();
// Process SimpleWhenClause (1..N)
$simpleWhenClauses = array();
$simpleWhenClauses = [];
do {
$simpleWhenClauses[] = $this->SimpleWhenClause();
@ -2283,11 +2283,11 @@ class Parser
$aliasResultVariable = $this->AliasResultVariable();
// Include AliasResultVariable in query components.
$this->queryComponents[$aliasResultVariable] = array(
$this->queryComponents[$aliasResultVariable] = [
'resultVariable' => $expression,
'nestingLevel' => $this->nestingLevel,
'token' => $token,
);
];
}
// AST
@ -2377,11 +2377,11 @@ class Parser
$expr->fieldIdentificationVariable = $resultVariable;
// Include AliasResultVariable in query components.
$this->queryComponents[$resultVariable] = array(
$this->queryComponents[$resultVariable] = [
'resultvariable' => $expr,
'nestingLevel' => $this->nestingLevel,
'token' => $token,
);
];
}
return $expr;
@ -2394,7 +2394,7 @@ class Parser
*/
public function ConditionalExpression()
{
$conditionalTerms = array();
$conditionalTerms = [];
$conditionalTerms[] = $this->ConditionalTerm();
while ($this->lexer->isNextToken(Lexer::T_OR)) {
@ -2419,7 +2419,7 @@ class Parser
*/
public function ConditionalTerm()
{
$conditionalFactors = array();
$conditionalFactors = [];
$conditionalFactors[] = $this->ConditionalFactor();
while ($this->lexer->isNextToken(Lexer::T_AND)) {
@ -2484,8 +2484,8 @@ class Parser
// Peek beyond the matching closing parenthesis ')'
$peek = $this->peekBeyondClosingParenthesis();
if (in_array($peek['value'], array("=", "<", "<=", "<>", ">", ">=", "!=")) ||
in_array($peek['type'], array(Lexer::T_NOT, Lexer::T_BETWEEN, Lexer::T_LIKE, Lexer::T_IN, Lexer::T_IS, Lexer::T_EXISTS)) ||
if (in_array($peek['value'], ["=", "<", "<=", "<>", ">", ">=", "!="]) ||
in_array($peek['type'], [Lexer::T_NOT, Lexer::T_BETWEEN, Lexer::T_LIKE, Lexer::T_IN, Lexer::T_IS, Lexer::T_EXISTS]) ||
$this->isMathOperator($peek)) {
$condPrimary->simpleConditionalExpression = $this->SimpleConditionalExpression();
@ -2741,7 +2741,7 @@ class Parser
*/
public function SimpleArithmeticExpression()
{
$terms = array();
$terms = [];
$terms[] = $this->ArithmeticTerm();
while (($isPlus = $this->lexer->isNextToken(Lexer::T_PLUS)) || $this->lexer->isNextToken(Lexer::T_MINUS)) {
@ -2767,7 +2767,7 @@ class Parser
*/
public function ArithmeticTerm()
{
$factors = array();
$factors = [];
$factors[] = $this->ArithmeticFactor();
while (($isMult = $this->lexer->isNextToken(Lexer::T_MULTIPLY)) || $this->lexer->isNextToken(Lexer::T_DIVIDE)) {
@ -2988,7 +2988,7 @@ class Parser
$lookaheadType = $this->lexer->lookahead['type'];
$isDistinct = false;
if ( ! in_array($lookaheadType, array(Lexer::T_COUNT, Lexer::T_AVG, Lexer::T_MAX, Lexer::T_MIN, Lexer::T_SUM))) {
if ( ! in_array($lookaheadType, [Lexer::T_COUNT, Lexer::T_AVG, Lexer::T_MAX, Lexer::T_MIN, Lexer::T_SUM])) {
$this->syntaxError('One of: MAX, MIN, AVG, SUM, COUNT');
}
@ -3018,7 +3018,7 @@ class Parser
$lookaheadType = $this->lexer->lookahead['type'];
$value = $this->lexer->lookahead['value'];
if ( ! in_array($lookaheadType, array(Lexer::T_ALL, Lexer::T_ANY, Lexer::T_SOME))) {
if ( ! in_array($lookaheadType, [Lexer::T_ALL, Lexer::T_ANY, Lexer::T_SOME])) {
$this->syntaxError('ALL, ANY or SOME');
}
@ -3097,7 +3097,7 @@ class Parser
if ($this->lexer->isNextToken(Lexer::T_SELECT)) {
$inExpression->subselect = $this->Subselect();
} else {
$literals = array();
$literals = [];
$literals[] = $this->InParameter();
while ($this->lexer->isNextToken(Lexer::T_COMMA)) {
@ -3130,7 +3130,7 @@ class Parser
$this->match(Lexer::T_INSTANCE);
$this->match(Lexer::T_OF);
$exprValues = array();
$exprValues = [];
if ($this->lexer->isNextToken(Lexer::T_OPEN_PARENTHESIS)) {
$this->match(Lexer::T_OPEN_PARENTHESIS);

View File

@ -51,7 +51,7 @@ class ParserResult
*
* @var array
*/
private $_parameterMappings = array();
private $_parameterMappings = [];
/**
* Initializes a new instance of the <tt>ParserResult</tt> class.

View File

@ -37,12 +37,12 @@ class QueryExpressionVisitor extends ExpressionVisitor
/**
* @var array
*/
private static $operatorMap = array(
private static $operatorMap = [
Comparison::GT => Expr\Comparison::GT,
Comparison::GTE => Expr\Comparison::GTE,
Comparison::LT => Expr\Comparison::LT,
Comparison::LTE => Expr\Comparison::LTE
);
];
/**
* @var array
@ -57,7 +57,7 @@ class QueryExpressionVisitor extends ExpressionVisitor
/**
* @var array
*/
private $parameters = array();
private $parameters = [];
/**
* Constructor
@ -88,7 +88,7 @@ class QueryExpressionVisitor extends ExpressionVisitor
*/
public function clearParameters()
{
$this->parameters = array();
$this->parameters = [];
}
/**
@ -108,7 +108,7 @@ class QueryExpressionVisitor extends ExpressionVisitor
*/
public function walkCompositeExpression(CompositeExpression $expr)
{
$expressionList = array();
$expressionList = [];
foreach ($expr->getExpressionList() as $child) {
$expressionList[] = $this->dispatch($child);

View File

@ -57,7 +57,7 @@ class ResultSetMapping
* @ignore
* @var array
*/
public $aliasMap = array();
public $aliasMap = [];
/**
* Maps alias names to related association field names.
@ -65,7 +65,7 @@ class ResultSetMapping
* @ignore
* @var array
*/
public $relationMap = array();
public $relationMap = [];
/**
* Maps alias names to parent alias names.
@ -73,7 +73,7 @@ class ResultSetMapping
* @ignore
* @var array
*/
public $parentAliasMap = array();
public $parentAliasMap = [];
/**
* Maps column names in the result set to field names for each class.
@ -81,7 +81,7 @@ class ResultSetMapping
* @ignore
* @var array
*/
public $fieldMappings = array();
public $fieldMappings = [];
/**
* Maps column names in the result set to the alias/field name to use in the mapped result.
@ -89,7 +89,7 @@ class ResultSetMapping
* @ignore
* @var array
*/
public $scalarMappings = array();
public $scalarMappings = [];
/**
* Maps column names in the result set to the alias/field type to use in the mapped result.
@ -97,7 +97,7 @@ class ResultSetMapping
* @ignore
* @var array
*/
public $typeMappings = array();
public $typeMappings = [];
/**
* Maps entities in the result set to the alias name to use in the mapped result.
@ -105,7 +105,7 @@ class ResultSetMapping
* @ignore
* @var array
*/
public $entityMappings = array();
public $entityMappings = [];
/**
* Maps column names of meta columns (foreign keys, discriminator columns, ...) to field names.
@ -113,7 +113,7 @@ class ResultSetMapping
* @ignore
* @var array
*/
public $metaMappings = array();
public $metaMappings = [];
/**
* Maps column names in the result set to the alias they belong to.
@ -121,7 +121,7 @@ class ResultSetMapping
* @ignore
* @var array
*/
public $columnOwnerMap = array();
public $columnOwnerMap = [];
/**
* List of columns in the result set that are used as discriminator columns.
@ -129,7 +129,7 @@ class ResultSetMapping
* @ignore
* @var array
*/
public $discriminatorColumns = array();
public $discriminatorColumns = [];
/**
* Maps alias names to field names that should be used for indexing.
@ -137,7 +137,7 @@ class ResultSetMapping
* @ignore
* @var array
*/
public $indexByMap = array();
public $indexByMap = [];
/**
* Map from column names to class names that declare the field the column is mapped to.
@ -145,28 +145,28 @@ class ResultSetMapping
* @ignore
* @var array
*/
public $declaringClasses = array();
public $declaringClasses = [];
/**
* This is necessary to hydrate derivate foreign keys correctly.
*
* @var array
*/
public $isIdentifierColumn = array();
public $isIdentifierColumn = [];
/**
* Maps column names in the result set to field names for each new object expression.
*
* @var array
*/
public $newObjectMappings = array();
public $newObjectMappings = [];
/**
* Maps metadata parameter names to the metadata attribute.
*
* @var array
*/
public $metadataParameterMapping = array();
public $metadataParameterMapping = [];
/**
* Adds an entity result to this ResultSetMapping.

View File

@ -97,7 +97,7 @@ class ResultSetMappingBuilder extends ResultSetMapping
*
* @return void
*/
public function addRootEntityFromClassMetadata($class, $alias, $renamedColumns = array(), $renameMode = null)
public function addRootEntityFromClassMetadata($class, $alias, $renamedColumns = [], $renameMode = null)
{
$renameMode = $renameMode ?: $this->defaultRenameMode;
$columnAliasMap = $this->getColumnAliasMap($class, $renameMode, $renamedColumns);
@ -119,7 +119,7 @@ class ResultSetMappingBuilder extends ResultSetMapping
*
* @return void
*/
public function addJoinedEntityFromClassMetadata($class, $alias, $parentAlias, $relation, $renamedColumns = array(), $renameMode = null)
public function addJoinedEntityFromClassMetadata($class, $alias, $parentAlias, $relation, $renamedColumns = [], $renameMode = null)
{
$renameMode = $renameMode ?: $this->defaultRenameMode;
$columnAliasMap = $this->getColumnAliasMap($class, $renameMode, $renamedColumns);
@ -139,7 +139,7 @@ class ResultSetMappingBuilder extends ResultSetMapping
*
* @throws \InvalidArgumentException
*/
protected function addAllClassFields($class, $alias, $columnAliasMap = array())
protected function addAllClassFields($class, $alias, $columnAliasMap = [])
{
$classMetadata = $this->em->getClassMetadata($class);
$platform = $this->em->getConnection()->getDatabasePlatform();
@ -232,7 +232,7 @@ class ResultSetMappingBuilder extends ResultSetMapping
$mode = self::COLUMN_RENAMING_CUSTOM;
}
$columnAlias = array();
$columnAlias = [];
$class = $this->em->getClassMetadata($className);
foreach ($class->getColumnNames() as $columnName) {
@ -436,7 +436,7 @@ class ResultSetMappingBuilder extends ResultSetMapping
*
* @return string
*/
public function generateSelectClause($tableAliases = array())
public function generateSelectClause($tableAliases = [])
{
$sql = "";
@ -470,6 +470,6 @@ class ResultSetMappingBuilder extends ResultSetMapping
*/
public function __toString()
{
return $this->generateSelectClause(array());
return $this->generateSelectClause([]);
}
}

View File

@ -109,28 +109,28 @@ class SqlWalker implements TreeWalker
/**
* @var array
*/
private $tableAliasMap = array();
private $tableAliasMap = [];
/**
* Map from result variable names to their SQL column alias names.
*
* @var array
*/
private $scalarResultAliasMap = array();
private $scalarResultAliasMap = [];
/**
* Map from Table-Alias + Column-Name to OrderBy-Direction.
*
* @var array
*/
private $orderedColumnsMap = array();
private $orderedColumnsMap = [];
/**
* Map from DQL-Alias + Field-Name to SQL Column Alias.
*
* @var array
*/
private $scalarFields = array();
private $scalarFields = [];
/**
* Map of all components/classes that appear in the DQL query.
@ -144,14 +144,14 @@ class SqlWalker implements TreeWalker
*
* @var array
*/
private $selectedClasses = array();
private $selectedClasses = [];
/**
* The DQL alias of the root class of the currently traversed query.
*
* @var array
*/
private $rootAliases = array();
private $rootAliases = [];
/**
* Flag that indicates whether to generate SQL table aliases in the SQL.
@ -245,7 +245,7 @@ class SqlWalker implements TreeWalker
*/
public function setQueryComponent($dqlAlias, array $queryComponent)
{
$requiredKeys = array('metadata', 'parent', 'relation', 'map', 'nestingLevel', 'token');
$requiredKeys = ['metadata', 'parent', 'relation', 'map', 'nestingLevel', 'token'];
if (array_diff($requiredKeys, array_keys($queryComponent))) {
throw QueryException::invalidQueryComponent($dqlAlias);
@ -354,7 +354,7 @@ class SqlWalker implements TreeWalker
$sql .= isset($this->queryComponents[$dqlAlias]['relation']) ? ' LEFT ' : ' INNER ';
$sql .= 'JOIN ' . $this->quoteStrategy->getTableName($parentClass, $this->platform) . ' ' . $tableAlias . ' ON ';
$sqlParts = array();
$sqlParts = [];
foreach ($this->quoteStrategy->getIdentifierColumnNames($class, $this->platform) as $columnName) {
$sqlParts[] = $baseTableAlias . '.' . $columnName . ' = ' . $tableAlias . '.' . $columnName;
@ -380,7 +380,7 @@ class SqlWalker implements TreeWalker
$sql .= ' LEFT JOIN ' . $this->quoteStrategy->getTableName($subClass, $this->platform) . ' ' . $tableAlias . ' ON ';
$sqlParts = array();
$sqlParts = [];
foreach ($this->quoteStrategy->getIdentifierColumnNames($subClass, $this->platform) as $columnName) {
$sqlParts[] = $baseTableAlias . '.' . $columnName . ' = ' . $tableAlias . '.' . $columnName;
@ -397,7 +397,7 @@ class SqlWalker implements TreeWalker
*/
private function _generateOrderedCollectionOrderByItems()
{
$orderedColumns = array();
$orderedColumns = [];
foreach ($this->selectedClasses as $selectedClass) {
$dqlAlias = $selectedClass['dqlAlias'];
@ -439,7 +439,7 @@ class SqlWalker implements TreeWalker
*/
private function _generateDiscriminatorColumnConditionSQL(array $dqlAliases)
{
$sqlParts = array();
$sqlParts = [];
foreach ($dqlAliases as $dqlAlias) {
$class = $this->queryComponents[$dqlAlias]['metadata'];
@ -447,7 +447,7 @@ class SqlWalker implements TreeWalker
if ( ! $class->isInheritanceTypeSingleTable()) continue;
$conn = $this->em->getConnection();
$values = array();
$values = [];
if ($class->discriminatorValue !== null) { // discriminators can be 0
$values[] = $conn->quote($class->discriminatorValue);
@ -503,7 +503,7 @@ class SqlWalker implements TreeWalker
return '';
}
$filterClauses = array();
$filterClauses = [];
foreach ($this->em->getFilters()->getEnabledFilters() as $filter) {
if ('' !== $filterExpr = $filter->addFilterConstraint($targetEntity, $targetTableAlias)) {
$filterClauses[] = '(' . $filterExpr . ')';
@ -606,7 +606,7 @@ class SqlWalker implements TreeWalker
{
$class = $this->queryComponents[$identVariable]['metadata'];
$tableAlias = $this->getSQLTableAlias($class->getTableName(), $identVariable);
$sqlParts = array();
$sqlParts = [];
foreach ($this->quoteStrategy->getIdentifierColumnNames($class, $this->platform) as $columnName) {
$sqlParts[] = $tableAlias . '.' . $columnName;
@ -699,7 +699,7 @@ class SqlWalker implements TreeWalker
public function walkSelectClause($selectClause)
{
$sql = 'SELECT ' . (($selectClause->isDistinct) ? 'DISTINCT ' : '');
$sqlSelectExpressions = array_filter(array_map(array($this, 'walkSelectExpression'), $selectClause->selectExpressions));
$sqlSelectExpressions = array_filter(array_map([$this, 'walkSelectExpression'], $selectClause->selectExpressions));
if ($this->query->getHint(Query::HINT_INTERNAL_ITERATION) == true && $selectClause->isDistinct) {
$this->query->setHint(self::HINT_DISTINCT, true);
@ -812,7 +812,7 @@ class SqlWalker implements TreeWalker
public function walkFromClause($fromClause)
{
$identificationVarDecls = $fromClause->identificationVariableDeclarations;
$sqlParts = array();
$sqlParts = [];
foreach ($identificationVarDecls as $identificationVariableDecl) {
$sqlParts[] = $this->walkIdentificationVariableDeclaration($identificationVariableDecl);
@ -937,7 +937,7 @@ class SqlWalker implements TreeWalker
// The owning side is necessary at this point because only it contains the JoinColumn information.
switch (true) {
case ($assoc['type'] & ClassMetadata::TO_ONE):
$conditions = array();
$conditions = [];
foreach ($assoc['joinColumns'] as $joinColumn) {
$quotedSourceColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $targetClass, $this->platform);
@ -953,7 +953,7 @@ class SqlWalker implements TreeWalker
}
// Apply remaining inheritance restrictions
$discrSql = $this->_generateDiscriminatorColumnConditionSQL(array($joinedDqlAlias));
$discrSql = $this->_generateDiscriminatorColumnConditionSQL([$joinedDqlAlias]);
if ($discrSql) {
$conditions[] = $discrSql;
@ -966,10 +966,10 @@ class SqlWalker implements TreeWalker
$conditions[] = $filterExpr;
}
$targetTableJoin = array(
$targetTableJoin = [
'table' => $targetTableName . ' ' . $targetTableAlias,
'condition' => implode(' AND ', $conditions),
);
];
break;
case ($assoc['type'] == ClassMetadata::MANY_TO_MANY):
@ -978,7 +978,7 @@ class SqlWalker implements TreeWalker
$joinTableAlias = $this->getSQLTableAlias($joinTable['name'], $joinedDqlAlias);
$joinTableName = $this->quoteStrategy->getJoinTableName($assoc, $sourceClass, $this->platform);
$conditions = array();
$conditions = [];
$relationColumns = ($relation['isOwningSide'])
? $assoc['joinTable']['joinColumns']
: $assoc['joinTable']['inverseJoinColumns'];
@ -995,7 +995,7 @@ class SqlWalker implements TreeWalker
// Join target table
$sql .= ($joinType == AST\Join::JOIN_TYPE_LEFT || $joinType == AST\Join::JOIN_TYPE_LEFTOUTER) ? ' LEFT JOIN ' : ' INNER JOIN ';
$conditions = array();
$conditions = [];
$relationColumns = ($relation['isOwningSide'])
? $assoc['joinTable']['inverseJoinColumns']
: $assoc['joinTable']['joinColumns'];
@ -1008,7 +1008,7 @@ class SqlWalker implements TreeWalker
}
// Apply remaining inheritance restrictions
$discrSql = $this->_generateDiscriminatorColumnConditionSQL(array($joinedDqlAlias));
$discrSql = $this->_generateDiscriminatorColumnConditionSQL([$joinedDqlAlias]);
if ($discrSql) {
$conditions[] = $discrSql;
@ -1021,10 +1021,10 @@ class SqlWalker implements TreeWalker
$conditions[] = $filterExpr;
}
$targetTableJoin = array(
$targetTableJoin = [
'table' => $targetTableName . ' ' . $targetTableAlias,
'condition' => implode(' AND ', $conditions),
);
];
break;
default:
@ -1074,7 +1074,7 @@ class SqlWalker implements TreeWalker
*/
public function walkOrderByClause($orderByClause)
{
$orderByItems = array_map(array($this, 'walkOrderByItem'), $orderByClause->orderByItems);
$orderByItems = array_map([$this, 'walkOrderByItem'], $orderByClause->orderByItems);
if (($collectionOrderByItems = $this->_generateOrderedCollectionOrderByItems()) !== '') {
$orderByItems = array_merge($orderByItems, (array) $collectionOrderByItems);
@ -1141,7 +1141,7 @@ class SqlWalker implements TreeWalker
$sql .= $this->walkRangeVariableDeclaration($joinDeclaration);
// Apply remaining inheritance restrictions
$discrSql = $this->_generateDiscriminatorColumnConditionSQL(array($dqlAlias));
$discrSql = $this->_generateDiscriminatorColumnConditionSQL([$dqlAlias]);
if ($discrSql) {
$conditions[] = $discrSql;
@ -1206,7 +1206,7 @@ class SqlWalker implements TreeWalker
{
$sql = 'COALESCE(';
$scalarExpressions = array();
$scalarExpressions = [];
foreach ($coalesceExpression->scalarExpressions as $scalarExpression) {
$scalarExpressions[] = $this->walkSimpleArithmeticExpression($scalarExpression);
@ -1375,7 +1375,7 @@ class SqlWalker implements TreeWalker
$partialFieldSet = $expr->partialFieldSet;
} else {
$dqlAlias = $expr;
$partialFieldSet = array();
$partialFieldSet = [];
}
$queryComp = $this->queryComponents[$dqlAlias];
@ -1383,14 +1383,14 @@ class SqlWalker implements TreeWalker
$resultAlias = $selectExpression->fieldIdentificationVariable ?: null;
if ( ! isset($this->selectedClasses[$dqlAlias])) {
$this->selectedClasses[$dqlAlias] = array(
$this->selectedClasses[$dqlAlias] = [
'class' => $class,
'dqlAlias' => $dqlAlias,
'resultAlias' => $resultAlias
);
];
}
$sqlParts = array();
$sqlParts = [];
// Select all fields from the queried class
foreach ($class->fieldMappings as $fieldName => $mapping) {
@ -1475,7 +1475,7 @@ class SqlWalker implements TreeWalker
$useAliasesBefore = $this->useSqlTableAliases;
$rootAliasesBefore = $this->rootAliases;
$this->rootAliases = array(); // reset the rootAliases for the subselect
$this->rootAliases = []; // reset the rootAliases for the subselect
$this->useSqlTableAliases = true;
$sql = $this->walkSimpleSelectClause($subselect->simpleSelectClause);
@ -1498,7 +1498,7 @@ class SqlWalker implements TreeWalker
public function walkSubselectFromClause($subselectFromClause)
{
$identificationVarDecls = $subselectFromClause->identificationVariableDeclarations;
$sqlParts = array ();
$sqlParts = [];
foreach ($identificationVarDecls as $subselectIdVarDecl) {
$sqlParts[] = $this->walkIdentificationVariableDeclaration($subselectIdVarDecl);
@ -1533,7 +1533,7 @@ class SqlWalker implements TreeWalker
*/
public function walkNewObject($newObjectExpression, $newObjectResultAlias=null)
{
$sqlSelectExpressions = array();
$sqlSelectExpressions = [];
$objIndex = $newObjectResultAlias?:$this->newObjectCounter++;
foreach ($newObjectExpression->args as $argIndex => $e) {
@ -1581,11 +1581,11 @@ class SqlWalker implements TreeWalker
$this->scalarResultAliasMap[$resultAlias] = $columnAlias;
$this->rsm->addScalarResult($columnAlias, $resultAlias, $fieldType);
$this->rsm->newObjectMappings[$columnAlias] = array(
$this->rsm->newObjectMappings[$columnAlias] = [
'className' => $newObjectExpression->className,
'objIndex' => $objIndex,
'argIndex' => $argIndex
);
];
}
return implode(', ', $sqlSelectExpressions);
@ -1662,7 +1662,7 @@ class SqlWalker implements TreeWalker
*/
public function walkGroupByClause($groupByClause)
{
$sqlParts = array();
$sqlParts = [];
foreach ($groupByClause->groupByItems as $groupByItem) {
$sqlParts[] = $this->walkGroupByItem($groupByItem);
@ -1697,7 +1697,7 @@ class SqlWalker implements TreeWalker
}
// IdentificationVariable
$sqlParts = array();
$sqlParts = [];
foreach ($this->queryComponents[$groupByItem]['metadata']->fieldNames as $field) {
$item = new AST\PathExpression(AST\PathExpression::TYPE_STATE_FIELD, $groupByItem, $field);
@ -1745,7 +1745,7 @@ class SqlWalker implements TreeWalker
$this->setSQLTableAlias($tableName, $tableName, $updateClause->aliasIdentificationVariable);
$this->rootAliases[] = $updateClause->aliasIdentificationVariable;
$sql .= ' SET ' . implode(', ', array_map(array($this, 'walkUpdateItem'), $updateClause->updateItems));
$sql .= ' SET ' . implode(', ', array_map([$this, 'walkUpdateItem'], $updateClause->updateItems));
return $sql;
}
@ -1789,7 +1789,7 @@ class SqlWalker implements TreeWalker
$discrSql = $this->_generateDiscriminatorColumnConditionSql($this->rootAliases);
if ($this->em->hasFilters()) {
$filterClauses = array();
$filterClauses = [];
foreach ($this->rootAliases as $dqlAlias) {
$class = $this->queryComponents[$dqlAlias]['metadata'];
$tableAlias = $this->getSQLTableAlias($class->table['name'], $dqlAlias);
@ -1830,7 +1830,7 @@ class SqlWalker implements TreeWalker
return $this->walkConditionalTerm($condExpr);
}
return implode(' OR ', array_map(array($this, 'walkConditionalTerm'), $condExpr->conditionalTerms));
return implode(' OR ', array_map([$this, 'walkConditionalTerm'], $condExpr->conditionalTerms));
}
/**
@ -1844,7 +1844,7 @@ class SqlWalker implements TreeWalker
return $this->walkConditionalFactor($condTerm);
}
return implode(' AND ', array_map(array($this, 'walkConditionalFactor'), $condTerm->conditionalFactors));
return implode(' AND ', array_map([$this, 'walkConditionalFactor'], $condTerm->conditionalFactors));
}
/**
@ -1929,7 +1929,7 @@ class SqlWalker implements TreeWalker
$sql .= $this->quoteStrategy->getTableName($targetClass, $this->platform) . ' ' . $targetTableAlias . ' WHERE ';
$owningAssoc = $targetClass->associationMappings[$assoc['mappedBy']];
$sqlParts = array();
$sqlParts = [];
foreach ($owningAssoc['targetToSourceKeyColumns'] as $targetColumn => $sourceColumn) {
$targetColumn = $this->quoteStrategy->getColumnName($class->fieldNames[$targetColumn], $class, $this->platform);
@ -1963,7 +1963,7 @@ class SqlWalker implements TreeWalker
// join conditions
$joinColumns = $assoc['isOwningSide'] ? $joinTable['inverseJoinColumns'] : $joinTable['joinColumns'];
$joinSqlParts = array();
$joinSqlParts = [];
foreach ($joinColumns as $joinColumn) {
$targetColumn = $this->quoteStrategy->getColumnName($targetClass->fieldNames[$joinColumn['referencedColumnName']], $targetClass, $this->platform);
@ -1975,7 +1975,7 @@ class SqlWalker implements TreeWalker
$sql .= ' WHERE ';
$joinColumns = $assoc['isOwningSide'] ? $joinTable['joinColumns'] : $joinTable['inverseJoinColumns'];
$sqlParts = array();
$sqlParts = [];
foreach ($joinColumns as $joinColumn) {
$targetColumn = $this->quoteStrategy->getColumnName($class->fieldNames[$joinColumn['referencedColumnName']], $class, $this->platform);
@ -2038,7 +2038,7 @@ class SqlWalker implements TreeWalker
$sql .= ($inExpr->subselect)
? $this->walkSubselect($inExpr->subselect)
: implode(', ', array_map(array($this, 'walkInParameter'), $inExpr->literals));
: implode(', ', array_map([$this, 'walkInParameter'], $inExpr->literals));
$sql .= ')';
@ -2065,7 +2065,7 @@ class SqlWalker implements TreeWalker
$sql .= $class->discriminatorColumn['name'] . ($instanceOfExpr->not ? ' NOT IN ' : ' IN ');
$sqlParameterList = array();
$sqlParameterList = [];
foreach ($instanceOfExpr->value as $parameter) {
if ($parameter instanceof AST\InputParameter) {
@ -2239,7 +2239,7 @@ class SqlWalker implements TreeWalker
return $this->walkArithmeticTerm($simpleArithmeticExpr);
}
return implode(' ', array_map(array($this, 'walkArithmeticTerm'), $simpleArithmeticExpr->arithmeticTerms));
return implode(' ', array_map([$this, 'walkArithmeticTerm'], $simpleArithmeticExpr->arithmeticTerms));
}
/**
@ -2259,7 +2259,7 @@ class SqlWalker implements TreeWalker
return $this->walkArithmeticFactor($term);
}
return implode(' ', array_map(array($this, 'walkArithmeticFactor'), $term->arithmeticFactors));
return implode(' ', array_map([$this, 'walkArithmeticFactor'], $term->arithmeticFactors));
}
/**

View File

@ -72,7 +72,7 @@ abstract class TreeWalkerAdapter implements TreeWalker
*/
public function setQueryComponent($dqlAlias, array $queryComponent)
{
$requiredKeys = array('metadata', 'parent', 'relation', 'map', 'nestingLevel', 'token');
$requiredKeys = ['metadata', 'parent', 'relation', 'map', 'nestingLevel', 'token'];
if (array_diff($requiredKeys, array_keys($queryComponent))) {
throw QueryException::invalidQueryComponent($dqlAlias);

View File

@ -72,7 +72,7 @@ class TreeWalkerChain implements TreeWalker
*/
public function setQueryComponent($dqlAlias, array $queryComponent)
{
$requiredKeys = array('metadata', 'parent', 'relation', 'map', 'nestingLevel', 'token');
$requiredKeys = ['metadata', 'parent', 'relation', 'map', 'nestingLevel', 'token'];
if (array_diff($requiredKeys, array_keys($queryComponent))) {
throw QueryException::invalidQueryComponent($dqlAlias);

Some files were not shown because too many files have changed in this diff Show More