Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 66419fd

Browse files
committed
Merge branch 'feature/php-short-array-syntax' into develop
2 parents 1915a6f + 77d727c commit 66419fd

File tree

76 files changed

+502
-501
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+502
-501
lines changed

.php_cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ $config->fixers(
3333
'object_operator',
3434
'php_closing_tag',
3535
'remove_lines_between_uses',
36+
'short_array_syntax',
3637
'short_tag',
3738
'standardize_not_equal',
3839
'trailing_spaces',

src/Annotation/AnnotationManager.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ class AnnotationManager implements EventManagerAwareInterface
4141
*/
4242
public function setEventManager(EventManagerInterface $events)
4343
{
44-
$events->setIdentifiers(array(
44+
$events->setIdentifiers([
4545
__CLASS__,
4646
get_class($this),
47-
));
47+
]);
4848
$this->events = $events;
4949

5050
return $this;
@@ -75,7 +75,7 @@ public function getEventManager()
7575
public function attach(ParserInterface $parser)
7676
{
7777
$this->getEventManager()
78-
->attach(self::EVENT_CREATE_ANNOTATION, array($parser, 'onCreateAnnotation'));
78+
->attach(self::EVENT_CREATE_ANNOTATION, [$parser, 'onCreateAnnotation']);
7979

8080
return $this;
8181
}
@@ -91,11 +91,11 @@ public function createAnnotation(array $annotationData)
9191
$event = new Event();
9292
$event->setName(self::EVENT_CREATE_ANNOTATION);
9393
$event->setTarget($this);
94-
$event->setParams(array(
94+
$event->setParams([
9595
'class' => $annotationData[0],
9696
'content' => $annotationData[1],
9797
'raw' => $annotationData[2],
98-
));
98+
]);
9999

100100
$eventManager = $this->getEventManager();
101101
$results = $eventManager->trigger($event, function ($r) {

src/Annotation/Parser/DoctrineAnnotationParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class DoctrineAnnotationParser implements ParserInterface
2929
/**
3030
* @var array Annotation classes we support on this iteration
3131
*/
32-
protected $allowedAnnotations = array();
32+
protected $allowedAnnotations = [];
3333

3434
/**
3535
* @var DocParser

src/Annotation/Parser/GenericAnnotationParser.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ class GenericAnnotationParser implements ParserInterface
2626
/**
2727
* @var array
2828
*/
29-
protected $aliases = array();
29+
protected $aliases = [];
3030

3131
/**
3232
* @var array
3333
*/
34-
protected $annotationNames = array();
34+
protected $annotationNames = [];
3535

3636
/**
3737
* @var AnnotationInterface[]
3838
*/
39-
protected $annotations = array();
39+
protected $annotations = [];
4040

4141
/**
4242
* Listen to onCreateAnnotation, and attempt to return an annotation object
@@ -190,7 +190,7 @@ public function setAlias($alias, $class)
190190
*/
191191
protected function normalizeAlias($alias)
192192
{
193-
return strtolower(str_replace(array('-', '_', ' ', '\\', '/'), '', $alias));
193+
return strtolower(str_replace(['-', '_', ' ', '\\', '/'], '', $alias));
194194
}
195195

196196
/**

src/Generator/AbstractGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ abstract class AbstractGenerator implements GeneratorInterface
3636
/**
3737
* @param array $options
3838
*/
39-
public function __construct($options = array())
39+
public function __construct($options = [])
4040
{
4141
if ($options) {
4242
$this->setOptions($options);

src/Generator/ClassGenerator.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,22 @@ class ClassGenerator extends AbstractGenerator
5151
/**
5252
* @var array Array of string names
5353
*/
54-
protected $implementedInterfaces = array();
54+
protected $implementedInterfaces = [];
5555

5656
/**
5757
* @var PropertyGenerator[] Array of properties
5858
*/
59-
protected $properties = array();
59+
protected $properties = [];
6060

6161
/**
6262
* @var PropertyGenerator[] Array of constants
6363
*/
64-
protected $constants = array();
64+
protected $constants = [];
6565

6666
/**
6767
* @var MethodGenerator[] Array of methods
6868
*/
69-
protected $methods = array();
69+
protected $methods = [];
7070

7171
/**
7272
* @var TraitUsageGenerator Object to encapsulate trait usage logic
@@ -107,15 +107,15 @@ public static function fromReflection(ClassReflection $classReflection)
107107
$interfaces = array_diff($interfaces, $parentClass->getInterfaces());
108108
}
109109

110-
$interfaceNames = array();
110+
$interfaceNames = [];
111111
foreach ($interfaces as $interface) {
112112
/* @var \Zend\Code\Reflection\ClassReflection $interface */
113113
$interfaceNames[] = $interface->getName();
114114
}
115115

116116
$cg->setImplementedInterfaces($interfaceNames);
117117

118-
$properties = array();
118+
$properties = [];
119119

120120
foreach ($classReflection->getProperties() as $reflectionProperty) {
121121
if ($reflectionProperty->getDeclaringClass()->getName() == $classReflection->getName()) {
@@ -125,18 +125,18 @@ public static function fromReflection(ClassReflection $classReflection)
125125

126126
$cg->addProperties($properties);
127127

128-
$constants = array();
128+
$constants = [];
129129

130130
foreach ($classReflection->getConstants() as $name => $value) {
131-
$constants[] = array(
131+
$constants[] = [
132132
'name' => $name,
133133
'value' => $value
134-
);
134+
];
135135
}
136136

137137
$cg->addConstants($constants);
138138

139-
$methods = array();
139+
$methods = [];
140140

141141
foreach ($classReflection->getMethods() as $reflectionMethod) {
142142
$className = ($cg->getNamespaceName()) ? $cg->getNamespaceName() . "\\" . $cg->getName() : $cg->getName();
@@ -179,7 +179,7 @@ public static function fromArray(array $array)
179179
$cg = new static($array['name']);
180180
foreach ($array as $name => $value) {
181181
// normalize key
182-
switch (strtolower(str_replace(array('.', '-', '_'), '', $name))) {
182+
switch (strtolower(str_replace(['.', '-', '_'], '', $name))) {
183183
case 'containingfile':
184184
$cg->setContainingFileGenerator($value);
185185
break;
@@ -226,9 +226,9 @@ public function __construct(
226226
$namespaceName = null,
227227
$flags = null,
228228
$extends = null,
229-
$interfaces = array(),
230-
$properties = array(),
231-
$methods = array(),
229+
$interfaces = [],
230+
$properties = [],
231+
$methods = [],
232232
$docBlock = null
233233
) {
234234
$this->traitUsageGenerator = new TraitUsageGenerator($this);
@@ -242,7 +242,7 @@ public function __construct(
242242
if ($flags !== null) {
243243
$this->setFlags($flags);
244244
}
245-
if ($properties !== array()) {
245+
if ($properties !== []) {
246246
$this->addProperties($properties);
247247
}
248248
if ($extends !== null) {
@@ -251,7 +251,7 @@ public function __construct(
251251
if (is_array($interfaces)) {
252252
$this->setImplementedInterfaces($interfaces);
253253
}
254-
if ($methods !== array()) {
254+
if ($methods !== []) {
255255
$this->addMethods($methods);
256256
}
257257
if ($docBlock !== null) {
@@ -546,7 +546,7 @@ public function addConstants(array $constants)
546546
$this->addPropertyFromGenerator($constant);
547547
} else {
548548
if (is_array($constant)) {
549-
call_user_func_array(array($this, 'addConstant'), $constant);
549+
call_user_func_array([$this, 'addConstant'], $constant);
550550
}
551551
}
552552
}
@@ -567,7 +567,7 @@ public function addProperties(array $properties)
567567
if (is_string($property)) {
568568
$this->addProperty($property);
569569
} elseif (is_array($property)) {
570-
call_user_func_array(array($this, 'addProperty'), $property);
570+
call_user_func_array([$this, 'addProperty'], $property);
571571
}
572572
}
573573
}
@@ -699,7 +699,7 @@ public function addMethods(array $methods)
699699
if (is_string($method)) {
700700
$this->addMethod($method);
701701
} elseif (is_array($method)) {
702-
call_user_func_array(array($this, 'addMethod'), $method);
702+
call_user_func_array([$this, 'addMethod'], $method);
703703
}
704704
}
705705
}
@@ -720,7 +720,7 @@ public function addMethods(array $methods)
720720
*/
721721
public function addMethod(
722722
$name = null,
723-
array $parameters = array(),
723+
array $parameters = [],
724724
$flags = MethodGenerator::FLAG_PUBLIC,
725725
$body = null,
726726
$docBlock = null

src/Generator/DocBlock/Tag/AbstractTypeableTag.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ abstract class AbstractTypeableTag extends AbstractGenerator
2626
/**
2727
* @var array
2828
*/
29-
protected $types = array();
29+
protected $types = [];
3030

3131
/**
3232
* @param array $types
3333
* @param string $description
3434
*/
35-
public function __construct($types = array(), $description = null)
35+
public function __construct($types = [], $description = null)
3636
{
3737
if (!empty($types)) {
3838
$this->setTypes($types);

src/Generator/DocBlock/Tag/MethodTag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class MethodTag extends AbstractTypeableTag implements TagInterface
2727
* @param string $description
2828
* @param bool $isStatic
2929
*/
30-
public function __construct($methodName = null, $types = array(), $description = null, $isStatic = false)
30+
public function __construct($methodName = null, $types = [], $description = null, $isStatic = false)
3131
{
3232
if (!empty($methodName)) {
3333
$this->setMethodName($methodName);

src/Generator/DocBlock/Tag/ParamTag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ParamTag extends AbstractTypeableTag implements TagInterface
2424
* @param array $types
2525
* @param string $description
2626
*/
27-
public function __construct($variableName = null, $types = array(), $description = null)
27+
public function __construct($variableName = null, $types = [], $description = null)
2828
{
2929
if (!empty($variableName)) {
3030
$this->setVariableName($variableName);

src/Generator/DocBlock/Tag/PropertyTag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class PropertyTag extends AbstractTypeableTag implements TagInterface
2121
* @param array $types
2222
* @param string $description
2323
*/
24-
public function __construct($propertyName = null, $types = array(), $description = null)
24+
public function __construct($propertyName = null, $types = [], $description = null)
2525
{
2626
if (!empty($propertyName)) {
2727
$this->setPropertyName($propertyName);

0 commit comments

Comments
 (0)