Skip to content

Commit

Permalink
Merge pull request #189 from AlessandroMinoccheri/fix_array_declarations
Browse files Browse the repository at this point in the history
fixed array declarations for php 7
  • Loading branch information
malarzm committed Apr 4, 2018
2 parents 17b4ca0 + 34a72bf commit 0f589e6
Show file tree
Hide file tree
Showing 28 changed files with 461 additions and 462 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/Common/Annotations/Annotation/Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ final class Enum
public function __construct(array $values)
{
if ( ! isset($values['literal'])) {
$values['literal'] = array();
$values['literal'] = [];
}

foreach ($values['value'] as $var) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ final class IgnoreAnnotation
public function __construct(array $values)
{
if (is_string($values['value'])) {
$values['value'] = array($values['value']);
$values['value'] = [$values['value']];
}
if (!is_array($values['value'])) {
throw new \RuntimeException(sprintf('@IgnoreAnnotation expects either a string name, or an array of strings, but got %s.', json_encode($values['value'])));
Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/Common/Annotations/Annotation/Target.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ final class Target
/**
* @var array
*/
private static $map = array(
private static $map = [
'ALL' => self::TARGET_ALL,
'CLASS' => self::TARGET_CLASS,
'METHOD' => self::TARGET_METHOD,
'PROPERTY' => self::TARGET_PROPERTY,
'ANNOTATION' => self::TARGET_ANNOTATION,
);
];

/**
* @var array
Expand Down Expand Up @@ -79,7 +79,7 @@ public function __construct(array $values)
$values['value'] = null;
}
if (is_string($values['value'])){
$values['value'] = array($values['value']);
$values['value'] = [$values['value']];
}
if (!is_array($values['value'])){
throw new \InvalidArgumentException(
Expand Down
20 changes: 10 additions & 10 deletions lib/Doctrine/Common/Annotations/AnnotationReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ class AnnotationReader implements Reader
*
* @var array
*/
private static $globalImports = array(
private static $globalImports = [
'ignoreannotation' => 'Doctrine\Common\Annotations\Annotation\IgnoreAnnotation',
);
];

/**
* A list with annotations that are not causing exceptions when not resolved to an annotation class.
Expand All @@ -52,7 +52,7 @@ class AnnotationReader implements Reader
*
* @var array
*/
private static $globalIgnoredNames = array(
private static $globalIgnoredNames = [
// Annotation tags
'Annotation' => true, 'Attribute' => true, 'Attributes' => true,
/* Can we enable this? 'Enum' => true, */
Expand Down Expand Up @@ -102,7 +102,7 @@ class AnnotationReader implements Reader
'startuml' => true, 'enduml' => true,
// Symfony 3.3 Cache Adapter
'experimental' => true
);
];

/**
* A list with annotations that are not causing exceptions when not resolved to an annotation class.
Expand All @@ -111,7 +111,7 @@ class AnnotationReader implements Reader
*
* @var array
*/
private static $globalIgnoredNamespaces = array();
private static $globalIgnoredNamespaces = [];

/**
* Add a new annotation to the globally ignored annotation names with regard to exception handling.
Expand Down Expand Up @@ -159,14 +159,14 @@ static public function addGlobalIgnoredNamespace($namespace)
*
* @var array
*/
private $imports = array();
private $imports = [];

/**
* In-memory cache mechanism to store ignored annotations per class.
*
* @var array
*/
private $ignoredAnnotationNames = array();
private $ignoredAnnotationNames = [];

/**
* Constructor.
Expand Down Expand Up @@ -342,7 +342,7 @@ private function getMethodImports(ReflectionMethod $method)
$class = $method->getDeclaringClass();
$classImports = $this->getClassImports($class);

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

foreach ($class->getTraits() as $trait) {
if ($trait->hasMethod($method->getName())
Expand All @@ -367,7 +367,7 @@ private function getPropertyImports(ReflectionProperty $property)
$class = $property->getDeclaringClass();
$classImports = $this->getClassImports($class);

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

foreach ($class->getTraits() as $trait) {
if ($trait->hasProperty($property->getName())) {
Expand Down Expand Up @@ -401,7 +401,7 @@ private function collectParsingMetadata(ReflectionClass $class)
$this->imports[$name] = array_merge(
self::$globalImports,
$this->phpParser->parseClass($class),
array('__NAMESPACE__' => $class->getNamespaceName())
['__NAMESPACE__' => $class->getNamespaceName()]
);

$this->ignoredAnnotationNames[$name] = $ignoredAnnotationNames;
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/Common/Annotations/CachedReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ final class CachedReader implements Reader
/**
* @var array
*/
private $loadedAnnotations = array();
private $loadedAnnotations = [];

/**
* Constructor.
Expand Down Expand Up @@ -172,7 +172,7 @@ public function getMethodAnnotation(\ReflectionMethod $method, $annotationName)
*/
public function clearLoadedAnnotations()
{
$this->loadedAnnotations = array();
$this->loadedAnnotations = [];
}

/**
Expand Down
14 changes: 7 additions & 7 deletions lib/Doctrine/Common/Annotations/DocLexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ final class DocLexer extends AbstractLexer
/**
* @var array
*/
protected $noCase = array(
protected $noCase = [
'@' => self::T_AT,
',' => self::T_COMMA,
'(' => self::T_OPEN_PARENTHESIS,
Expand All @@ -65,35 +65,35 @@ final class DocLexer extends AbstractLexer
'=' => self::T_EQUALS,
':' => self::T_COLON,
'\\' => self::T_NAMESPACE_SEPARATOR
);
];

/**
* @var array
*/
protected $withCase = array(
protected $withCase = [
'true' => self::T_TRUE,
'false' => self::T_FALSE,
'null' => self::T_NULL
);
];

/**
* {@inheritdoc}
*/
protected function getCatchablePatterns()
{
return array(
return [
'[a-z_\\\][a-z0-9_\:\\\]*[a-z_][a-z0-9_]*',
'(?:[+-]?[0-9]+(?:[\.][0-9]+)*)(?:[eE][+-]?[0-9]+)?',
'"(?:""|[^"])*+"',
);
];
}

/**
* {@inheritdoc}
*/
protected function getNonCatchablePatterns()
{
return array('\s+', '\*+', '(.)');
return ['\s+', '\*+', '(.)'];
}

/**
Expand Down
Loading

0 comments on commit 0f589e6

Please sign in to comment.