@@ -62,7 +62,7 @@ |
||
62 | 62 | |
63 | 63 | private function elementsToDotLanguage(): string |
64 | 64 | { |
65 | - $dotFormat = array_map(function (HasDotRepresentation $element) { |
|
65 | + $dotFormat = array_map(function(HasDotRepresentation $element) { |
|
66 | 66 | return $element->toDotLanguage(); |
67 | 67 | }, $this->dotElements); |
68 | 68 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function attributesAssociationsFrom(ClassDefinition $class): array |
43 | 43 | { |
44 | - return array_map(function (Variable $attribute) use ($class) { |
|
44 | + return array_map(function(Variable $attribute) use ($class) { |
|
45 | 45 | return $this->addAssociation($class, $attribute); |
46 | 46 | }, array_filter($class->attributes, [$this, 'needAssociation'])); |
47 | 47 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | if (!$class->hasConstructor()) { |
60 | 60 | return []; |
61 | 61 | } |
62 | - return array_map(function (Variable $attribute) use ($class) { |
|
62 | + return array_map(function(Variable $attribute) use ($class) { |
|
63 | 63 | return $this->addAssociation($class, $attribute); |
64 | 64 | }, array_filter($class->constructorParameters(), [$this, 'needAssociation'])); |
65 | 65 | } |
@@ -76,7 +76,7 @@ |
||
76 | 76 | */ |
77 | 77 | protected function buildInterfaces(RawDefinitions $definitions, array $implements): array |
78 | 78 | { |
79 | - return array_map(function (string $interface) use ($definitions) { |
|
79 | + return array_map(function(string $interface) use ($definitions) { |
|
80 | 80 | return $this->resolveRelatedInterface($definitions, $interface); |
81 | 81 | }, $implements); |
82 | 82 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | /** @param \PhpParser\Node\Stmt\Class_|\PhpParser\Node\Stmt\Interface_ $definition */ |
28 | 28 | public function build($definition): array |
29 | 29 | { |
30 | - return array_map(function (ClassMethod $method) { |
|
30 | + return array_map(function(ClassMethod $method) { |
|
31 | 31 | return $this->buildMethod($method); |
32 | 32 | }, $definition->getMethods()); |
33 | 33 | } |
@@ -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, |
@@ -22,13 +22,13 @@ |
||
22 | 22 | { |
23 | 23 | public function build(array $classAttributes): array |
24 | 24 | { |
25 | - return array_map(function (Property $attribute) { |
|
25 | + return array_map(function(Property $attribute) { |
|
26 | 26 | return [ |
27 | 27 | "\${$attribute->props[0]->name}", |
28 | 28 | $this->resolveVisibility($attribute), |
29 | 29 | $attribute->getDocComment() |
30 | 30 | ]; |
31 | - }, array_filter($classAttributes, function ($attribute) { |
|
31 | + }, array_filter($classAttributes, function($attribute) { |
|
32 | 32 | return $attribute instanceof Property; |
33 | 33 | })); |
34 | 34 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | { |
28 | 28 | try { |
29 | 29 | return $this->twig->render($template, $values); |
30 | - } catch (LoaderError | RuntimeError | SyntaxError $e) { |
|
30 | + } catch (LoaderError | RuntimeError | SyntaxError $e) { |
|
31 | 31 | throw new TemplateFailure($e); |
32 | 32 | } |
33 | 33 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | |
41 | 41 | public function countMethodsByVisibility(Visibility $modifier): int |
42 | 42 | { |
43 | - return \count(array_filter($this->functions, function (Method $method) use ($modifier) { |
|
43 | + return \count(array_filter($this->functions, function(Method $method) use ($modifier) { |
|
44 | 44 | return $method->modifier->equals($modifier); |
45 | 45 | })); |
46 | 46 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | public function hasConstructor(): bool |
36 | 36 | { |
37 | - return \count(array_filter($this->functions, function (Method $function) { |
|
37 | + return \count(array_filter($this->functions, function(Method $function) { |
|
38 | 38 | return $function->isConstructor(); |
39 | 39 | })) === 1; |
40 | 40 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | return []; |
47 | 47 | } |
48 | 48 | |
49 | - $constructors = array_filter($this->functions, function (Method $method) { |
|
49 | + $constructors = array_filter($this->functions, function(Method $method) { |
|
50 | 50 | return $method->isConstructor(); |
51 | 51 | }); |
52 | 52 | |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | |
61 | 61 | public function countAttributesByVisibility(Visibility $modifier): int |
62 | 62 | { |
63 | - return \count(array_filter($this->attributes, function (Attribute $attribute) use ($modifier) { |
|
63 | + return \count(array_filter($this->attributes, function(Attribute $attribute) use ($modifier) { |
|
64 | 64 | return $attribute->modifier->equals($modifier); |
65 | 65 | })); |
66 | 66 | } |
67 | 67 | |
68 | 68 | public function countTypedAttributesByVisibility(Visibility $modifier): int |
69 | 69 | { |
70 | - return \count(array_filter($this->attributes, function (Attribute $attribute) use ($modifier) { |
|
70 | + return \count(array_filter($this->attributes, function(Attribute $attribute) use ($modifier) { |
|
71 | 71 | return $attribute->isTyped() && $attribute->modifier->equals($modifier); |
72 | 72 | })); |
73 | 73 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** @return Method[] */ |
22 | 22 | public function methods(RawDefinition $definition): array |
23 | 23 | { |
24 | - return array_map(function (array $method) { |
|
24 | + return array_map(function(array $method) { |
|
25 | 25 | [$name, $modifier, $parameters] = $method; |
26 | 26 | return Method::$modifier($name, $this->buildParameters($parameters)); |
27 | 27 | }, $definition->methods()); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | /** @return Attribute[] */ |
31 | 31 | public function attributes(RawDefinition $class): array |
32 | 32 | { |
33 | - return array_map(function (array $attribute) { |
|
33 | + return array_map(function(array $attribute) { |
|
34 | 34 | [$name, $modifier, $comment] = $attribute; |
35 | 35 | return Attribute::$modifier($name, $this->extractTypeFrom($comment)); |
36 | 36 | }, $class->attributes()); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | /** @return Variable[] */ |
40 | 40 | private function buildParameters(array $parameters): array |
41 | 41 | { |
42 | - return array_map(function (array $parameter) { |
|
42 | + return array_map(function(array $parameter) { |
|
43 | 43 | [$name, $type] = $parameter; |
44 | 44 | return Variable::declaredWith($name, TypeDeclaration::from($type)); |
45 | 45 | }, $parameters); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | return TypeDeclaration::absent(); |
52 | 52 | } |
53 | 53 | |
54 | - $type = null; // There might be no type information in the comment |
|
54 | + $type = null; // There might be no type information in the comment |
|
55 | 55 | $matches = []; |
56 | 56 | $arrayExpression = '/^[\s*]*@var\s+array\(\s*(\w+\s*=>\s*)?(\w+)\s*\).*$/m'; |
57 | 57 | if (preg_match($arrayExpression, $comment, $matches)) { |