@@ -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 |
@@ -20,18 +20,18 @@ discard block |
||
20 | 20 | |
21 | 21 | final class UseStatementsBuilder |
22 | 22 | { |
23 | - public function build(Class_|Interface_|Trait_ $definition): UseStatements |
|
23 | + public function build(Class_ | Interface_ | Trait_ $definition): UseStatements |
|
24 | 24 | { |
25 | 25 | $uses = []; |
26 | 26 | |
27 | 27 | $previous = $definition->getAttribute('previous'); |
28 | 28 | while ($previous instanceof Use_ || $previous instanceof GroupUse) { |
29 | 29 | if ($previous instanceof Use_) { |
30 | - $uses[] = array_map(fn (UseUse $use): UseStatement => $this->fromUseStatement($use), $previous->uses); |
|
30 | + $uses[] = array_map(fn(UseUse $use): UseStatement => $this->fromUseStatement($use), $previous->uses); |
|
31 | 31 | } else { |
32 | - $prefix = (string) $previous->prefix; |
|
32 | + $prefix = (string)$previous->prefix; |
|
33 | 33 | $uses[] = array_map( |
34 | - fn (UseUse $use): UseStatement => $this->fromGroupedUse($use, $prefix), |
|
34 | + fn(UseUse $use): UseStatement => $this->fromGroupedUse($use, $prefix), |
|
35 | 35 | $previous->uses |
36 | 36 | ); |
37 | 37 | } |
@@ -45,17 +45,17 @@ discard block |
||
45 | 45 | { |
46 | 46 | $alias = null; |
47 | 47 | if ($use->alias !== null) { |
48 | - $alias = new Name((string) $use->alias); |
|
48 | + $alias = new Name((string)$use->alias); |
|
49 | 49 | } |
50 | - return new UseStatement(new Name((string) $use->name), $alias); |
|
50 | + return new UseStatement(new Name((string)$use->name), $alias); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | private function fromGroupedUse(UseUse $use, string $prefix): UseStatement |
54 | 54 | { |
55 | 55 | $alias = null; |
56 | 56 | if ($use->alias !== null) { |
57 | - $alias = new Name((string) $use->alias); |
|
57 | + $alias = new Name((string)$use->alias); |
|
58 | 58 | } |
59 | - return new UseStatement(new Name((string) ParsedName::concat($prefix, (string) $use->name)), $alias); |
|
59 | + return new UseStatement(new Name((string)ParsedName::concat($prefix, (string)$use->name)), $alias); |
|
60 | 60 | } |
61 | 61 | } |
@@ -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) |
@@ -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(static function (Name $interface) use ($codebase): void { |
|
51 | - if (! $codebase->has($interface)) { |
|
50 | + array_map(static 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(static function (Name $trait) use ($codebase): void { |
|
61 | - if (! $codebase->has($trait)) { |
|
60 | + array_map(static 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,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 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | |
23 | 23 | public function add(Definition $definition): void |
24 | 24 | { |
25 | - $this->definitions[$definition->name()?->fullName()] = $definition; |
|
25 | + $this->definitions[$definition->name() ? ->fullName()] = $definition; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function has(Name $name): bool |