@@ -32,7 +32,7 @@ |
||
| 32 | 32 | { |
| 33 | 33 | $useStatements = $this->useStatementsBuilder->build($trait); |
| 34 | 34 | return new TraitDefinition( |
| 35 | - new Name((string) $trait->namespacedName), |
|
| 35 | + new Name((string)$trait->namespacedName), |
|
| 36 | 36 | $this->membersBuilder->methods($trait->getMethods(), $useStatements), |
| 37 | 37 | $this->membersBuilder->attributes($trait->stmts, $trait->getMethod('__construct'), $useStatements), |
| 38 | 38 | $this->buildTraits($trait->stmts) |
@@ -36,10 +36,10 @@ |
||
| 36 | 36 | $useStatements = $this->useStatementsBuilder->build($class); |
| 37 | 37 | |
| 38 | 38 | return new ClassDefinition( |
| 39 | - new ClassDefinitionName((string) $class->namespacedName), |
|
| 39 | + new ClassDefinitionName((string)$class->namespacedName), |
|
| 40 | 40 | $this->membersBuilder->methods($class->getMethods(), $useStatements), |
| 41 | 41 | $this->membersBuilder->constants($class->stmts), |
| 42 | - $class->extends !== null ? new ClassDefinitionName((string) $class->extends) : null, |
|
| 42 | + $class->extends !== null ? new ClassDefinitionName((string)$class->extends) : null, |
|
| 43 | 43 | $this->membersBuilder->attributes($class->stmts, $class->getMethod('__construct'), $useStatements), |
| 44 | 44 | $this->buildInterfaces($class->implements), |
| 45 | 45 | $this->buildTraits($class->stmts) |
@@ -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 |