@@ -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 |
@@ -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 @@ |
||
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 | } |
@@ -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)) { |
@@ -55,7 +55,7 @@ |
||
55 | 55 | /** @return string[] */ |
56 | 56 | private function buildInterfaces(array $implements): array |
57 | 57 | { |
58 | - return array_map(function (Name $name) { |
|
58 | + return array_map(function(Name $name) { |
|
59 | 59 | return $name->getLast(); |
60 | 60 | }, $implements); |
61 | 61 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | |
41 | 41 | public function countMethodsByVisibility(Visibility $modifier): int |
42 | 42 | { |
43 | - return \count(array_filter($this->methods, function (Method $method) use ($modifier) { |
|
43 | + return \count(array_filter($this->methods, function(Method $method) use ($modifier) { |
|
44 | 44 | return $method->hasVisibility($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->methods, function (Method $function) { |
|
37 | + return \count(array_filter($this->methods, 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->methods, function (Method $method) { |
|
49 | + $constructors = array_filter($this->methods, 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->hasVisibility($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->hasVisibility($modifier); |
72 | 72 | })); |
73 | 73 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function fromAttributes(ClassDefinition $class, Structure $structure): array |
35 | 35 | { |
36 | - return array_map(function (Variable $attribute) use ($class, $structure) { |
|
36 | + return array_map(function(Variable $attribute) use ($class, $structure) { |
|
37 | 37 | return $this->addAssociation($class, $attribute, $structure); |
38 | 38 | }, array_filter($class->attributes(), [$this, 'needAssociation'])); |
39 | 39 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | if (!$class->hasConstructor()) { |
52 | 52 | return []; |
53 | 53 | } |
54 | - return array_map(function (Variable $attribute) use ($class, $structure) { |
|
54 | + return array_map(function(Variable $attribute) use ($class, $structure) { |
|
55 | 55 | return $this->addAssociation($class, $attribute, $structure); |
56 | 56 | }, array_filter($class->constructorParameters(), [$this, 'needAssociation'])); |
57 | 57 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | /** @param \PhpParser\Node\Stmt\Class_|\PhpParser\Node\Stmt\Interface_ $definition */ |
37 | 37 | public function build(array $classMethods): array |
38 | 38 | { |
39 | - return array_map(function (ClassMethod $method) { |
|
39 | + return array_map(function(ClassMethod $method) { |
|
40 | 40 | return $this->buildMethod($method); |
41 | 41 | }, $this->runFilters($classMethods)); |
42 | 42 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | private function buildParameters(array $parameters): array |
55 | 55 | { |
56 | - return array_map(function (Param $parameter) { |
|
56 | + return array_map(function(Param $parameter) { |
|
57 | 57 | return [ |
58 | 58 | "\${$parameter->name}", |
59 | 59 | $parameter->type, |