@@ -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 | } |
@@ -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 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | /** @param Node[] $nodes */ |
| 18 | 18 | protected function buildTraits(array $nodes): array |
| 19 | 19 | { |
| 20 | - $useStatements = array_filter($nodes, function (Node $node) { |
|
| 20 | + $useStatements = array_filter($nodes, function(Node $node) { |
|
| 21 | 21 | return $node instanceof TraitUse; |
| 22 | 22 | }); |
| 23 | 23 | |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | protected function buildInterfaces(array $implements): array |
| 20 | 20 | { |
| 21 | - return array_map(function (Name $name) { |
|
| 21 | + return array_map(function(Name $name) { |
|
| 22 | 22 | return DefinitionName::from($name->getLast()); |
| 23 | 23 | }, $implements); |
| 24 | 24 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | /** @param \PhUml\Code\Name[] $interfaces */ |
| 65 | 65 | private function resolveExternalInterfaces(array $interfaces, Codebase $codebase): void |
| 66 | 66 | { |
| 67 | - array_map(function (Name $interface) use ($codebase) { |
|
| 67 | + array_map(function(Name $interface) use ($codebase) { |
|
| 68 | 68 | if (!$codebase->has($interface)) { |
| 69 | 69 | $codebase->add($this->externalInterface($interface)); |
| 70 | 70 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | /** @param \PhUml\Code\Name[] $traits */ |
| 75 | 75 | private function resolveExternalTraits(array $traits, Codebase $codebase): void |
| 76 | 76 | { |
| 77 | - array_map(function (Name $trait) use ($codebase) { |
|
| 77 | + array_map(function(Name $trait) use ($codebase) { |
|
| 78 | 78 | if (!$codebase->has($trait)) { |
| 79 | 79 | $codebase->add($this->externalTrait($trait)); |
| 80 | 80 | } |
@@ -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->referenceName())) { |
| 37 | 37 | $codebase->add($this->externalClass($attribute->referenceName())); |
| 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->referenceName())) { |
| 46 | 46 | $codebase->add($this->externalClass($parameter->referenceName())); |
| 47 | 47 | } |