Update core 8.3.0
This commit is contained in:
parent
da7a7918f8
commit
cd7a898e66
6144 changed files with 132297 additions and 87747 deletions
|
@ -141,7 +141,7 @@ abstract class AbstractManagerRegistry implements ManagerRegistry
|
|||
*/
|
||||
public function getConnections()
|
||||
{
|
||||
$connections = array();
|
||||
$connections = [];
|
||||
foreach ($this->connections as $name => $id) {
|
||||
$connections[$name] = $this->getService($id);
|
||||
}
|
||||
|
@ -195,8 +195,13 @@ abstract class AbstractManagerRegistry implements ManagerRegistry
|
|||
}
|
||||
|
||||
$proxyClass = new \ReflectionClass($class);
|
||||
|
||||
if ($proxyClass->implementsInterface($this->proxyInterfaceName)) {
|
||||
$class = $proxyClass->getParentClass()->getName();
|
||||
if (! $parentClass = $proxyClass->getParentClass()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$class = $parentClass->getName();
|
||||
}
|
||||
|
||||
foreach ($this->managers as $id) {
|
||||
|
@ -221,7 +226,7 @@ abstract class AbstractManagerRegistry implements ManagerRegistry
|
|||
*/
|
||||
public function getManagers()
|
||||
{
|
||||
$dms = array();
|
||||
$dms = [];
|
||||
foreach ($this->managers as $name => $id) {
|
||||
$dms[$name] = $this->getService($id);
|
||||
}
|
||||
|
@ -253,5 +258,7 @@ abstract class AbstractManagerRegistry implements ManagerRegistry
|
|||
// force the creation of a new document manager
|
||||
// if the current one is closed
|
||||
$this->resetService($this->managers[$name]);
|
||||
|
||||
return $this->getManager($name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory
|
|||
/**
|
||||
* @var ClassMetadata[]
|
||||
*/
|
||||
private $loadedMetadata = array();
|
||||
private $loadedMetadata = [];
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
|
@ -110,7 +110,7 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory
|
|||
}
|
||||
|
||||
$driver = $this->getDriver();
|
||||
$metadata = array();
|
||||
$metadata = [];
|
||||
foreach ($driver->getAllClassNames() as $className) {
|
||||
$metadata[] = $this->getMetadataFor($className);
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory
|
|||
|
||||
try {
|
||||
if ($this->cacheDriver) {
|
||||
if (($cached = $this->cacheDriver->fetch($realClassName . $this->cacheSalt)) !== false) {
|
||||
if (($cached = $this->cacheDriver->fetch($realClassName . $this->cacheSalt)) instanceof ClassMetadata) {
|
||||
$this->loadedMetadata[$realClassName] = $cached;
|
||||
|
||||
$this->wakeupReflection($cached, $this->getReflectionService());
|
||||
|
@ -277,7 +277,7 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory
|
|||
protected function getParentClasses($name)
|
||||
{
|
||||
// Collect parent classes, ignoring transient (not-mapped) classes.
|
||||
$parentClasses = array();
|
||||
$parentClasses = [];
|
||||
foreach (array_reverse($this->getReflectionService()->getParentClasses($name)) as $parentClass) {
|
||||
if ( ! $this->getDriver()->isTransient($parentClass)) {
|
||||
$parentClasses[] = $parentClass;
|
||||
|
@ -306,7 +306,7 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory
|
|||
$this->initialize();
|
||||
}
|
||||
|
||||
$loaded = array();
|
||||
$loaded = [];
|
||||
|
||||
$parentClasses = $this->getParentClasses($name);
|
||||
$parentClasses[] = $name;
|
||||
|
@ -314,7 +314,7 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory
|
|||
// Move down the hierarchy of parent classes, starting from the topmost class
|
||||
$parent = null;
|
||||
$rootEntityFound = false;
|
||||
$visited = array();
|
||||
$visited = [];
|
||||
$reflService = $this->getReflectionService();
|
||||
foreach ($parentClasses as $className) {
|
||||
if (isset($this->loadedMetadata[$className])) {
|
||||
|
|
|
@ -45,14 +45,14 @@ abstract class AnnotationDriver implements MappingDriver
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $paths = array();
|
||||
protected $paths = [];
|
||||
|
||||
/**
|
||||
* The paths excluded from path where to look for mapping files.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $excludePaths = array();
|
||||
protected $excludePaths = [];
|
||||
|
||||
/**
|
||||
* The file extension of mapping documents.
|
||||
|
@ -73,7 +73,7 @@ abstract class AnnotationDriver implements MappingDriver
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $entityAnnotationClasses = array();
|
||||
protected $entityAnnotationClasses = [];
|
||||
|
||||
/**
|
||||
* Initializes a new AnnotationDriver that uses the given AnnotationReader for reading
|
||||
|
@ -200,8 +200,8 @@ abstract class AnnotationDriver implements MappingDriver
|
|||
throw MappingException::pathRequired();
|
||||
}
|
||||
|
||||
$classes = array();
|
||||
$includedFiles = array();
|
||||
$classes = [];
|
||||
$includedFiles = [];
|
||||
|
||||
foreach ($this->paths as $path) {
|
||||
if ( ! is_dir($path)) {
|
||||
|
|
|
@ -37,7 +37,7 @@ class DefaultFileLocator implements FileLocator
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $paths = array();
|
||||
protected $paths = [];
|
||||
|
||||
/**
|
||||
* The file extension of mapping documents.
|
||||
|
@ -125,7 +125,7 @@ class DefaultFileLocator implements FileLocator
|
|||
*/
|
||||
public function getAllClassNames($globalBasename)
|
||||
{
|
||||
$classes = array();
|
||||
$classes = [];
|
||||
|
||||
if ($this->paths) {
|
||||
foreach ($this->paths as $path) {
|
||||
|
|
|
@ -117,6 +117,8 @@ abstract class FileDriver implements MappingDriver
|
|||
throw MappingException::invalidMappingFile($className, str_replace('\\', '.', $className) . $this->locator->getFileExtension());
|
||||
}
|
||||
|
||||
$this->classCache[$className] = $result[$className];
|
||||
|
||||
return $result[$className];
|
||||
}
|
||||
|
||||
|
@ -145,11 +147,14 @@ abstract class FileDriver implements MappingDriver
|
|||
$this->initialize();
|
||||
}
|
||||
|
||||
$classNames = (array)$this->locator->getAllClassNames($this->globalBasename);
|
||||
if ($this->classCache) {
|
||||
$classNames = array_merge(array_keys($this->classCache), $classNames);
|
||||
if (! $this->classCache) {
|
||||
return (array) $this->locator->getAllClassNames($this->globalBasename);
|
||||
}
|
||||
return $classNames;
|
||||
|
||||
return array_merge(
|
||||
array_keys($this->classCache),
|
||||
(array) $this->locator->getAllClassNames($this->globalBasename)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -175,7 +180,7 @@ abstract class FileDriver implements MappingDriver
|
|||
*/
|
||||
protected function initialize()
|
||||
{
|
||||
$this->classCache = array();
|
||||
$this->classCache = [];
|
||||
if (null !== $this->globalBasename) {
|
||||
foreach ($this->locator->getPaths() as $path) {
|
||||
$file = $path.'/'.$this->globalBasename.$this->locator->getFileExtension();
|
||||
|
|
|
@ -39,12 +39,12 @@ class MappingDriverChain implements MappingDriver
|
|||
*
|
||||
* @var MappingDriver|null
|
||||
*/
|
||||
private $defaultDriver = null;
|
||||
private $defaultDriver;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $drivers = array();
|
||||
private $drivers = [];
|
||||
|
||||
/**
|
||||
* Gets the default driver.
|
||||
|
@ -117,8 +117,8 @@ class MappingDriverChain implements MappingDriver
|
|||
*/
|
||||
public function getAllClassNames()
|
||||
{
|
||||
$classNames = array();
|
||||
$driverClasses = array();
|
||||
$classNames = [];
|
||||
$driverClasses = [];
|
||||
|
||||
/* @var $driver MappingDriver */
|
||||
foreach ($this->drivers AS $namespace => $driver) {
|
||||
|
|
|
@ -44,8 +44,7 @@ class PHPDriver extends FileDriver
|
|||
*/
|
||||
public function __construct($locator, $fileExtension = null)
|
||||
{
|
||||
$fileExtension = ".php";
|
||||
parent::__construct($locator, $fileExtension);
|
||||
parent::__construct($locator, '.php');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,6 +53,7 @@ class PHPDriver extends FileDriver
|
|||
public function loadMetadataForClass($className, ClassMetadata $metadata)
|
||||
{
|
||||
$this->metadata = $metadata;
|
||||
|
||||
$this->loadMappingFile($this->locator->findMappingFile($className));
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,6 @@ class PHPDriver extends FileDriver
|
|||
$metadata = $this->metadata;
|
||||
include $file;
|
||||
|
||||
return array($metadata->getName() => $metadata);
|
||||
return [$metadata->getName() => $metadata];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ class StaticPHPDriver implements MappingDriver
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $paths = array();
|
||||
private $paths = [];
|
||||
|
||||
/**
|
||||
* Map of all class names.
|
||||
|
@ -93,8 +93,8 @@ class StaticPHPDriver implements MappingDriver
|
|||
throw MappingException::pathRequired();
|
||||
}
|
||||
|
||||
$classes = array();
|
||||
$includedFiles = array();
|
||||
$classes = [];
|
||||
$includedFiles = [];
|
||||
|
||||
foreach ($this->paths as $path) {
|
||||
if (!is_dir($path)) {
|
||||
|
|
|
@ -37,14 +37,14 @@ class SymfonyFileLocator implements FileLocator
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $paths = array();
|
||||
protected $paths = [];
|
||||
|
||||
/**
|
||||
* A map of mapping directory path to namespace prefix used to expand class shortnames.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $prefixes = array();
|
||||
protected $prefixes = [];
|
||||
|
||||
/**
|
||||
* File extension that is searched for.
|
||||
|
@ -153,7 +153,9 @@ class SymfonyFileLocator implements FileLocator
|
|||
}
|
||||
|
||||
$filename = $path.'/'.strtr(substr($className, strlen($prefix)+1), '\\', $this->nsSeparator).$this->fileExtension;
|
||||
return is_file($filename);
|
||||
if (is_file($filename)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -164,7 +166,7 @@ class SymfonyFileLocator implements FileLocator
|
|||
*/
|
||||
public function getAllClassNames($globalBasename = null)
|
||||
{
|
||||
$classes = array();
|
||||
$classes = [];
|
||||
|
||||
if ($this->paths) {
|
||||
foreach ((array) $this->paths as $path) {
|
||||
|
@ -194,7 +196,7 @@ class SymfonyFileLocator implements FileLocator
|
|||
'\\'
|
||||
);
|
||||
|
||||
$classes[] = $this->prefixes[$path] . $nsSuffix . '\\' .str_replace($this->nsSeparator, '\\', $fileName);
|
||||
$classes[] = $this->prefixes[$path] . str_replace(DIRECTORY_SEPARATOR, '\\', $nsSuffix) . '\\' .str_replace($this->nsSeparator, '\\', $fileName);
|
||||
} else {
|
||||
$classes[] = str_replace($this->nsSeparator, '\\', $fileName);
|
||||
}
|
||||
|
@ -230,8 +232,6 @@ class SymfonyFileLocator implements FileLocator
|
|||
if (is_file($filename)) {
|
||||
return $filename;
|
||||
}
|
||||
|
||||
throw MappingException::mappingFileNotFound($className, $filename);
|
||||
}
|
||||
|
||||
throw MappingException::mappingFileNotFound($className, substr($className, strrpos($className, '\\') + 1).$this->fileExtension);
|
||||
|
|
|
@ -31,7 +31,7 @@ class StaticReflectionService implements ReflectionService
|
|||
*/
|
||||
public function getParentClasses($class)
|
||||
{
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,7 +34,7 @@ interface ObjectRepository
|
|||
*
|
||||
* @param mixed $id The identifier.
|
||||
*
|
||||
* @return object The object.
|
||||
* @return object|null The object.
|
||||
*/
|
||||
public function find($id);
|
||||
|
||||
|
@ -68,7 +68,7 @@ interface ObjectRepository
|
|||
*
|
||||
* @param array $criteria The criteria.
|
||||
*
|
||||
* @return object The object.
|
||||
* @return object|null The object.
|
||||
*/
|
||||
public function findOneBy(array $criteria);
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ abstract class PersistentObject implements ObjectManagerAware
|
|||
throw new \InvalidArgumentException("Expected persistent object of type '".$targetClass."'");
|
||||
}
|
||||
if (!($this->$field instanceof Collection)) {
|
||||
$this->$field = new ArrayCollection($this->$field ?: array());
|
||||
$this->$field = new ArrayCollection($this->$field ?: []);
|
||||
}
|
||||
$this->$field->add($args[0]);
|
||||
$this->completeOwningSide($field, $targetClass, $args[0]);
|
||||
|
|
Reference in a new issue