@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | private function buildTraits(array $nodes): array |
| 21 | 21 | { |
| 22 | - $useStatements = array_filter($nodes, static fn (Node $node): bool => $node instanceof TraitUse); |
|
| 22 | + $useStatements = array_filter($nodes, static fn(Node $node): bool => $node instanceof TraitUse); |
|
| 23 | 23 | |
| 24 | 24 | $traits = []; |
| 25 | 25 | /** @var TraitUse $use */ |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | private function traitNames(TraitUse $use, array $traits): array |
| 38 | 38 | { |
| 39 | 39 | foreach ($use->traits as $name) { |
| 40 | - $traits[] = new TraitName((string) $name); |
|
| 40 | + $traits[] = new TraitName((string)$name); |
|
| 41 | 41 | } |
| 42 | 42 | return $traits; |
| 43 | 43 | } |
@@ -18,6 +18,6 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | private function buildInterfaces(array $implements): array |
| 20 | 20 | { |
| 21 | - return array_map(static fn (Name $name): DefinitionName => new DefinitionName((string) $name), $implements); |
|
| 21 | + return array_map(static fn(Name $name): DefinitionName => new DefinitionName((string)$name), $implements); |
|
| 22 | 22 | } |
| 23 | 23 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | public function build(array $parameters, ?Doc $methodDocBlock, UseStatements $useStatements): array |
| 27 | 27 | { |
| 28 | - return array_map(function (Param $parameter) use ($methodDocBlock, $useStatements): Parameter { |
|
| 28 | + return array_map(function(Param $parameter) use ($methodDocBlock, $useStatements) : Parameter { |
|
| 29 | 29 | /** @var \PhpParser\Node\Expr\Variable $parsedParameter Since the parser throws error by default */ |
| 30 | 30 | $parsedParameter = $parameter->var; |
| 31 | 31 | |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | { |
| 33 | 33 | $useStatements = $this->useStatementsBuilder->build($interface); |
| 34 | 34 | return new InterfaceDefinition( |
| 35 | - new InterfaceDefinitionName((string) $interface->namespacedName), |
|
| 35 | + new InterfaceDefinitionName((string)$interface->namespacedName), |
|
| 36 | 36 | $this->membersBuilder->methods($interface->getMethods(), $useStatements), |
| 37 | 37 | $this->membersBuilder->constants($interface->stmts), |
| 38 | 38 | $this->buildInterfaces($interface->extends) |
@@ -24,6 +24,6 @@ |
||
| 24 | 24 | return $useStatement->fullyQualifiedName($name); |
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | - return (string) $name; |
|
| 27 | + return (string)$name; |
|
| 28 | 28 | } |
| 29 | 29 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | /** @param string[] $types */ |
| 51 | 51 | public static function fromUnionType(array $types): TypeDeclaration |
| 52 | 52 | { |
| 53 | - return new TypeDeclaration(array_map(static fn (string $type) => new Name($type), $types)); |
|
| 53 | + return new TypeDeclaration(array_map(static fn(string $type) => new Name($type), $types)); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public function isPresent(): bool |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | /** @return Name[] */ |
| 62 | 62 | public function references(): array |
| 63 | 63 | { |
| 64 | - if (! $this->isPresent()) { |
|
| 64 | + if (!$this->isPresent()) { |
|
| 65 | 65 | return []; |
| 66 | 66 | } |
| 67 | 67 | if ($this->isBuiltIn()) { |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | return [$this->isArray() ? new Name($this->removeArraySuffix()) : $this->names[0]]; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - $typesFromUnion = array_map(static fn (Name $name) => TypeDeclaration::from((string) $name), $this->names); |
|
| 75 | - $references = array_filter($typesFromUnion, static fn (TypeDeclaration $type) => ! $type->isBuiltIn()); |
|
| 74 | + $typesFromUnion = array_map(static fn(Name $name) => TypeDeclaration::from((string)$name), $this->names); |
|
| 75 | + $references = array_filter($typesFromUnion, static fn(TypeDeclaration $type) => !$type->isBuiltIn()); |
|
| 76 | 76 | |
| 77 | 77 | return array_map( |
| 78 | - static fn (TypeDeclaration $reference) => $reference->isArray() |
|
| 78 | + static fn(TypeDeclaration $reference) => $reference->isArray() |
|
| 79 | 79 | ? new Name($reference->removeArraySuffix()) |
| 80 | 80 | : $reference->names[0], |
| 81 | 81 | $references |
@@ -88,10 +88,10 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function isBuiltIn(): bool |
| 90 | 90 | { |
| 91 | - if (! $this->isRegularType()) { |
|
| 91 | + if (!$this->isRegularType()) { |
|
| 92 | 92 | return false; |
| 93 | 93 | } |
| 94 | - $type = (string) $this->names[0]; |
|
| 94 | + $type = (string)$this->names[0]; |
|
| 95 | 95 | if ($this->isArray()) { |
| 96 | 96 | $type = $this->removeArraySuffix(); |
| 97 | 97 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | public function isBuiltInArray(): bool |
| 108 | 108 | { |
| 109 | 109 | if ($this->isRegularType()) { |
| 110 | - return (string) $this->names[0] === 'array'; |
|
| 110 | + return (string)$this->names[0] === 'array'; |
|
| 111 | 111 | } |
| 112 | 112 | return false; |
| 113 | 113 | } |
@@ -15,12 +15,12 @@ |
||
| 15 | 15 | |
| 16 | 16 | public function endsWith(Name $name): bool |
| 17 | 17 | { |
| 18 | - return str_ends_with(haystack: (string) $this->name, needle: $name->removeArraySuffix()); |
|
| 18 | + return str_ends_with(haystack : (string)$this->name, needle : $name->removeArraySuffix()); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function isAliasedAs(Name $name): bool |
| 22 | 22 | { |
| 23 | - return $this->alias !== null && (string) $this->alias === $name->removeArraySuffix(); |
|
| 23 | + return $this->alias !== null && (string)$this->alias === $name->removeArraySuffix(); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function fullyQualifiedName(Name $name): string |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | |
| 29 | 29 | public function isArray(): bool |
| 30 | 30 | { |
| 31 | - return str_ends_with((string) $this, '[]'); |
|
| 31 | + return str_ends_with((string)$this, '[]'); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public function removeArraySuffix(): string |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | /** @var ClassDefinition|InterfaceDefinition|TraitDefinition $definition */ |
| 27 | 27 | foreach ($codebase->definitions() as $definition) { |
| 28 | - match (true) { |
|
| 28 | + match(true) { |
|
| 29 | 29 | $definition instanceof ClassDefinition => $this->resolveForClass($definition, $codebase), |
| 30 | 30 | $definition instanceof InterfaceDefinition => $this->resolveInterfaces($definition->parents(), $codebase), |
| 31 | 31 | default => $this->resolveTraits($definition->traits(), $codebase), |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | /** @param Name[] $interfaces */ |
| 47 | 47 | private function resolveInterfaces(array $interfaces, Codebase $codebase): void |
| 48 | 48 | { |
| 49 | - array_map(static function (Name $interface) use ($codebase): void { |
|
| 50 | - if (! $codebase->has($interface)) { |
|
| 49 | + array_map(static function(Name $interface) use ($codebase): void { |
|
| 50 | + if (!$codebase->has($interface)) { |
|
| 51 | 51 | $codebase->add(new InterfaceDefinition($interface)); |
| 52 | 52 | } |
| 53 | 53 | }, $interfaces); |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | /** @param Name[] $traits */ |
| 57 | 57 | private function resolveTraits(array $traits, Codebase $codebase): void |
| 58 | 58 | { |
| 59 | - array_map(static function (Name $trait) use ($codebase): void { |
|
| 60 | - if (! $codebase->has($trait)) { |
|
| 59 | + array_map(static function(Name $trait) use ($codebase): void { |
|
| 60 | + if (!$codebase->has($trait)) { |
|
| 61 | 61 | $codebase->add(new TraitDefinition($trait)); |
| 62 | 62 | } |
| 63 | 63 | }, $traits); |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | private function resolveExternalParentClass(ClassDefinition $definition, Codebase $codebase): void |
| 67 | 67 | { |
| 68 | - if (! $definition->hasParent()) { |
|
| 68 | + if (!$definition->hasParent()) { |
|
| 69 | 69 | return; |
| 70 | 70 | } |
| 71 | 71 | $parent = $definition->parent(); |
| 72 | - if (! $codebase->has($parent)) { |
|
| 72 | + if (!$codebase->has($parent)) { |
|
| 73 | 73 | $codebase->add(new ClassDefinition($parent)); |
| 74 | 74 | } |
| 75 | 75 | } |