@@ -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 | } |
@@ -34,11 +34,11 @@ |
||
34 | 34 | /** @param \PhpParser\Node[] $definitionAttributes */ |
35 | 35 | public function build(array $definitionAttributes): array |
36 | 36 | { |
37 | - $attributes = array_filter($definitionAttributes, function ($attribute) { |
|
37 | + $attributes = array_filter($definitionAttributes, function($attribute) { |
|
38 | 38 | return $attribute instanceof Property; |
39 | 39 | }); |
40 | 40 | |
41 | - return array_map(function (Property $attribute) { |
|
41 | + return array_map(function(Property $attribute) { |
|
42 | 42 | return [ |
43 | 43 | "\${$attribute->props[0]->name}", |
44 | 44 | $this->resolveVisibility($attribute), |
@@ -23,10 +23,10 @@ |
||
23 | 23 | /** @param \PhpParser\Node[] $classAttributes */ |
24 | 24 | public function build(array $classAttributes): array |
25 | 25 | { |
26 | - $constants = array_filter($classAttributes, function ($attribute) { |
|
26 | + $constants = array_filter($classAttributes, function($attribute) { |
|
27 | 27 | return $attribute instanceof ClassConst; |
28 | 28 | }); |
29 | - return array_map(function (ClassConst $constant) { |
|
29 | + return array_map(function(ClassConst $constant) { |
|
30 | 30 | return [ |
31 | 31 | "{$constant->consts[0]->name}", |
32 | 32 | $this->determineType($constant->consts[0]), |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | /** @return Method[] */ |
28 | 28 | public function methods(RawDefinition $definition): array |
29 | 29 | { |
30 | - return array_map(function (array $method) { |
|
30 | + return array_map(function(array $method) { |
|
31 | 31 | return $this->buildMethod($method); |
32 | 32 | }, $definition->methods()); |
33 | 33 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | /** @return Attribute[] */ |
36 | 36 | public function attributes(RawDefinition $class): array |
37 | 37 | { |
38 | - return array_map(function (array $attribute) { |
|
38 | + return array_map(function(array $attribute) { |
|
39 | 39 | [$name, $modifier, $comment, $isStatic] = $attribute; |
40 | 40 | if ($isStatic) { |
41 | 41 | return StaticAttribute::$modifier($name, $this->extractTypeFrom($comment)); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | /** @return Constant[] */ |
48 | 48 | public function constants(RawDefinition $definition): array |
49 | 49 | { |
50 | - return array_map(function (array $constant) { |
|
50 | + return array_map(function(array $constant) { |
|
51 | 51 | [$name, $type] = $constant; |
52 | 52 | return new Constant($name, TypeDeclaration::from($type)); |
53 | 53 | }, $definition->constants()); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | /** @return Variable[] */ |
70 | 70 | private function buildParameters(array $parameters): array |
71 | 71 | { |
72 | - return array_map(function (array $parameter) { |
|
72 | + return array_map(function(array $parameter) { |
|
73 | 73 | [$name, $type, $comment] = $parameter; |
74 | 74 | if ($type !== null) { |
75 | 75 | $typeDeclaration = TypeDeclaration::from($type); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | /** @param ClassMethod[] $classMethods */ |
38 | 38 | public function build(array $classMethods): array |
39 | 39 | { |
40 | - return array_map(function (ClassMethod $method) { |
|
40 | + return array_map(function(ClassMethod $method) { |
|
41 | 41 | return $this->buildMethod($method); |
42 | 42 | }, $this->runFilters($classMethods)); |
43 | 43 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | private function buildParameters(array $parameters, ?string $docBlock): array |
58 | 58 | { |
59 | - return array_map(function (Param $parameter) use ($docBlock) { |
|
59 | + return array_map(function(Param $parameter) use ($docBlock) { |
|
60 | 60 | return [ |
61 | 61 | "\${$parameter->name}", |
62 | 62 | $parameter->type, |
@@ -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 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | return []; |
50 | 50 | } |
51 | 51 | |
52 | - $constructors = array_filter($this->methods, function (Method $method) { |
|
52 | + $constructors = array_filter($this->methods, function(Method $method) { |
|
53 | 53 | return $method->isConstructor(); |
54 | 54 | }); |
55 | 55 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function countAttributesByVisibility(Visibility $modifier): int |
65 | 65 | { |
66 | - return \count(array_filter($this->attributes, function (Attribute $attribute) use ($modifier) { |
|
66 | + return \count(array_filter($this->attributes, function(Attribute $attribute) use ($modifier) { |
|
67 | 67 | return $attribute->hasVisibility($modifier); |
68 | 68 | })); |
69 | 69 | } |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function countTypedAttributesByVisibility(Visibility $modifier): int |
77 | 77 | { |
78 | - return \count(array_filter($this->attributes, function (Attribute $attribute) use ($modifier) { |
|
78 | + return \count(array_filter($this->attributes, function(Attribute $attribute) use ($modifier) { |
|
79 | 79 | return $attribute->hasTypeDeclaration() && $attribute->hasVisibility($modifier); |
80 | 80 | })); |
81 | 81 | } |
82 | 82 | |
83 | 83 | public function isAbstract(): bool |
84 | 84 | { |
85 | - return \count(array_filter($this->methods(), function (Method $method) { |
|
85 | + return \count(array_filter($this->methods(), function(Method $method) { |
|
86 | 86 | return $method->isAbstract(); |
87 | 87 | })) > 0; |
88 | 88 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | private function hasConstructor(): bool |
111 | 111 | { |
112 | - return \count(array_filter($this->methods, function (Method $function) { |
|
112 | + return \count(array_filter($this->methods, function(Method $function) { |
|
113 | 113 | return $function->isConstructor(); |
114 | 114 | })) === 1; |
115 | 115 | } |
@@ -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 | } |