@@ -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 | } |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | /** @return ClassDefinitionName[] */ |
| 59 | 59 | protected function buildInterfaces(array $implements): array |
| 60 | 60 | { |
| 61 | - return array_map(function (Name $name) { |
|
| 61 | + return array_map(function(Name $name) { |
|
| 62 | 62 | return ClassDefinitionName::from($name->getLast()); |
| 63 | 63 | }, $implements); |
| 64 | 64 | } |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | /** @return InterfaceDefinitionName[] */ |
| 50 | 50 | protected function buildParents(Interface_ $interface): array |
| 51 | 51 | { |
| 52 | - return array_map(function (Name $name) { |
|
| 52 | + return array_map(function(Name $name) { |
|
| 53 | 53 | return InterfaceDefinitionName::from($name->getLast()); |
| 54 | 54 | }, $interface->extends); |
| 55 | 55 | } |
@@ -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(); |