@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | return static function (ContainerConfigurator $containerConfigurator): void { |
| 14 | 14 | $parameters = $containerConfigurator->parameters(); |
| 15 | 15 | $parameters->set(Option::PATHS, [ |
| 16 | - __DIR__ . '/src/*/src', |
|
| 16 | + __DIR__.'/src/*/src', |
|
| 17 | 17 | ]); |
| 18 | 18 | |
| 19 | 19 | $parameters->set(Option::AUTO_IMPORT_NAMES, true); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | RemoveUnusedPromotedPropertyRector::class, |
| 26 | 26 | |
| 27 | 27 | RemoveUnusedPrivateMethodRector::class => [ |
| 28 | - __DIR__ . '/src/Boot/src/Bootloader/ConfigurationBootloader.php', |
|
| 28 | + __DIR__.'/src/Boot/src/Bootloader/ConfigurationBootloader.php', |
|
| 29 | 29 | ], |
| 30 | 30 | ]); |
| 31 | 31 | |
@@ -49,13 +49,13 @@ |
||
| 49 | 49 | $node instanceof PropertyFetch && |
| 50 | 50 | $node->var instanceof Variable && |
| 51 | 51 | $node->var->name === 'this' |
| 52 | - ) { |
|
| 52 | + ){ |
|
| 53 | 53 | $this->requested[$node->name->name] = $node->name->name; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if ($node instanceof Property) { |
|
| 57 | - foreach ($node->props as $prop) { |
|
| 58 | - if ($prop instanceof PropertyProperty) { |
|
| 56 | + if ($node instanceof Property){ |
|
| 57 | + foreach ($node->props as $prop){ |
|
| 58 | + if ($prop instanceof PropertyProperty){ |
|
| 59 | 59 | $this->properties[$prop->name->name] = $prop->name->name; |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -28,15 +28,15 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | public function leaveNode(Node $node) |
| 30 | 30 | { |
| 31 | - if (!$node instanceof Class_) { |
|
| 31 | + if (!$node instanceof Class_){ |
|
| 32 | 32 | return null; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $placementID = 0; |
| 36 | - foreach ($node->stmts as $index => $child) { |
|
| 36 | + foreach ($node->stmts as $index => $child){ |
|
| 37 | 37 | $placementID = $index; |
| 38 | - if ($child instanceof ClassMethod) { |
|
| 39 | - if ($child->name->name === '__construct') { |
|
| 38 | + if ($child instanceof ClassMethod){ |
|
| 39 | + if ($child->name->name === '__construct'){ |
|
| 40 | 40 | $node->setAttribute('constructor', $child); |
| 41 | 41 | |
| 42 | 42 | return null; |
@@ -29,26 +29,26 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | public function leaveNode(Node $node) |
| 31 | 31 | { |
| 32 | - if (!$node instanceof TraitUse) { |
|
| 32 | + if (!$node instanceof TraitUse){ |
|
| 33 | 33 | return null; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - foreach ($node->traits as $index => $use) { |
|
| 37 | - if ($use instanceof Name) { |
|
| 36 | + foreach ($node->traits as $index => $use){ |
|
| 37 | + if ($use instanceof Name){ |
|
| 38 | 38 | $name = $this->trimSlashes(implode('\\', $use->parts)); |
| 39 | 39 | if ( |
| 40 | 40 | in_array($name, [ |
| 41 | 41 | $this->trimSlashes(PrototypeTrait::class), |
| 42 | 42 | Utils::shortName(PrototypeTrait::class), |
| 43 | 43 | ], true) |
| 44 | - ) { |
|
| 44 | + ){ |
|
| 45 | 45 | unset($node->traits[$index]); |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | $node->traits = array_values($node->traits); |
| 51 | - if (empty($node->traits)) { |
|
| 51 | + if (empty($node->traits)){ |
|
| 52 | 52 | return NodeTraverser::REMOVE_NODE; |
| 53 | 53 | } |
| 54 | 54 | |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function leaveNode(Node $node) |
| 41 | 41 | { |
| 42 | - if (!$node instanceof Class_) { |
|
| 42 | + if (!$node instanceof Class_){ |
|
| 43 | 43 | return null; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $nodes = []; |
| 47 | - foreach ($this->definition->dependencies as $dependency) { |
|
| 47 | + foreach ($this->definition->dependencies as $dependency){ |
|
| 48 | 48 | $nodes[] = $this->buildProperty($dependency); |
| 49 | 49 | } |
| 50 | 50 | |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | private function definePlacementID(Class_ $node): int |
| 58 | 58 | { |
| 59 | - foreach ($node->stmts as $index => $child) { |
|
| 60 | - if ($child instanceof ClassMethod || $child instanceof Node\Stmt\Property) { |
|
| 59 | + foreach ($node->stmts as $index => $child){ |
|
| 60 | + if ($child instanceof ClassMethod || $child instanceof Node\Stmt\Property){ |
|
| 61 | 61 | return $index; |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | $b = new Property($dependency->property); |
| 71 | 71 | $b->makePrivate(); |
| 72 | 72 | |
| 73 | - if ($this->useTypedProperty()) { |
|
| 73 | + if ($this->useTypedProperty()){ |
|
| 74 | 74 | $b->setType($this->getPropertyType($dependency)); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - if ($this->renderDoc()) { |
|
| 77 | + if ($this->renderDoc()){ |
|
| 78 | 78 | $b->setDocComment(new Doc(sprintf('/** @var %s */', $this->getPropertyType($dependency)))); |
| 79 | 79 | } |
| 80 | 80 | |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | private function getPropertyType(Dependency $dependency): string |
| 95 | 95 | { |
| 96 | - foreach ($this->definition->getStmts() as $stmt) { |
|
| 97 | - if (($stmt->name === $dependency->type->fullName) && $stmt->alias) { |
|
| 96 | + foreach ($this->definition->getStmts() as $stmt){ |
|
| 97 | + if (($stmt->name === $dependency->type->fullName) && $stmt->alias){ |
|
| 98 | 98 | return $stmt->alias; |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -40,16 +40,16 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function leaveNode(Node $node) |
| 42 | 42 | { |
| 43 | - if (!$node instanceof Namespace_) { |
|
| 43 | + if (!$node instanceof Namespace_){ |
|
| 44 | 44 | return null; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $imported = []; |
| 48 | - if (!$this->node->hasConstructor && $this->node->constructorParams) { |
|
| 49 | - foreach ($this->node->constructorParams as $param) { |
|
| 50 | - if (!empty($param->type) && $param->type->fullName) { |
|
| 48 | + if (!$this->node->hasConstructor && $this->node->constructorParams){ |
|
| 49 | + foreach ($this->node->constructorParams as $param){ |
|
| 50 | + if (!empty($param->type) && $param->type->fullName){ |
|
| 51 | 51 | $import = [$param->type->fullName, $param->type->alias]; |
| 52 | - if (in_array($import, $imported, true)) { |
|
| 52 | + if (in_array($import, $imported, true)){ |
|
| 53 | 53 | continue; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - foreach ($this->node->dependencies as $dependency) { |
|
| 62 | + foreach ($this->node->dependencies as $dependency){ |
|
| 63 | 63 | $import = [$dependency->type->fullName, $dependency->type->alias]; |
| 64 | - if (in_array($import, $imported, true)) { |
|
| 64 | + if (in_array($import, $imported, true)){ |
|
| 65 | 65 | continue; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | private function definePlacementID(Namespace_ $node): int |
| 86 | 86 | { |
| 87 | - foreach ($node->stmts as $index => $child) { |
|
| 88 | - if ($child instanceof Class_) { |
|
| 87 | + foreach ($node->stmts as $index => $child){ |
|
| 88 | + if ($child instanceof Class_){ |
|
| 89 | 89 | return $index; |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -102,13 +102,13 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | $uses = $this->getExistingUseParts($stmts); |
| 104 | 104 | |
| 105 | - foreach ($nodes as $i => $node) { |
|
| 106 | - if (!$node instanceof Node\Stmt\Use_) { |
|
| 105 | + foreach ($nodes as $i => $node){ |
|
| 106 | + if (!$node instanceof Node\Stmt\Use_){ |
|
| 107 | 107 | continue; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - foreach ($node->uses as $use) { |
|
| 111 | - if (in_array($use->name->parts, $uses, true)) { |
|
| 110 | + foreach ($node->uses as $use){ |
|
| 111 | + if (in_array($use->name->parts, $uses, true)){ |
|
| 112 | 112 | unset($nodes[$i]); |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -127,12 +127,12 @@ discard block |
||
| 127 | 127 | private function getExistingUseParts(array $stmts): array |
| 128 | 128 | { |
| 129 | 129 | $uses = []; |
| 130 | - foreach ($stmts as $stmt) { |
|
| 131 | - if (!$stmt instanceof Node\Stmt\Use_) { |
|
| 130 | + foreach ($stmts as $stmt){ |
|
| 131 | + if (!$stmt instanceof Node\Stmt\Use_){ |
|
| 132 | 132 | continue; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - foreach ($stmt->uses as $use) { |
|
| 135 | + foreach ($stmt->uses as $use){ |
|
| 136 | 136 | $uses[] = $use->name->parts; |
| 137 | 137 | } |
| 138 | 138 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | private function buildUse(string $type, ?string $alias = null): Node\Stmt\Use_ |
| 144 | 144 | { |
| 145 | 145 | $b = new Use_(new Name($type), Node\Stmt\Use_::TYPE_NORMAL); |
| 146 | - if (!empty($alias)) { |
|
| 146 | + if (!empty($alias)){ |
|
| 147 | 147 | $b->as($alias); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -27,16 +27,16 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public function enterNode(Node $node) |
| 29 | 29 | { |
| 30 | - if ($node instanceof Class_) { |
|
| 31 | - foreach ($node->stmts as $stmt) { |
|
| 32 | - if ($stmt instanceof ClassMethod && $stmt->name === '__construct') { |
|
| 30 | + if ($node instanceof Class_){ |
|
| 31 | + foreach ($node->stmts as $stmt){ |
|
| 32 | + if ($stmt instanceof ClassMethod && $stmt->name === '__construct'){ |
|
| 33 | 33 | return $stmt; |
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | return NodeTraverser::DONT_TRAVERSE_CHILDREN; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if ($node instanceof Variable) { |
|
| 39 | + if ($node instanceof Variable){ |
|
| 40 | 40 | $this->vars[] = $node->name; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -27,11 +27,11 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public function enterNode(Node $node) |
| 29 | 29 | { |
| 30 | - if ($node instanceof Namespace_) { |
|
| 30 | + if ($node instanceof Namespace_){ |
|
| 31 | 31 | $this->namespace = implode('\\', $node->name->parts); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if ($node instanceof Class_) { |
|
| 34 | + if ($node instanceof Class_){ |
|
| 35 | 35 | $this->class = $node->name->name; |
| 36 | 36 | |
| 37 | 37 | return NodeTraverser::STOP_TRAVERSAL; |
@@ -27,8 +27,8 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public function enterNode(Node $node) |
| 29 | 29 | { |
| 30 | - if ($node instanceof Use_) { |
|
| 31 | - foreach ($node->uses as $use) { |
|
| 30 | + if ($node instanceof Use_){ |
|
| 31 | + foreach ($node->uses as $use){ |
|
| 32 | 32 | $this->imports[] = [ |
| 33 | 33 | 'name' => implode('\\', $use->name->parts), |
| 34 | 34 | 'alias' => $use->alias->name ?? null, |