@@ -32,7 +32,7 @@ |
||
| 32 | 32 | public function build(Interface_ $interface): InterfaceDefinition |
| 33 | 33 | { |
| 34 | 34 | return new InterfaceDefinition( |
| 35 | - new InterfaceDefinitionName((string) $interface->name), |
|
| 35 | + new InterfaceDefinitionName((string)$interface->name), |
|
| 36 | 36 | $this->membersBuilder->methods($interface->getMethods()), |
| 37 | 37 | $this->membersBuilder->constants($interface->stmts), |
| 38 | 38 | $this->buildInterfaces($interface->extends) |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | private function resolveExternalAttributes(ClassDefinition $definition, Codebase $codebase): void |
| 41 | 41 | { |
| 42 | - array_map(function (Attribute $attribute) use ($codebase): void { |
|
| 43 | - if ($attribute->isAReference() && ! $codebase->has($attribute->referenceName())) { |
|
| 42 | + array_map(function(Attribute $attribute) use ($codebase): void { |
|
| 43 | + if ($attribute->isAReference() && !$codebase->has($attribute->referenceName())) { |
|
| 44 | 44 | $codebase->add(new ClassDefinition($attribute->referenceName())); |
| 45 | 45 | } |
| 46 | 46 | }, $definition->attributes()); |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | private function resolveExternalConstructorParameters(ClassDefinition $definition, Codebase $codebase): void |
| 50 | 50 | { |
| 51 | - array_map(function (Parameter $parameter) use ($codebase): void { |
|
| 52 | - if ($parameter->isAReference() && ! $codebase->has($parameter->referenceName())) { |
|
| 51 | + array_map(function(Parameter $parameter) use ($codebase): void { |
|
| 52 | + if ($parameter->isAReference() && !$codebase->has($parameter->referenceName())) { |
|
| 53 | 53 | $codebase->add(new ClassDefinition($parameter->referenceName())); |
| 54 | 54 | } |
| 55 | 55 | }, $definition->constructorParameters()); |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | /** @param Name[] $interfaces */ |
| 48 | 48 | private function resolveExternalInterfaces(array $interfaces, Codebase $codebase): void |
| 49 | 49 | { |
| 50 | - array_map(function (Name $interface) use ($codebase): void { |
|
| 51 | - if (! $codebase->has($interface)) { |
|
| 50 | + array_map(function(Name $interface) use ($codebase): void { |
|
| 51 | + if (!$codebase->has($interface)) { |
|
| 52 | 52 | $codebase->add(new InterfaceDefinition($interface)); |
| 53 | 53 | } |
| 54 | 54 | }, $interfaces); |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | /** @param Name[] $traits */ |
| 58 | 58 | private function resolveExternalTraits(array $traits, Codebase $codebase): void |
| 59 | 59 | { |
| 60 | - array_map(function (Name $trait) use ($codebase): void { |
|
| 61 | - if (! $codebase->has($trait)) { |
|
| 60 | + array_map(function(Name $trait) use ($codebase): void { |
|
| 61 | + if (!$codebase->has($trait)) { |
|
| 62 | 62 | $codebase->add(new TraitDefinition($trait)); |
| 63 | 63 | } |
| 64 | 64 | }, $traits); |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | private function resolveExternalParentClass(ClassDefinition $definition, Codebase $codebase): void |
| 68 | 68 | { |
| 69 | - if (! $definition->hasParent()) { |
|
| 69 | + if (!$definition->hasParent()) { |
|
| 70 | 70 | return; |
| 71 | 71 | } |
| 72 | 72 | $parent = $definition->parent(); |
| 73 | - if (! $codebase->has($parent)) { |
|
| 73 | + if (!$codebase->has($parent)) { |
|
| 74 | 74 | $codebase->add(new ClassDefinition($parent)); |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | $this->twig = $twig ?? new Twig(new FilesystemLoader(__DIR__ . '/../resources/templates')); |
| 25 | 25 | $this->twig->addFilter(new Filter( |
| 26 | 26 | 'whitespace', |
| 27 | - static fn (string $html): ?string => preg_replace('/\s\s+/', '', $html) |
|
| 27 | + static fn(string $html): ?string => preg_replace('/\s\s+/', '', $html) |
|
| 28 | 28 | )); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | { |
| 34 | 34 | try { |
| 35 | 35 | return $this->twig->render($template, $values); |
| 36 | - } catch (LoaderError | RuntimeError | SyntaxError $e) { |
|
| 36 | + } catch (LoaderError | RuntimeError | SyntaxError $e) { |
|
| 37 | 37 | throw new TemplateFailure($e); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | private function extractReturnType(?string $comment): void |
| 53 | 53 | { |
| 54 | - if (preg_match(self::RETURN_EXPRESSION, (string) $comment, $matches) === 1) { |
|
| 54 | + if (preg_match(self::RETURN_EXPRESSION, (string)$comment, $matches) === 1) { |
|
| 55 | 55 | $this->returnType = TypeDeclaration::from(trim($matches[1])); |
| 56 | 56 | return; |
| 57 | 57 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | private function extractParametersTypes(?string $comment): void |
| 63 | 63 | { |
| 64 | - if (preg_match_all(self::PARAMETER_EXPRESSION, (string) $comment, $matches) < 1) { |
|
| 64 | + if (preg_match_all(self::PARAMETER_EXPRESSION, (string)$comment, $matches) < 1) { |
|
| 65 | 65 | $this->parametersTypes = []; |
| 66 | 66 | return; |
| 67 | 67 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | { |
| 41 | 41 | return \count(array_filter( |
| 42 | 42 | $this->methods, |
| 43 | - static fn (Method $method): bool => $method->hasVisibility($modifier) |
|
| 43 | + static fn(Method $method): bool => $method->hasVisibility($modifier) |
|
| 44 | 44 | )); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function isBuiltIn(): bool |
| 59 | 59 | { |
| 60 | - $type = (string) $this->name; |
|
| 60 | + $type = (string)$this->name; |
|
| 61 | 61 | if ($this->isArray()) { |
| 62 | 62 | $type = $this->removeArraySuffix(); |
| 63 | 63 | } |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | public function isBuiltInArray(): bool |
| 68 | 68 | { |
| 69 | - return (string) $this->name === 'array'; |
|
| 69 | + return (string)$this->name === 'array'; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | public function isArray(): bool |
| 73 | 73 | { |
| 74 | - return strpos((string) $this->name, '[]') === \strlen((string) $this->name) - 2; |
|
| 74 | + return strpos((string)$this->name, '[]') === \strlen((string)$this->name) - 2; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | public function isNullable(): bool |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | public function removeArraySuffix(): string |
| 83 | 83 | { |
| 84 | - return substr((string) $this->name, 0, -2); |
|
| 84 | + return substr((string)$this->name, 0, -2); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | public function __toString() |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function constructorParameters(): array |
| 68 | 68 | { |
| 69 | - $constructors = array_filter($this->methods, static fn (Method $method): bool => $method->isConstructor()); |
|
| 69 | + $constructors = array_filter($this->methods, static fn(Method $method): bool => $method->isConstructor()); |
|
| 70 | 70 | $constructor = reset($constructors); |
| 71 | 71 | |
| 72 | 72 | return $constructor === false ? [] : $constructor->parameters(); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | return \count(array_filter( |
| 83 | 83 | $this->attributes, |
| 84 | - static fn (Attribute $attribute): bool => $attribute->hasVisibility($modifier) |
|
| 84 | + static fn(Attribute $attribute): bool => $attribute->hasVisibility($modifier) |
|
| 85 | 85 | )); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | { |
| 95 | 95 | return \count(array_filter( |
| 96 | 96 | $this->attributes, |
| 97 | - static fn (Attribute $attribute): bool => |
|
| 97 | + static fn(Attribute $attribute): bool => |
|
| 98 | 98 | $attribute->hasTypeDeclaration() && $attribute->hasVisibility($modifier) |
| 99 | 99 | )); |
| 100 | 100 | } |
@@ -152,6 +152,6 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function isAbstract(): bool |
| 154 | 154 | { |
| 155 | - return \count(array_filter($this->methods(), static fn (Method $method): bool => $method->isAbstract())) > 0; |
|
| 155 | + return \count(array_filter($this->methods(), static fn(Method $method): bool => $method->isAbstract())) > 0; |
|
| 156 | 156 | } |
| 157 | 157 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | |
| 36 | 36 | private function extractType(?string $comment): void |
| 37 | 37 | { |
| 38 | - if (preg_match(self::VAR_EXPRESSION, (string) $comment, $matches) === 1) { |
|
| 38 | + if (preg_match(self::VAR_EXPRESSION, (string)$comment, $matches) === 1) { |
|
| 39 | 39 | $this->attributeType = TypeDeclaration::from(trim($matches[1])); |
| 40 | 40 | return; |
| 41 | 41 | } |