@@ -34,11 +34,11 @@ |
||
| 34 | 34 | /** @param \PhpParser\Node[] $definitionAttributes */ |
| 35 | 35 | public function build(array $definitionAttributes): array |
| 36 | 36 | { |
| 37 | - $attributes = array_filter($definitionAttributes, function ($attribute) { |
|
| 37 | + $attributes = array_filter($definitionAttributes, function($attribute) { |
|
| 38 | 38 | return $attribute instanceof Property; |
| 39 | 39 | }); |
| 40 | 40 | |
| 41 | - return array_map(function (Property $attribute) { |
|
| 41 | + return array_map(function(Property $attribute) { |
|
| 42 | 42 | return [ |
| 43 | 43 | "\${$attribute->props[0]->name}", |
| 44 | 44 | $this->resolveVisibility($attribute), |
@@ -23,10 +23,10 @@ |
||
| 23 | 23 | /** @param \PhpParser\Node[] $classAttributes */ |
| 24 | 24 | public function build(array $classAttributes): array |
| 25 | 25 | { |
| 26 | - $constants = array_filter($classAttributes, function ($attribute) { |
|
| 26 | + $constants = array_filter($classAttributes, function($attribute) { |
|
| 27 | 27 | return $attribute instanceof ClassConst; |
| 28 | 28 | }); |
| 29 | - return array_map(function (ClassConst $constant) { |
|
| 29 | + return array_map(function(ClassConst $constant) { |
|
| 30 | 30 | return [ |
| 31 | 31 | "{$constant->consts[0]->name}", |
| 32 | 32 | $this->determineType($constant->consts[0]), |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | /** @param ClassMethod[] $classMethods */ |
| 38 | 38 | public function build(array $classMethods): array |
| 39 | 39 | { |
| 40 | - return array_map(function (ClassMethod $method) { |
|
| 40 | + return array_map(function(ClassMethod $method) { |
|
| 41 | 41 | return $this->buildMethod($method); |
| 42 | 42 | }, $this->runFilters($classMethods)); |
| 43 | 43 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | private function buildParameters(array $parameters): array |
| 58 | 58 | { |
| 59 | - return array_map(function (Param $parameter) { |
|
| 59 | + return array_map(function(Param $parameter) { |
|
| 60 | 60 | return [ |
| 61 | 61 | "\${$parameter->name}", |
| 62 | 62 | $parameter->type, |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | /** @return Method[] */ |
| 26 | 26 | public function methods(RawDefinition $definition): array |
| 27 | 27 | { |
| 28 | - return array_map(function (array $method) { |
|
| 28 | + return array_map(function(array $method) { |
|
| 29 | 29 | return $this->buildMethod($method); |
| 30 | 30 | }, $definition->methods()); |
| 31 | 31 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | /** @return Attribute[] */ |
| 34 | 34 | public function attributes(RawDefinition $class): array |
| 35 | 35 | { |
| 36 | - return array_map(function (array $attribute) { |
|
| 36 | + return array_map(function(array $attribute) { |
|
| 37 | 37 | [$name, $modifier, $comment, $isStatic] = $attribute; |
| 38 | 38 | if ($isStatic) { |
| 39 | 39 | return StaticAttribute::$modifier($name, $this->extractTypeFrom($comment)); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | /** @return Constant[] */ |
| 46 | 46 | public function constants(RawDefinition $definition): array |
| 47 | 47 | { |
| 48 | - return array_map(function (array $constant) { |
|
| 48 | + return array_map(function(array $constant) { |
|
| 49 | 49 | [$name, $type] = $constant; |
| 50 | 50 | return new Constant($name, TypeDeclaration::from($type)); |
| 51 | 51 | }, $definition->constants()); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | /** @return Variable[] */ |
| 67 | 67 | private function buildParameters(array $parameters): array |
| 68 | 68 | { |
| 69 | - return array_map(function (array $parameter) { |
|
| 69 | + return array_map(function(array $parameter) { |
|
| 70 | 70 | [$name, $type] = $parameter; |
| 71 | 71 | return Variable::declaredWith($name, TypeDeclaration::from($type)); |
| 72 | 72 | }, $parameters); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | return TypeDeclaration::absent(); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $type = null; // There might be no type information in the comment |
|
| 81 | + $type = null; // There might be no type information in the comment |
|
| 82 | 82 | $matches = []; |
| 83 | 83 | $arrayExpression = '/^[\s*]*@var\s+array\(\s*(\w+\s*=>\s*)?(\w+)\s*\).*$/m'; |
| 84 | 84 | if (preg_match($arrayExpression, $comment, $matches)) { |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | public function hasConstructor(): bool |
| 37 | 37 | { |
| 38 | - return \count(array_filter($this->methods, function (Method $function) { |
|
| 38 | + return \count(array_filter($this->methods, function(Method $function) { |
|
| 39 | 39 | return $function->isConstructor(); |
| 40 | 40 | })) === 1; |
| 41 | 41 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | return []; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - $constructors = array_filter($this->methods, function (Method $method) { |
|
| 50 | + $constructors = array_filter($this->methods, function(Method $method) { |
|
| 51 | 51 | return $method->isConstructor(); |
| 52 | 52 | }); |
| 53 | 53 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | public function isAbstract(): bool |
| 63 | 63 | { |
| 64 | - return \count(array_filter($this->methods(), function (Method $method) { |
|
| 64 | + return \count(array_filter($this->methods(), function(Method $method) { |
|
| 65 | 65 | return $method->isAbstract(); |
| 66 | 66 | })) > 0; |
| 67 | 67 | } |
@@ -73,14 +73,14 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | public function countAttributesByVisibility(Visibility $modifier): int |
| 75 | 75 | { |
| 76 | - return \count(array_filter($this->attributes, function (Attribute $attribute) use ($modifier) { |
|
| 76 | + return \count(array_filter($this->attributes, function(Attribute $attribute) use ($modifier) { |
|
| 77 | 77 | return $attribute->hasVisibility($modifier); |
| 78 | 78 | })); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | public function countTypedAttributesByVisibility(Visibility $modifier): int |
| 82 | 82 | { |
| 83 | - return \count(array_filter($this->attributes, function (Attribute $attribute) use ($modifier) { |
|
| 83 | + return \count(array_filter($this->attributes, function(Attribute $attribute) use ($modifier) { |
|
| 84 | 84 | return $attribute->hasTypeDeclaration() && $attribute->hasVisibility($modifier); |
| 85 | 85 | })); |
| 86 | 86 | } |