Skip to content

Commit

Permalink
Merge pull request #393 from doctrine/cleanup/drop-unsupported-php-ve…
Browse files Browse the repository at this point in the history
…rsions

Cleanup - drop unsupported php versions
  • Loading branch information
beberlei committed Dec 4, 2015
2 parents fe7126c + 71b41ac commit cba39f2
Show file tree
Hide file tree
Showing 48 changed files with 454 additions and 423 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Expand Up @@ -7,9 +7,6 @@ cache:
- $HOME/.composer/cache

php:
- 5.3.3
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -13,15 +13,15 @@
{"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.*"
},
"require-dev": {
"phpunit/phpunit": "~4.7"
"phpunit/phpunit": "~4.8|~5.0"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/Common/ClassLoader.php
Expand Up @@ -153,7 +153,7 @@ public function getFileExtension()
*/
public function register()
{
spl_autoload_register(array($this, 'loadClass'));
spl_autoload_register([$this, 'loadClass']);
}

/**
Expand All @@ -163,7 +163,7 @@ public function register()
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
spl_autoload_unregister([$this, 'loadClass']);
}

/**
Expand Down Expand Up @@ -275,6 +275,6 @@ private static function typeExists($type, $autoload = false)
{
return class_exists($type, $autoload)
|| interface_exists($type, $autoload)
|| (function_exists('trait_exists') && trait_exists($type, $autoload));
|| trait_exists($type, $autoload);
}
}
2 changes: 1 addition & 1 deletion lib/Doctrine/Common/EventManager.php
Expand Up @@ -38,7 +38,7 @@ class EventManager
*
* @var array
*/
private $_listeners = array();
private $_listeners = [];

/**
* Dispatches an event to all registered listeners.
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php
Expand Up @@ -141,7 +141,7 @@ public function getConnectionNames()
*/
public function getConnections()
{
$connections = array();
$connections = [];
foreach ($this->connections as $name => $id) {
$connections[$name] = $this->getService($id);
}
Expand Down Expand Up @@ -226,7 +226,7 @@ public function getManagerNames()
*/
public function getManagers()
{
$dms = array();
$dms = [];
foreach ($this->managers as $name => $id) {
$dms[$name] = $this->getService($id);
}
Expand Down
Expand Up @@ -53,7 +53,7 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory
/**
* @var ClassMetadata[]
*/
private $loadedMetadata = array();
private $loadedMetadata = [];

/**
* @var bool
Expand Down Expand Up @@ -110,7 +110,7 @@ public function getAllMetadata()
}

$driver = $this->getDriver();
$metadata = array();
$metadata = [];
foreach ($driver->getAllClassNames() as $className) {
$metadata[] = $this->getMetadataFor($className);
}
Expand Down Expand Up @@ -277,7 +277,7 @@ public function setMetadataFor($className, $class)
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;
Expand Down Expand Up @@ -306,15 +306,15 @@ protected function loadMetadata($name)
$this->initialize();
}

$loaded = array();
$loaded = [];

$parentClasses = $this->getParentClasses($name);
$parentClasses[] = $name;

// 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])) {
Expand Down
Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -200,8 +200,8 @@ public function getAllClassNames()
throw MappingException::pathRequired();
}

$classes = array();
$includedFiles = array();
$classes = [];
$includedFiles = [];

foreach ($this->paths as $path) {
if ( ! is_dir($path)) {
Expand Down
Expand Up @@ -37,7 +37,7 @@ class DefaultFileLocator implements FileLocator
*
* @var array
*/
protected $paths = array();
protected $paths = [];

/**
* The file extension of mapping documents.
Expand Down Expand Up @@ -125,7 +125,7 @@ public function findMappingFile($className)
*/
public function getAllClassNames($globalBasename)
{
$classes = array();
$classes = [];

if ($this->paths) {
foreach ($this->paths as $path) {
Expand Down
13 changes: 8 additions & 5 deletions lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php
Expand Up @@ -145,11 +145,14 @@ public function getAllClassNames()
$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)
);
}

/**
Expand All @@ -175,7 +178,7 @@ abstract protected function loadMappingFile($file);
*/
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();
Expand Down
Expand Up @@ -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.
Expand Down Expand Up @@ -117,8 +117,8 @@ public function loadMetadataForClass($className, ClassMetadata $metadata)
*/
public function getAllClassNames()
{
$classNames = array();
$driverClasses = array();
$classNames = [];
$driverClasses = [];

/* @var $driver MappingDriver */
foreach ($this->drivers AS $namespace => $driver) {
Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/Common/Persistence/Mapping/Driver/PHPDriver.php
Expand Up @@ -44,8 +44,7 @@ class PHPDriver extends FileDriver
*/
public function __construct($locator, $fileExtension = null)
{
$fileExtension = ".php";
parent::__construct($locator, $fileExtension);
parent::__construct($locator, '.php');
}

/**
Expand All @@ -54,6 +53,7 @@ public function __construct($locator, $fileExtension = null)
public function loadMetadataForClass($className, ClassMetadata $metadata)
{
$this->metadata = $metadata;

$this->loadMappingFile($this->locator->findMappingFile($className));
}

Expand All @@ -65,6 +65,6 @@ protected function loadMappingFile($file)
$metadata = $this->metadata;
include $file;

return array($metadata->getName() => $metadata);
return [$metadata->getName() => $metadata];
}
}
Expand Up @@ -40,7 +40,7 @@ class StaticPHPDriver implements MappingDriver
*
* @var array
*/
private $paths = array();
private $paths = [];

/**
* Map of all class names.
Expand Down Expand Up @@ -93,8 +93,8 @@ public function getAllClassNames()
throw MappingException::pathRequired();
}

$classes = array();
$includedFiles = array();
$classes = [];
$includedFiles = [];

foreach ($this->paths as $path) {
if (!is_dir($path)) {
Expand Down
Expand Up @@ -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.
Expand Down Expand Up @@ -164,7 +164,7 @@ public function fileExists($className)
*/
public function getAllClassNames($globalBasename = null)
{
$classes = array();
$classes = [];

if ($this->paths) {
foreach ((array) $this->paths as $path) {
Expand Down
Expand Up @@ -31,7 +31,7 @@ class StaticReflectionService implements ReflectionService
*/
public function getParentClasses($class)
{
return array();
return [];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/Common/Persistence/PersistentObject.php
Expand Up @@ -198,7 +198,7 @@ private function add($field, $args)
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]);
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/Common/Proxy/AbstractProxyFactory.php
Expand Up @@ -87,7 +87,7 @@ abstract class AbstractProxyFactory
/**
* @var \Doctrine\Common\Proxy\ProxyDefinition[]
*/
private $definitions = array();
private $definitions = [];

/**
* @param \Doctrine\Common\Proxy\ProxyGenerator $proxyGenerator
Expand Down

0 comments on commit cba39f2

Please sign in to comment.