@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | { |
59 | 59 | $edges = []; |
60 | 60 | foreach ($variables as $parameter) { |
61 | - if (! $this->needAssociation($class, $parameter)) { |
|
61 | + if (!$this->needAssociation($class, $parameter)) { |
|
62 | 62 | continue; |
63 | 63 | } |
64 | 64 | $edges[] = $this->addAssociations($class, $parameter, $codebase); |
@@ -72,14 +72,14 @@ discard block |
||
72 | 72 | $this->markAssociationResolvedFor($class, $attribute); |
73 | 73 | |
74 | 74 | return array_map( |
75 | - static fn (Name $reference): Edge => Edge::association($codebase->get($reference), $class), |
|
75 | + static fn(Name $reference): Edge => Edge::association($codebase->get($reference), $class), |
|
76 | 76 | $attribute->references() |
77 | 77 | ); |
78 | 78 | } |
79 | 79 | |
80 | 80 | private function needAssociation(ClassDefinition $class, HasType $attribute): bool |
81 | 81 | { |
82 | - return ! $this->isAssociationResolved($class, $attribute); |
|
82 | + return !$this->isAssociationResolved($class, $attribute); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | private function isAssociationResolved(ClassDefinition $class, HasType $attribute): bool |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | /** @var Param[] $params */ |
39 | 39 | $params = array_values(array_filter( |
40 | 40 | $parameterTags, |
41 | - static fn (TagWithType|InvalidTag $parameter) => |
|
41 | + static fn(TagWithType | InvalidTag $parameter) => |
|
42 | 42 | $parameter instanceof Param && "\${$parameter->getVariableName()}" === $name |
43 | 43 | )); |
44 | 44 | if (count($params) < 1) { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | private function declarationFromTagType(?Type $tagType, UseStatements $useStatements): TypeDeclaration |
100 | 100 | { |
101 | - return match (true) { |
|
101 | + return match(true) { |
|
102 | 102 | $tagType === null => TypeDeclaration::absent(), |
103 | 103 | $tagType instanceof Nullable => $this->resolveNullableType($tagType, $useStatements), |
104 | 104 | $tagType instanceof Compound => $this->resolveUnionTypes($tagType, $useStatements), |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | private function resolveUnionTypes(Compound $tagType, UseStatements $useStatements): TypeDeclaration |
110 | 110 | { |
111 | 111 | $withFullyQualifiedNames = array_map( |
112 | - fn (string $type) => $useStatements->fullyQualifiedNameFor(new Name($this->unqualify($type))), |
|
112 | + fn(string $type) => $useStatements->fullyQualifiedNameFor(new Name($this->unqualify($type))), |
|
113 | 113 | $tagType->getIterator()->getArrayCopy() |
114 | 114 | ); |
115 | 115 | return TypeDeclaration::fromUnionType($withFullyQualifiedNames); |
@@ -117,14 +117,14 @@ discard block |
||
117 | 117 | |
118 | 118 | private function resolveType(Type $tagType, UseStatements $useStatements): TypeDeclaration |
119 | 119 | { |
120 | - $type = $this->unqualify((string) $tagType); |
|
120 | + $type = $this->unqualify((string)$tagType); |
|
121 | 121 | $fullyQualifiedName = $useStatements->fullyQualifiedNameFor(new Name($type)); |
122 | 122 | return TypeDeclaration::from($fullyQualifiedName); |
123 | 123 | } |
124 | 124 | |
125 | 125 | private function resolveNullableType(Nullable $nullable, UseStatements $useStatements): TypeDeclaration |
126 | 126 | { |
127 | - $type = $this->unqualify((string) $nullable->getActualType()); |
|
127 | + $type = $this->unqualify((string)$nullable->getActualType()); |
|
128 | 128 | $fullyQualifiedName = $useStatements->fullyQualifiedNameFor(new Name($type)); |
129 | 129 | return TypeDeclaration::fromNullable($fullyQualifiedName); |
130 | 130 | } |
@@ -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 | } |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | public function build(array $parsedAttributes, UseStatements $useStatements): array |
40 | 40 | { |
41 | 41 | /** @var Property[] $attributes */ |
42 | - $attributes = array_filter($parsedAttributes, static fn ($attribute): bool => $attribute instanceof Property); |
|
42 | + $attributes = array_filter($parsedAttributes, static fn($attribute): bool => $attribute instanceof Property); |
|
43 | 43 | |
44 | - return array_map(function (Property $attribute) use ($useStatements): Attribute { |
|
44 | + return array_map(function(Property $attribute) use ($useStatements): Attribute { |
|
45 | 45 | $variable = new Variable( |
46 | 46 | "\${$attribute->props[0]->name}", |
47 | 47 | $this->typeBuilder->fromAttributeType($attribute->type, $attribute->getDocComment(), $useStatements) |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | { |
61 | 61 | $promotedProperties = array_filter( |
62 | 62 | $constructorParameters, |
63 | - static fn (Node\Param $param) => $param->flags !== 0 |
|
63 | + static fn(Node\Param $param) => $param->flags !== 0 |
|
64 | 64 | ); |
65 | 65 | |
66 | - return array_map(function (Node\Param $param) use ($useStatements): Attribute { |
|
66 | + return array_map(function(Node\Param $param) use ($useStatements): Attribute { |
|
67 | 67 | /** @var Node\Expr\Variable $var */ |
68 | 68 | $var = $param->var; |
69 | 69 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public function build(array $methods, UseStatements $useStatements): array |
38 | 38 | { |
39 | 39 | return array_map( |
40 | - fn (ClassMethod $method): Method => $this->buildMethod($method, $useStatements), |
|
40 | + fn(ClassMethod $method): Method => $this->buildMethod($method, $useStatements), |
|
41 | 41 | $this->visibilityFilters->apply($methods) |
42 | 42 | ); |
43 | 43 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $docBlock = $method->getDocComment(); |
50 | 50 | $returnType = $this->typeBuilder->fromMethodReturnType($method->returnType, $docBlock, $useStatements); |
51 | 51 | $parameters = $this->parametersBuilder->build($method->params, $docBlock, $useStatements); |
52 | - return match (true) { |
|
52 | + return match(true) { |
|
53 | 53 | $method->isAbstract() => new Method($name, $visibility, $returnType, $parameters, isAbstract: true), |
54 | 54 | $method->isStatic() => new Method($name, $visibility, $returnType, $parameters, isStatic: true), |
55 | 55 | default => new Method($name, $visibility, $returnType, $parameters), |
@@ -23,18 +23,18 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | public function fromMethodParameter( |
26 | - Identifier|Name|NullableType|UnionType|null $type, |
|
26 | + Identifier | Name | NullableType | UnionType | null $type, |
|
27 | 27 | ?Doc $docBlock, |
28 | 28 | string $name, |
29 | 29 | UseStatements $useStatements |
30 | 30 | ): TypeDeclaration { |
31 | - $methodComment = $docBlock?->getText(); |
|
31 | + $methodComment = $docBlock ? ->getText(); |
|
32 | 32 | if ($type === null) { |
33 | 33 | return $this->typeResolver->resolveForParameter($methodComment, $name, $useStatements); |
34 | 34 | } |
35 | 35 | |
36 | 36 | $typeDeclaration = $this->fromParsedType($type); |
37 | - if (! $typeDeclaration->isBuiltInArray()) { |
|
37 | + if (!$typeDeclaration->isBuiltInArray()) { |
|
38 | 38 | return $typeDeclaration; |
39 | 39 | } |
40 | 40 | |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | public function fromMethodReturnType( |
47 | - Identifier|Name|NullableType|UnionType|null $type, |
|
47 | + Identifier | Name | NullableType | UnionType | null $type, |
|
48 | 48 | ?Doc $docBlock, |
49 | 49 | UseStatements $useStatements |
50 | 50 | ): TypeDeclaration { |
51 | - $methodComment = $docBlock?->getText(); |
|
51 | + $methodComment = $docBlock ? ->getText(); |
|
52 | 52 | if ($type === null) { |
53 | 53 | return $this->typeResolver->resolveForReturn($methodComment, $useStatements); |
54 | 54 | } |
55 | 55 | |
56 | 56 | $typeDeclaration = $this->fromParsedType($type); |
57 | - if (! $typeDeclaration->isBuiltInArray()) { |
|
57 | + if (!$typeDeclaration->isBuiltInArray()) { |
|
58 | 58 | return $typeDeclaration; |
59 | 59 | } |
60 | 60 | |
@@ -64,17 +64,17 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | public function fromAttributeType( |
67 | - Identifier|Name|NullableType|UnionType|null $type, |
|
67 | + Identifier | Name | NullableType | UnionType | null $type, |
|
68 | 68 | ?Doc $docBlock, |
69 | 69 | UseStatements $useStatements |
70 | 70 | ): TypeDeclaration { |
71 | - $attributeComment = $docBlock?->getText(); |
|
71 | + $attributeComment = $docBlock ? ->getText(); |
|
72 | 72 | if ($type === null) { |
73 | 73 | return $this->typeResolver->resolveForAttribute($attributeComment, $useStatements); |
74 | 74 | } |
75 | 75 | |
76 | 76 | $typeDeclaration = $this->fromParsedType($type); |
77 | - if (! $typeDeclaration->isBuiltInArray()) { |
|
77 | + if (!$typeDeclaration->isBuiltInArray()) { |
|
78 | 78 | return $typeDeclaration; |
79 | 79 | } |
80 | 80 | |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | return $typeFromDocBlock->isPresent() ? $typeFromDocBlock : $typeDeclaration; |
84 | 84 | } |
85 | 85 | |
86 | - private function fromParsedType(Identifier|Name|NullableType|UnionType|null $type): TypeDeclaration |
|
86 | + private function fromParsedType(Identifier | Name | NullableType | UnionType | null $type): TypeDeclaration |
|
87 | 87 | { |
88 | - return match (true) { |
|
89 | - $type instanceof NullableType => TypeDeclaration::fromNullable((string) $type->type), |
|
90 | - $type instanceof Name, $type instanceof Identifier => TypeDeclaration::from((string) $type), |
|
88 | + return match(true) { |
|
89 | + $type instanceof NullableType => TypeDeclaration::fromNullable((string)$type->type), |
|
90 | + $type instanceof Name, $type instanceof Identifier => TypeDeclaration::from((string)$type), |
|
91 | 91 | $type === null => TypeDeclaration::absent(), |
92 | 92 | default => TypeDeclaration::fromUnionType($this->fromUnionType($type)), |
93 | 93 | }; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | private function fromUnionType(UnionType $type): array |
98 | 98 | { |
99 | 99 | return array_map( |
100 | - static fn (Identifier|Name $name): string => $name instanceof Identifier ? $name->name : (string) $name, |
|
100 | + static fn(Identifier | Name $name): string => $name instanceof Identifier ? $name->name : (string)$name, |
|
101 | 101 | $type->types |
102 | 102 | ); |
103 | 103 | } |