@@ -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 | } |
@@ -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 |
@@ -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 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | { |
26 | 26 | /** @var ClassDefinition|InterfaceDefinition|TraitDefinition $definition */ |
27 | 27 | foreach ($codebase->definitions() as $definition) { |
28 | - match (true) { |
|
28 | + match(true) { |
|
29 | 29 | $definition instanceof ClassDefinition => $this->resolveForClass($definition, $codebase), |
30 | 30 | $definition instanceof InterfaceDefinition => $this->resolveInterfaces($definition->parents(), $codebase), |
31 | 31 | default => $this->resolveTraits($definition->traits(), $codebase), |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | /** @param Name[] $interfaces */ |
47 | 47 | private function resolveInterfaces(array $interfaces, Codebase $codebase): void |
48 | 48 | { |
49 | - array_map(static function (Name $interface) use ($codebase): void { |
|
50 | - if (! $codebase->has($interface)) { |
|
49 | + array_map(static function(Name $interface) use ($codebase): void { |
|
50 | + if (!$codebase->has($interface)) { |
|
51 | 51 | $codebase->add(new InterfaceDefinition($interface)); |
52 | 52 | } |
53 | 53 | }, $interfaces); |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | /** @param Name[] $traits */ |
57 | 57 | private function resolveTraits(array $traits, Codebase $codebase): void |
58 | 58 | { |
59 | - array_map(static function (Name $trait) use ($codebase): void { |
|
60 | - if (! $codebase->has($trait)) { |
|
59 | + array_map(static function(Name $trait) use ($codebase): void { |
|
60 | + if (!$codebase->has($trait)) { |
|
61 | 61 | $codebase->add(new TraitDefinition($trait)); |
62 | 62 | } |
63 | 63 | }, $traits); |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | |
66 | 66 | private function resolveExternalParentClass(ClassDefinition $definition, Codebase $codebase): void |
67 | 67 | { |
68 | - if (! $definition->hasParent()) { |
|
68 | + if (!$definition->hasParent()) { |
|
69 | 69 | return; |
70 | 70 | } |
71 | 71 | $parent = $definition->parent(); |
72 | - if (! $codebase->has($parent)) { |
|
72 | + if (!$codebase->has($parent)) { |
|
73 | 73 | $codebase->add(new ClassDefinition($parent)); |
74 | 74 | } |
75 | 75 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | public function resolve(UseStatements $useStatements): TypeDeclaration |
38 | 38 | { |
39 | - return match (true) { |
|
39 | + return match(true) { |
|
40 | 40 | $this->isNullable => TypeDeclaration::fromNullable($useStatements->fullyQualifiedNameFor($this->types()[0])), |
41 | 41 | count($this->types) === 1 => TypeDeclaration::from($useStatements->fullyQualifiedNameFor($this->types()[0])), |
42 | 42 | default => $this->resolveUnionTypes($useStatements), |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | private function resolveUnionTypes(UseStatements $useStatements): TypeDeclaration |
47 | 47 | { |
48 | 48 | $withFullyQualifiedNames = array_map( |
49 | - static fn (Name $type) => $useStatements->fullyQualifiedNameFor($type), |
|
49 | + static fn(Name $type) => $useStatements->fullyQualifiedNameFor($type), |
|
50 | 50 | $this->types(), |
51 | 51 | ); |
52 | 52 | return TypeDeclaration::fromUnionType($withFullyQualifiedNames); |
@@ -55,6 +55,6 @@ discard block |
||
55 | 55 | /** @return Name[] */ |
56 | 56 | private function types(): array |
57 | 57 | { |
58 | - return array_map(static fn (string $type) => new Name(ltrim($type, characters: '\\')), $this->types); |
|
58 | + return array_map(static fn(string $type) => new Name(ltrim($type, characters: '\\')), $this->types); |
|
59 | 59 | } |
60 | 60 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function build(array $methods, UseStatements $useStatements): array |
37 | 37 | { |
38 | 38 | return array_map( |
39 | - fn (ClassMethod $method): Method => $this->buildMethod($method, $useStatements), |
|
39 | + fn(ClassMethod $method): Method => $this->buildMethod($method, $useStatements), |
|
40 | 40 | $methods |
41 | 41 | ); |
42 | 42 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $docBlock = $method->getDocComment(); |
49 | 49 | $returnType = $this->typeBuilder->fromMethodReturnType($method->returnType, $docBlock, $useStatements); |
50 | 50 | $parameters = $this->parametersBuilder->build($method->params, $docBlock, $useStatements); |
51 | - return match (true) { |
|
51 | + return match(true) { |
|
52 | 52 | $method->isAbstract() => new Method($name, $visibility, $returnType, $parameters, isAbstract: true), |
53 | 53 | $method->isStatic() => new Method($name, $visibility, $returnType, $parameters, isStatic: true), |
54 | 54 | default => new Method($name, $visibility, $returnType, $parameters), |
@@ -32,7 +32,7 @@ |
||
32 | 32 | $params = array_values(array_filter( |
33 | 33 | $parameterTags, |
34 | 34 | static fn (TagWithType|InvalidTag $parameter) => |
35 | - $parameter instanceof Param && "\${$parameter->getVariableName()}" === $parameterName |
|
35 | + $parameter instanceof Param && "\${$parameter->getVariableName()}" === $parameterName |
|
36 | 36 | )); |
37 | 37 | |
38 | 38 | if (count($params) < 1) { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | /** @var Param[] $params */ |
33 | 33 | $params = array_values(array_filter( |
34 | 34 | $parameterTags, |
35 | - static fn (TagWithType|InvalidTag $parameter) => |
|
35 | + static fn(TagWithType | InvalidTag $parameter) => |
|
36 | 36 | $parameter instanceof Param && "\${$parameter->getVariableName()}" === $parameterName |
37 | 37 | )); |
38 | 38 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | private function resolveType(?Type $type): ?TagType |
87 | 87 | { |
88 | - return match (true) { |
|
88 | + return match(true) { |
|
89 | 89 | $type === null => null, |
90 | 90 | $type instanceof Nullable => TagType::nullable((string) $type->getActualType()), |
91 | 91 | $type instanceof Compound => TagType::compound(array_map('strval', $type->getIterator()->getArrayCopy())), |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | private function fromType(Type $type): TagType |
97 | 97 | { |
98 | - if (! $type instanceof Object_) { |
|
98 | + if (!$type instanceof Object_) { |
|
99 | 99 | return TagType::named((string) $type); |
100 | 100 | } |
101 | 101 | if ($type->getFqsen() === null) { |