updated core and modules
This commit is contained in:
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2006-2012 Doctrine Project
|
||||
Copyright (c) 2006-2015 Doctrine Project
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
|
||||
Vendored
+6
-8
@@ -13,26 +13,24 @@
|
||||
{"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"php": "~5.5|~7.0",
|
||||
"doctrine/inflector": "1.*",
|
||||
"doctrine/cache": "1.*",
|
||||
"doctrine/collections": "1.*",
|
||||
"doctrine/lexer": "1.*",
|
||||
"doctrine/annotations": "1.*"
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~3.7"
|
||||
"phpunit/phpunit": "~4.8|~5.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "Doctrine\\Common\\": "lib/" }
|
||||
"psr-4": {
|
||||
"Doctrine\\Common\\": "lib/Doctrine/Common"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.6.x-dev"
|
||||
"dev-master": "2.7.x-dev"
|
||||
}
|
||||
},
|
||||
"archive": {
|
||||
"exclude": ["!vendor", "tests", "*phpunit.xml", ".travis.yml", "build.xml", "build.properties", "composer.phar"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ class ClassLoader
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
spl_autoload_register(array($this, 'loadClass'));
|
||||
spl_autoload_register([$this, 'loadClass']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,7 +163,7 @@ class ClassLoader
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
spl_autoload_unregister(array($this, 'loadClass'));
|
||||
spl_autoload_unregister([$this, 'loadClass']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -275,6 +275,6 @@ class ClassLoader
|
||||
{
|
||||
return class_exists($type, $autoload)
|
||||
|| interface_exists($type, $autoload)
|
||||
|| (function_exists('trait_exists') && trait_exists($type, $autoload));
|
||||
|| trait_exists($type, $autoload);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class EventManager
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_listeners = array();
|
||||
private $_listeners = [];
|
||||
|
||||
/**
|
||||
* Dispatches an event to all registered listeners.
|
||||
|
||||
+10
-3
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+6
-6
@@ -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])) {
|
||||
|
||||
+5
-5
@@ -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)) {
|
||||
|
||||
Vendored
+2
-2
@@ -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) {
|
||||
|
||||
+8
-5
@@ -145,11 +145,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 +178,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();
|
||||
|
||||
Vendored
+4
-4
@@ -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) {
|
||||
|
||||
+3
-3
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -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)) {
|
||||
|
||||
Vendored
+7
-7
@@ -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);
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ class StaticReflectionService implements ReflectionService
|
||||
*/
|
||||
public function getParentClasses($class)
|
||||
{
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -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]);
|
||||
|
||||
@@ -87,7 +87,7 @@ abstract class AbstractProxyFactory
|
||||
/**
|
||||
* @var \Doctrine\Common\Proxy\ProxyDefinition[]
|
||||
*/
|
||||
private $definitions = array();
|
||||
private $definitions = [];
|
||||
|
||||
/**
|
||||
* @param \Doctrine\Common\Proxy\ProxyGenerator $proxyGenerator
|
||||
|
||||
@@ -58,10 +58,10 @@ class ProxyGenerator
|
||||
*
|
||||
* @var string[]|callable[]
|
||||
*/
|
||||
protected $placeholders = array(
|
||||
'baseProxyInterface' => 'Doctrine\Common\Proxy\Proxy',
|
||||
protected $placeholders = [
|
||||
'baseProxyInterface' => Proxy::class,
|
||||
'additionalProperties' => '',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* Template used as a blueprint to generate proxies.
|
||||
@@ -106,7 +106,7 @@ class <proxyShortClassName> extends \<className> implements \<baseProxyInterface
|
||||
*
|
||||
* @see \Doctrine\Common\Persistence\Proxy::__getLazyProperties
|
||||
*/
|
||||
public static $lazyPropertiesDefaults = array(<lazyPropertiesDefaults>);
|
||||
public static $lazyPropertiesDefaults = [<lazyPropertiesDefaults>];
|
||||
|
||||
<additionalProperties>
|
||||
|
||||
@@ -129,7 +129,7 @@ class <proxyShortClassName> extends \<className> implements \<baseProxyInterface
|
||||
*/
|
||||
public function __load()
|
||||
{
|
||||
$this->__initializer__ && $this->__initializer__->__invoke($this, \'__load\', array());
|
||||
$this->__initializer__ && $this->__initializer__->__invoke($this, \'__load\', []);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -263,12 +263,12 @@ class <proxyShortClassName> extends \<className> implements \<baseProxyInterface
|
||||
preg_match_all('(<([a-zA-Z]+)>)', $this->proxyClassTemplate, $placeholderMatches);
|
||||
|
||||
$placeholderMatches = array_combine($placeholderMatches[0], $placeholderMatches[1]);
|
||||
$placeholders = array();
|
||||
$placeholders = [];
|
||||
|
||||
foreach ($placeholderMatches as $placeholder => $name) {
|
||||
$placeholders[$placeholder] = isset($this->placeholders[$name])
|
||||
? $this->placeholders[$name]
|
||||
: array($this, 'generate' . $name);
|
||||
: [$this, 'generate' . $name];
|
||||
}
|
||||
|
||||
foreach ($placeholders as & $placeholder) {
|
||||
@@ -302,7 +302,7 @@ class <proxyShortClassName> extends \<className> implements \<baseProxyInterface
|
||||
$tmpFileName = $fileName . '.' . uniqid('', true);
|
||||
|
||||
file_put_contents($tmpFileName, $proxyCode);
|
||||
chmod($tmpFileName, 0664);
|
||||
@chmod($tmpFileName, 0664);
|
||||
rename($tmpFileName, $fileName);
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ class <proxyShortClassName> extends \<className> implements \<baseProxyInterface
|
||||
private function generateLazyPropertiesDefaults(ClassMetadata $class)
|
||||
{
|
||||
$lazyPublicProperties = $this->getLazyLoadedPublicProperties($class);
|
||||
$values = array();
|
||||
$values = [];
|
||||
|
||||
foreach ($lazyPublicProperties as $key => $value) {
|
||||
$values[] = var_export($key, true) . ' => ' . var_export($value, true);
|
||||
@@ -385,7 +385,7 @@ class <proxyShortClassName> extends \<className> implements \<baseProxyInterface
|
||||
{
|
||||
|
||||
EOT;
|
||||
$toUnset = array();
|
||||
$toUnset = [];
|
||||
|
||||
foreach ($this->getLazyLoadedPublicProperties($class) as $lazyPublicProperty => $unused) {
|
||||
$toUnset[] = '$this->' . $lazyPublicProperty;
|
||||
@@ -443,7 +443,7 @@ EOT;
|
||||
if ( ! empty($lazyPublicProperties)) {
|
||||
$magicGet .= <<<'EOT'
|
||||
if (array_key_exists($name, $this->__getLazyProperties())) {
|
||||
$this->__initializer__ && $this->__initializer__->__invoke($this, '__get', array($name));
|
||||
$this->__initializer__ && $this->__initializer__->__invoke($this, '__get', [$name]);
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
@@ -454,7 +454,7 @@ EOT;
|
||||
|
||||
if ($hasParentGet) {
|
||||
$magicGet .= <<<'EOT'
|
||||
$this->__initializer__ && $this->__initializer__->__invoke($this, '__get', array($name));
|
||||
$this->__initializer__ && $this->__initializer__->__invoke($this, '__get', [$name]);
|
||||
|
||||
return parent::__get($name);
|
||||
|
||||
@@ -502,7 +502,7 @@ EOT;
|
||||
if ( ! empty($lazyPublicProperties)) {
|
||||
$magicSet .= <<<'EOT'
|
||||
if (array_key_exists($name, $this->__getLazyProperties())) {
|
||||
$this->__initializer__ && $this->__initializer__->__invoke($this, '__set', array($name, $value));
|
||||
$this->__initializer__ && $this->__initializer__->__invoke($this, '__set', [$name, $value]);
|
||||
|
||||
$this->$name = $value;
|
||||
|
||||
@@ -515,7 +515,7 @@ EOT;
|
||||
|
||||
if ($hasParentSet) {
|
||||
$magicSet .= <<<'EOT'
|
||||
$this->__initializer__ && $this->__initializer__->__invoke($this, '__set', array($name, $value));
|
||||
$this->__initializer__ && $this->__initializer__->__invoke($this, '__set', [$name, $value]);
|
||||
|
||||
return parent::__set($name, $value);
|
||||
EOT;
|
||||
@@ -559,7 +559,7 @@ EOT;
|
||||
if ( ! empty($lazyPublicProperties)) {
|
||||
$magicIsset .= <<<'EOT'
|
||||
if (array_key_exists($name, $this->__getLazyProperties())) {
|
||||
$this->__initializer__ && $this->__initializer__->__invoke($this, '__isset', array($name));
|
||||
$this->__initializer__ && $this->__initializer__->__invoke($this, '__isset', [$name]);
|
||||
|
||||
return isset($this->$name);
|
||||
}
|
||||
@@ -570,7 +570,7 @@ EOT;
|
||||
|
||||
if ($hasParentIsset) {
|
||||
$magicIsset .= <<<'EOT'
|
||||
$this->__initializer__ && $this->__initializer__->__invoke($this, '__isset', array($name));
|
||||
$this->__initializer__ && $this->__initializer__->__invoke($this, '__isset', [$name]);
|
||||
|
||||
return parent::__isset($name);
|
||||
|
||||
@@ -605,7 +605,7 @@ EOT;
|
||||
|
||||
if ($hasParentSleep) {
|
||||
return $sleepImpl . <<<'EOT'
|
||||
$properties = array_merge(array('__isInitialized__'), parent::__sleep());
|
||||
$properties = array_merge(['__isInitialized__'], parent::__sleep());
|
||||
|
||||
if ($this->__isInitialized__) {
|
||||
$properties = array_diff($properties, array_keys($this->__getLazyProperties()));
|
||||
@@ -616,7 +616,7 @@ EOT;
|
||||
EOT;
|
||||
}
|
||||
|
||||
$allProperties = array('__isInitialized__');
|
||||
$allProperties = ['__isInitialized__'];
|
||||
|
||||
/* @var $prop \ReflectionProperty */
|
||||
foreach ($class->getReflectionClass()->getProperties() as $prop) {
|
||||
@@ -645,10 +645,10 @@ EOT;
|
||||
|
||||
return $sleepImpl . <<<EOT
|
||||
if (\$this->__isInitialized__) {
|
||||
return array($allProperties);
|
||||
return [$allProperties];
|
||||
}
|
||||
|
||||
return array($protectedProperties);
|
||||
return [$protectedProperties];
|
||||
}
|
||||
EOT;
|
||||
}
|
||||
@@ -662,7 +662,7 @@ EOT;
|
||||
*/
|
||||
private function generateWakeupImpl(ClassMetadata $class)
|
||||
{
|
||||
$unsetPublicProperties = array();
|
||||
$unsetPublicProperties = [];
|
||||
$hasWakeup = $class->getReflectionClass()->hasMethod('__wakeup');
|
||||
|
||||
foreach (array_keys($this->getLazyLoadedPublicProperties($class)) as $lazyPublicProperty) {
|
||||
@@ -727,7 +727,7 @@ EOT;
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
\$this->__cloner__ && \$this->__cloner__->__invoke(\$this, '__clone', array());
|
||||
\$this->__cloner__ && \$this->__cloner__->__invoke(\$this, '__clone', []);
|
||||
$callParentClone }
|
||||
EOT;
|
||||
}
|
||||
@@ -742,16 +742,16 @@ EOT;
|
||||
private function generateMethods(ClassMetadata $class)
|
||||
{
|
||||
$methods = '';
|
||||
$methodNames = array();
|
||||
$methodNames = [];
|
||||
$reflectionMethods = $class->getReflectionClass()->getMethods(\ReflectionMethod::IS_PUBLIC);
|
||||
$skippedMethods = array(
|
||||
$skippedMethods = [
|
||||
'__sleep' => true,
|
||||
'__clone' => true,
|
||||
'__wakeup' => true,
|
||||
'__get' => true,
|
||||
'__set' => true,
|
||||
'__isset' => true,
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($reflectionMethods as $method) {
|
||||
$name = $method->getName();
|
||||
@@ -778,12 +778,13 @@ EOT;
|
||||
}
|
||||
|
||||
$methods .= $name . '(' . $this->buildParametersString($class, $method, $method->getParameters()) . ')';
|
||||
$methods .= $this->getMethodReturnType($method);
|
||||
$methods .= "\n" . ' {' . "\n";
|
||||
|
||||
if ($this->isShortIdentifierGetter($method, $class)) {
|
||||
$identifier = lcfirst(substr($name, 3));
|
||||
$fieldType = $class->getTypeOfField($identifier);
|
||||
$cast = in_array($fieldType, array('integer', 'smallint')) ? '(int) ' : '';
|
||||
$cast = in_array($fieldType, ['integer', 'smallint']) ? '(int) ' : '';
|
||||
|
||||
$methods .= ' if ($this->__isInitialized__ === false) {' . "\n";
|
||||
$methods .= ' return ' . $cast . ' parent::' . $method->getName() . "();\n";
|
||||
@@ -795,7 +796,7 @@ EOT;
|
||||
|
||||
$methods .= "\n \$this->__initializer__ "
|
||||
. "&& \$this->__initializer__->__invoke(\$this, " . var_export($name, true)
|
||||
. ", array(" . $invokeParamsString . "));"
|
||||
. ", [" . $invokeParamsString . "]);"
|
||||
. "\n\n return parent::" . $name . '(' . $callParamsString . ');'
|
||||
. "\n" . ' }' . "\n";
|
||||
}
|
||||
@@ -872,7 +873,7 @@ EOT;
|
||||
private function getLazyLoadedPublicProperties(ClassMetadata $class)
|
||||
{
|
||||
$defaultProperties = $class->getReflectionClass()->getDefaultProperties();
|
||||
$properties = array();
|
||||
$properties = [];
|
||||
|
||||
foreach ($class->getReflectionClass()->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
|
||||
$name = $property->getName();
|
||||
@@ -894,7 +895,7 @@ EOT;
|
||||
*/
|
||||
private function buildParametersString(ClassMetadata $class, \ReflectionMethod $method, array $parameters)
|
||||
{
|
||||
$parameterDefinitions = array();
|
||||
$parameterDefinitions = [];
|
||||
|
||||
/* @var $param \ReflectionParameter */
|
||||
foreach ($parameters as $param) {
|
||||
@@ -908,10 +909,8 @@ EOT;
|
||||
$parameterDefinition .= '&';
|
||||
}
|
||||
|
||||
if (method_exists($param, 'isVariadic')) {
|
||||
if ($param->isVariadic()) {
|
||||
$parameterDefinition .= '...';
|
||||
}
|
||||
if (method_exists($param, 'isVariadic') && $param->isVariadic()) {
|
||||
$parameterDefinition .= '...';
|
||||
}
|
||||
|
||||
$parameters[] = '$' . $param->getName();
|
||||
@@ -942,10 +941,14 @@ EOT;
|
||||
return 'array';
|
||||
}
|
||||
|
||||
if (method_exists($parameter, 'isCallable') && $parameter->isCallable()) {
|
||||
if ($parameter->isCallable()) {
|
||||
return 'callable';
|
||||
}
|
||||
|
||||
if (method_exists($parameter, 'hasType') && $parameter->hasType() && $parameter->getType()->isBuiltin()) {
|
||||
return (string) $parameter->getType();
|
||||
}
|
||||
|
||||
try {
|
||||
$parameterClass = $parameter->getClass();
|
||||
|
||||
@@ -990,10 +993,8 @@ EOT;
|
||||
function (\ReflectionParameter $parameter) {
|
||||
$name = '';
|
||||
|
||||
if (method_exists($parameter, 'isVariadic')) {
|
||||
if ($parameter->isVariadic()) {
|
||||
$name .= '...';
|
||||
}
|
||||
if (method_exists($parameter, 'isVariadic') && $parameter->isVariadic()) {
|
||||
$name .= '...';
|
||||
}
|
||||
|
||||
$name .= '$' . $parameter->getName();
|
||||
@@ -1003,4 +1004,34 @@ EOT;
|
||||
$parameters
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Param \ReflectionMethod $method
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getMethodReturnType(\ReflectionMethod $method)
|
||||
{
|
||||
if (! (method_exists($method, 'hasReturnType') && $method->hasReturnType())) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$returnType = $method->getReturnType();
|
||||
|
||||
if ($returnType->isBuiltin()) {
|
||||
return ': ' . $returnType;
|
||||
}
|
||||
|
||||
$nameLower = strtolower((string) $returnType);
|
||||
|
||||
if ('self' === $nameLower) {
|
||||
return ': \\' . $method->getDeclaringClass()->getName();
|
||||
}
|
||||
|
||||
if ('parent' === $nameLower) {
|
||||
return ': \\' . $method->getDeclaringClass()->getParentClass()->getName();
|
||||
}
|
||||
|
||||
return ': \\' . (string) $returnType;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -402,7 +402,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function newInstanceArgs(array $args = array())
|
||||
public function newInstanceArgs(array $args = [])
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
}
|
||||
|
||||
+5
-5
@@ -69,18 +69,18 @@ class StaticReflectionParser implements ReflectionProviderInterface
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $useStatements = array();
|
||||
protected $useStatements = [];
|
||||
|
||||
/**
|
||||
* The docComment of the class.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $docComment = array(
|
||||
protected $docComment = [
|
||||
'class' => '',
|
||||
'property' => array(),
|
||||
'method' => array()
|
||||
);
|
||||
'property' => [],
|
||||
'method' => []
|
||||
];
|
||||
|
||||
/**
|
||||
* The name of the class this class extends, if any.
|
||||
|
||||
+3
-3
@@ -91,7 +91,7 @@ class StaticReflectionProperty extends ReflectionProperty
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public static function export ($class, $name, $return = false)
|
||||
public static function export($class, $name, $return = false)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
}
|
||||
@@ -155,7 +155,7 @@ class StaticReflectionProperty extends ReflectionProperty
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setAccessible ($accessible)
|
||||
public function setAccessible($accessible)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
}
|
||||
@@ -163,7 +163,7 @@ class StaticReflectionProperty extends ReflectionProperty
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setValue ($object, $value = null)
|
||||
public function setValue($object, $value = null)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
namespace Doctrine\Common\Util;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Persistence\Proxy;
|
||||
|
||||
/**
|
||||
@@ -95,13 +96,13 @@ final class Debug
|
||||
$return = null;
|
||||
$isObj = is_object($var);
|
||||
|
||||
if ($isObj && in_array('Doctrine\Common\Collections\Collection', class_implements($var))) {
|
||||
if ($var instanceof Collection) {
|
||||
$var = $var->toArray();
|
||||
}
|
||||
|
||||
if ($maxDepth) {
|
||||
if (is_array($var)) {
|
||||
$return = array();
|
||||
$return = [];
|
||||
|
||||
foreach ($var as $k => $v) {
|
||||
$return[$k] = self::export($v, $maxDepth - 1);
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ class Version
|
||||
/**
|
||||
* Current Doctrine Version.
|
||||
*/
|
||||
const VERSION = '2.6.0-DEV';
|
||||
const VERSION = '2.6.2-DEV';
|
||||
|
||||
/**
|
||||
* Compares a Doctrine version with the current one.
|
||||
|
||||
Reference in New Issue
Block a user