@@ -13,7 +13,7 @@ |
||
13 | 13 | use Rector\Set\ValueObject\SetList; |
14 | 14 | use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; |
15 | 15 | |
16 | -return static function (ContainerConfigurator $containerConfigurator): void { |
|
16 | +return static function(ContainerConfigurator $containerConfigurator): void { |
|
17 | 17 | $parameters = $containerConfigurator->parameters(); |
18 | 18 | |
19 | 19 | $parameters->set(Option::PATHS, [__DIR__ . '/src', __DIR__ . '/tests']); |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | |
41 | 41 | private function resolveExternalAttributes(ClassDefinition $definition, Codebase $codebase): void |
42 | 42 | { |
43 | - array_map(function (Attribute $attribute) use ($codebase): void { |
|
43 | + array_map(function(Attribute $attribute) use ($codebase): void { |
|
44 | 44 | $this->resolveExternalAssociationsFromTypeNames($attribute->references(), $codebase); |
45 | 45 | }, $definition->attributes()); |
46 | 46 | } |
47 | 47 | |
48 | 48 | private function resolveExternalConstructorParameters(ClassDefinition $definition, Codebase $codebase): void |
49 | 49 | { |
50 | - array_map(function (Parameter $parameter) use ($codebase): void { |
|
50 | + array_map(function(Parameter $parameter) use ($codebase): void { |
|
51 | 51 | $this->resolveExternalAssociationsFromTypeNames($parameter->references(), $codebase); |
52 | 52 | }, $definition->constructorParameters()); |
53 | 53 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** @param Name[] $references */ |
56 | 56 | private function resolveExternalAssociationsFromTypeNames(array $references, Codebase $codebase): void |
57 | 57 | { |
58 | - array_map(static function (Name $reference) use ($codebase): void { |
|
58 | + array_map(static function(Name $reference) use ($codebase): void { |
|
59 | 59 | if ($codebase->has($reference)) { |
60 | 60 | return; |
61 | 61 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | /** @param mixed[] $options */ |
15 | 15 | public function __construct(array $options) |
16 | 16 | { |
17 | - $this->recursive = (bool) ($options['recursive'] ?? false); |
|
17 | + $this->recursive = (bool)($options['recursive'] ?? false); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | public function recursive(): bool |
@@ -23,7 +23,7 @@ |
||
23 | 23 | public static function fromConfiguration(CodeFinderConfiguration $configuration): SourceCodeFinder |
24 | 24 | { |
25 | 25 | $finder = new Finder(); |
26 | - if (! $configuration->recursive()) { |
|
26 | + if (!$configuration->recursive()) { |
|
27 | 27 | $finder->depth(0); |
28 | 28 | } |
29 | 29 | return new self($finder); |
@@ -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 | } |