@@ -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
0 commit comments