@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function fromAttributes(ClassDefinition $class, Codebase $codebase): array |
35 | 35 | { |
36 | - return array_map(function (Variable $attribute) use ($class, $codebase) { |
|
36 | + return array_map(function(Variable $attribute) use ($class, $codebase) { |
|
37 | 37 | return $this->addAssociation($class, $attribute, $codebase); |
38 | 38 | }, array_filter($class->attributes(), [$this, 'needAssociation'])); |
39 | 39 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function fromConstructor(ClassDefinition $class, Codebase $codebase): array |
50 | 50 | { |
51 | - return array_map(function (Variable $attribute) use ($class, $codebase) { |
|
51 | + return array_map(function(Variable $attribute) use ($class, $codebase) { |
|
52 | 52 | return $this->addAssociation($class, $attribute, $codebase); |
53 | 53 | }, array_filter($class->constructorParameters(), [$this, 'needAssociation'])); |
54 | 54 | } |
@@ -72,6 +72,6 @@ discard block |
||
72 | 72 | |
73 | 73 | private function markAssociationResolvedFor(ClassDefinition $class, Variable $attribute): void |
74 | 74 | { |
75 | - $this->associations[strtolower($class->name() . '.' .$attribute->type())] = true; |
|
75 | + $this->associations[strtolower($class->name() . '.' . $attribute->type())] = true; |
|
76 | 76 | } |
77 | 77 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | public function __construct(Twig $twig = null) |
23 | 23 | { |
24 | 24 | $this->twig = $twig ?? new Twig(new FileSystemLoader(__DIR__ . '/../resources/templates')); |
25 | - $this->twig->addFilter(new Filter('whitespace', function (string $html) { |
|
25 | + $this->twig->addFilter(new Filter('whitespace', function(string $html) { |
|
26 | 26 | return preg_replace('/\s\s+/', '', $html); |
27 | 27 | })); |
28 | 28 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | { |
32 | 32 | try { |
33 | 33 | return $this->twig->render($template, $values); |
34 | - } catch (LoaderError | RuntimeError | SyntaxError $e) { |
|
34 | + } catch (LoaderError | RuntimeError | SyntaxError $e) { |
|
35 | 35 | throw new TemplateFailure($e); |
36 | 36 | } |
37 | 37 | } |
@@ -92,7 +92,7 @@ |
||
92 | 92 | */ |
93 | 93 | public function countMethodsByVisibility(Visibility $modifier): int |
94 | 94 | { |
95 | - return \count(array_filter($this->methods, function (Method $method) use ($modifier) { |
|
95 | + return \count(array_filter($this->methods, function(Method $method) use ($modifier) { |
|
96 | 96 | return $method->hasVisibility($modifier); |
97 | 97 | })); |
98 | 98 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | private function resolveExternalAttributes(ClassDefinition $definition, Codebase $codebase): void |
34 | 34 | { |
35 | - array_map(function (Attribute $attribute) use ($codebase) { |
|
35 | + array_map(function(Attribute $attribute) use ($codebase) { |
|
36 | 36 | if ($attribute->isAReference() && !$codebase->has($attribute->typeName())) { |
37 | 37 | $codebase->add($this->externalClass($attribute->typeName())); |
38 | 38 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | private function resolveExternalConstructorParameters(ClassDefinition $definition, Codebase $codebase): void |
43 | 43 | { |
44 | - array_map(function (Variable $parameter) use ($codebase) { |
|
44 | + array_map(function(Variable $parameter) use ($codebase) { |
|
45 | 45 | if ($parameter->isAReference() && !$codebase->has($parameter->typeName())) { |
46 | 46 | $codebase->add($this->externalClass($parameter->typeName())); |
47 | 47 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function build(array $classMethods): array |
34 | 34 | { |
35 | - return array_map(function (ClassMethod $method) { |
|
35 | + return array_map(function(ClassMethod $method) { |
|
36 | 36 | return $this->buildMethod($method); |
37 | 37 | }, $this->runFilters($classMethods)); |
38 | 38 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | private function buildParameters(array $parameters, ?string $docBlock): array |
57 | 57 | { |
58 | - return array_map(function (Param $parameter) use ($docBlock) { |
|
58 | + return array_map(function(Param $parameter) use ($docBlock) { |
|
59 | 59 | $name = "\${$parameter->name}"; |
60 | 60 | $type = $parameter->type; |
61 | 61 | if ($type !== null) { |
@@ -31,10 +31,10 @@ |
||
31 | 31 | */ |
32 | 32 | public function build(array $classAttributes): array |
33 | 33 | { |
34 | - $constants = array_filter($classAttributes, function ($attribute) { |
|
34 | + $constants = array_filter($classAttributes, function($attribute) { |
|
35 | 35 | return $attribute instanceof ClassConst; |
36 | 36 | }); |
37 | - return array_map(function (ClassConst $constant) { |
|
37 | + return array_map(function(ClassConst $constant) { |
|
38 | 38 | return new Constant( |
39 | 39 | $constant->consts[0]->name, |
40 | 40 | TypeDeclaration::from($this->determineType($constant->consts[0])) |
@@ -31,11 +31,11 @@ |
||
31 | 31 | */ |
32 | 32 | public function build(array $definitionAttributes): array |
33 | 33 | { |
34 | - $attributes = array_filter($definitionAttributes, function ($attribute) { |
|
34 | + $attributes = array_filter($definitionAttributes, function($attribute) { |
|
35 | 35 | return $attribute instanceof Property; |
36 | 36 | }); |
37 | 37 | |
38 | - return array_map(function (Property $attribute) { |
|
38 | + return array_map(function(Property $attribute) { |
|
39 | 39 | $name = "\${$attribute->props[0]->name}"; |
40 | 40 | $modifier = $this->resolveVisibility($attribute); |
41 | 41 | $comment = $attribute->getDocComment(); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | return []; |
67 | 67 | } |
68 | 68 | |
69 | - $constructors = array_filter($this->methods, function (Method $method) { |
|
69 | + $constructors = array_filter($this->methods, function(Method $method) { |
|
70 | 70 | return $method->isConstructor(); |
71 | 71 | }); |
72 | 72 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function countAttributesByVisibility(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->hasVisibility($modifier); |
85 | 85 | })); |
86 | 86 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function countTypedAttributesByVisibility(Visibility $modifier): int |
94 | 94 | { |
95 | - return \count(array_filter($this->attributes, function (Attribute $attribute) use ($modifier) { |
|
95 | + return \count(array_filter($this->attributes, function(Attribute $attribute) use ($modifier) { |
|
96 | 96 | return $attribute->hasTypeDeclaration() && $attribute->hasVisibility($modifier); |
97 | 97 | })); |
98 | 98 | } |
@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function isAbstract(): bool |
150 | 150 | { |
151 | - return \count(array_filter($this->methods(), function (Method $method) { |
|
151 | + return \count(array_filter($this->methods(), function(Method $method) { |
|
152 | 152 | return $method->isAbstract(); |
153 | 153 | })) > 0; |
154 | 154 | } |
155 | 155 | |
156 | 156 | private function hasConstructor(): bool |
157 | 157 | { |
158 | - return \count(array_filter($this->methods, function (Method $function) { |
|
158 | + return \count(array_filter($this->methods, function(Method $function) { |
|
159 | 159 | return $function->isConstructor(); |
160 | 160 | })) === 1; |
161 | 161 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** @param \PhUml\Code\Name[] $interfaces */ |
56 | 56 | private function resolveExternalInterfaces(array $interfaces, Codebase $codebase): void |
57 | 57 | { |
58 | - array_map(function (Name $interface) use ($codebase) { |
|
58 | + array_map(function(Name $interface) use ($codebase) { |
|
59 | 59 | if (!$codebase->has($interface)) { |
60 | 60 | $codebase->add($this->externalInterface($interface)); |
61 | 61 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | /** @param \PhUml\Code\Name[] $interfaces */ |
66 | 66 | private function resolveExternalTraits(array $traits, Codebase $codebase): void |
67 | 67 | { |
68 | - array_map(function (Name $trait) use ($codebase) { |
|
68 | + array_map(function(Name $trait) use ($codebase) { |
|
69 | 69 | if (!$codebase->has($trait)) { |
70 | 70 | $codebase->add($this->externalTrait($trait)); |
71 | 71 | } |