@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | protected function buildTraits(array $nodes): array |
21 | 21 | { |
22 | - $useStatements = array_filter($nodes, static function (Node $node): bool { |
|
22 | + $useStatements = array_filter($nodes, static function(Node $node): bool { |
|
23 | 23 | return $node instanceof TraitUse; |
24 | 24 | }); |
25 | 25 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | */ |
19 | 19 | protected function buildInterfaces(array $implements): array |
20 | 20 | { |
21 | - return array_map(static function (Name $name): DefinitionName { |
|
21 | + return array_map(static function(Name $name): DefinitionName { |
|
22 | 22 | return DefinitionName::from($name->getLast()); |
23 | 23 | }, $implements); |
24 | 24 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function build(array $methods): array |
38 | 38 | { |
39 | - return array_map(function (ClassMethod $method): Method { |
|
39 | + return array_map(function(ClassMethod $method): Method { |
|
40 | 40 | return $this->buildMethod($method); |
41 | 41 | }, $this->runFilters($methods)); |
42 | 42 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | private function buildParameters(array $parameters, ?string $docBlock): array |
66 | 66 | { |
67 | - return array_map(static function (Param $parameter) use ($docBlock): Variable { |
|
67 | + return array_map(static function(Param $parameter) use ($docBlock) : Variable { |
|
68 | 68 | /** @var \PhpParser\Node\Expr\Variable $parsedParameter Since the parser throws error by default */ |
69 | 69 | $parsedParameter = $parameter->var; |
70 | 70 | /** @var string $parameterName Since it's a parameter not a variable */ |
@@ -31,11 +31,11 @@ |
||
31 | 31 | */ |
32 | 32 | public function build(array $definitionAttributes): array |
33 | 33 | { |
34 | - $attributes = array_filter($definitionAttributes, static function ($attribute): bool { |
|
34 | + $attributes = array_filter($definitionAttributes, static function($attribute): bool { |
|
35 | 35 | return $attribute instanceof Property; |
36 | 36 | }); |
37 | 37 | |
38 | - return array_map(function (Property $attribute): Attribute { |
|
38 | + return array_map(function(Property $attribute): Attribute { |
|
39 | 39 | $name = "\${$attribute->props[0]->name}"; |
40 | 40 | $visibility = $this->resolveVisibility($attribute); |
41 | 41 | $comment = $attribute->getDocComment(); |
@@ -32,10 +32,10 @@ |
||
32 | 32 | */ |
33 | 33 | public function build(array $classAttributes): array |
34 | 34 | { |
35 | - $constants = array_filter($classAttributes, static function ($attribute): bool { |
|
35 | + $constants = array_filter($classAttributes, static function($attribute): bool { |
|
36 | 36 | return $attribute instanceof ClassConst; |
37 | 37 | }); |
38 | - return array_map(function (ClassConst $constant): Constant { |
|
38 | + return array_map(function(ClassConst $constant): Constant { |
|
39 | 39 | return new Constant( |
40 | 40 | $constant->consts[0]->name, |
41 | 41 | TypeDeclaration::from($this->determineType($constant->consts[0])) |
@@ -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): void { |
|
35 | + array_map(function(Attribute $attribute) use ($codebase): void { |
|
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): void { |
|
44 | + array_map(function(Variable $parameter) use ($codebase): void { |
|
45 | 45 | if ($parameter->isAReference() && !$codebase->has($parameter->referenceName())) { |
46 | 46 | $codebase->add($this->externalClass($parameter->referenceName())); |
47 | 47 | } |
@@ -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): void { |
|
67 | + array_map(function(Name $interface) use ($codebase): void { |
|
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): void { |
|
77 | + array_map(function(Name $trait) use ($codebase): void { |
|
78 | 78 | if (!$codebase->has($trait)) { |
79 | 79 | $codebase->add($this->externalTrait($trait)); |
80 | 80 | } |
@@ -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', static function (string $html): ?string { |
|
25 | + $this->twig->addFilter(new Filter('whitespace', static function(string $html): ?string { |
|
26 | 26 | return preg_replace('/\s\s+/', '', $html); |
27 | 27 | })); |
28 | 28 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | { |
33 | 33 | try { |
34 | 34 | return $this->twig->render($template, $values); |
35 | - } catch (LoaderError | RuntimeError | SyntaxError $e) { |
|
35 | + } catch (LoaderError | RuntimeError | SyntaxError $e) { |
|
36 | 36 | throw new TemplateFailure($e); |
37 | 37 | } |
38 | 38 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | */ |
38 | 38 | public function countMethodsByVisibility(Visibility $modifier): int |
39 | 39 | { |
40 | - return \count(array_filter($this->methods, static function (Method $method) use ($modifier): bool { |
|
40 | + return \count(array_filter($this->methods, static function(Method $method) use ($modifier): bool { |
|
41 | 41 | return $method->hasVisibility($modifier); |
42 | 42 | })); |
43 | 43 | } |