@@ -20,18 +20,18 @@ |
||
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 | 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 | } |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | |
16 | 16 | final class VisibilityBuilder |
17 | 17 | { |
18 | - public function build(Property|ClassMethod|ClassConst $member): Visibility |
|
18 | + public function build(Property | ClassMethod | ClassConst $member): Visibility |
|
19 | 19 | { |
20 | - return match (true) { |
|
20 | + return match(true) { |
|
21 | 21 | $member->isPublic() => Visibility::public(), |
22 | 22 | $member->isPrivate() => Visibility::private(), |
23 | 23 | default => Visibility::protected(), |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | public function fromFlags(int $flags): Visibility |
28 | 28 | { |
29 | - return match (true) { |
|
29 | + return match(true) { |
|
30 | 30 | (bool) ($flags & Class_::MODIFIER_PUBLIC) => Visibility::public(), |
31 | 31 | (bool) ($flags & Class_::MODIFIER_PROTECTED) => Visibility::protected(), |
32 | 32 | (bool) ($flags & Class_::MODIFIER_PRIVATE) => Visibility::private(), |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function build(array $classConstants): array |
37 | 37 | { |
38 | - return array_map(fn (ClassConst $constant): Constant => new Constant( |
|
38 | + return array_map(fn(ClassConst $constant): Constant => new Constant( |
|
39 | 39 | (string) $constant->consts[0]->name, |
40 | 40 | TypeDeclaration::from($this->determineType($constant->consts[0])), |
41 | 41 | $this->visibilityBuilder->build($constant) |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if (property_exists($constant->value, 'value')) { |
48 | 48 | return self::TYPES[\gettype($constant->value->value)]; |
49 | 49 | } |
50 | - if (! $constant->value instanceof ConstFetch) { |
|
50 | + if (!$constant->value instanceof ConstFetch) { |
|
51 | 51 | return null; |
52 | 52 | } |
53 | 53 | return 'bool'; |
@@ -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,9 +83,9 @@ 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) { |
|
88 | + return match(true) { |
|
89 | 89 | $type instanceof NullableType => TypeDeclaration::fromNullable((string) $type->type), |
90 | 90 | $type instanceof Name, $type instanceof Identifier => TypeDeclaration::from((string) $type), |
91 | 91 | $type === null => TypeDeclaration::absent(), |
@@ -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 => (string) $name, |
|
100 | + static fn(Identifier | Name $name): string => (string) $name, |
|
101 | 101 | $type->types |
102 | 102 | ); |
103 | 103 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | 'The directory with the code to be scanned cannot be empty' |
32 | 32 | ); |
33 | 33 | $directory = new SplFileInfo($path); |
34 | - if (! $directory->isDir()) { |
|
34 | + if (!$directory->isDir()) { |
|
35 | 35 | throw InvalidDirectory::notFoundAt($directory); |
36 | 36 | } |
37 | 37 | $this->directory = $directory; |