Passed
Pull Request — master (#656)
by Abdul Malik
11:30 queued 05:15
created
rector.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/LocateProperties.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,13 +49,13 @@
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,9 +53,12 @@
 block discarded – undo
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
+        {
58
+            foreach ($node->props as $prop)
59
+            {
60
+                if ($prop instanceof PropertyProperty)
61
+                {
59 62
                     $this->properties[$prop->name->name] = $prop->name->name;
60 63
                 }
61 64
             }
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/DefineConstructor.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,15 +28,19 @@
 block discarded – undo
28 28
      */
29 29
     public function leaveNode(Node $node)
30 30
     {
31
-        if (!$node instanceof Class_) {
31
+        if (!$node instanceof Class_)
32
+        {
32 33
             return null;
33 34
         }
34 35
 
35 36
         $placementID = 0;
36
-        foreach ($node->stmts as $index => $child) {
37
+        foreach ($node->stmts as $index => $child)
38
+        {
37 39
             $placementID = $index;
38
-            if ($child instanceof ClassMethod) {
39
-                if ($child->name->name === '__construct') {
40
+            if ($child instanceof ClassMethod)
41
+            {
42
+                if ($child->name->name === '__construct')
43
+                {
40 44
                     $node->setAttribute('constructor', $child);
41 45
 
42 46
                     return null;
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/RemoveTrait.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,26 +29,26 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,12 +29,15 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public function leaveNode(Node $node)
31 31
     {
32
-        if (!$node instanceof TraitUse) {
32
+        if (!$node instanceof TraitUse)
33
+        {
33 34
             return null;
34 35
         }
35 36
 
36
-        foreach ($node->traits as $index => $use) {
37
-            if ($use instanceof Name) {
37
+        foreach ($node->traits as $index => $use)
38
+        {
39
+            if ($use instanceof Name)
40
+            {
38 41
                 $name = $this->trimSlashes(implode('\\', $use->parts));
39 42
                 if (
40 43
                     in_array($name, [
@@ -48,7 +51,8 @@  discard block
 block discarded – undo
48 51
         }
49 52
 
50 53
         $node->traits = array_values($node->traits);
51
-        if (empty($node->traits)) {
54
+        if (empty($node->traits))
55
+        {
52 56
             return NodeTraverser::REMOVE_NODE;
53 57
         }
54 58
 
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/AddProperty.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -39,12 +39,14 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function leaveNode(Node $node)
41 41
     {
42
-        if (!$node instanceof Class_) {
42
+        if (!$node instanceof Class_)
43
+        {
43 44
             return null;
44 45
         }
45 46
 
46 47
         $nodes = [];
47
-        foreach ($this->definition->dependencies as $dependency) {
48
+        foreach ($this->definition->dependencies as $dependency)
49
+        {
48 50
             $nodes[] = $this->buildProperty($dependency);
49 51
         }
50 52
 
@@ -56,8 +58,10 @@  discard block
 block discarded – undo
56 58
 
57 59
     private function definePlacementID(Class_ $node): int
58 60
     {
59
-        foreach ($node->stmts as $index => $child) {
60
-            if ($child instanceof ClassMethod || $child instanceof Node\Stmt\Property) {
61
+        foreach ($node->stmts as $index => $child)
62
+        {
63
+            if ($child instanceof ClassMethod || $child instanceof Node\Stmt\Property)
64
+            {
61 65
                 return $index;
62 66
             }
63 67
         }
@@ -70,11 +74,13 @@  discard block
 block discarded – undo
70 74
         $b = new Property($dependency->property);
71 75
         $b->makePrivate();
72 76
 
73
-        if ($this->useTypedProperty()) {
77
+        if ($this->useTypedProperty())
78
+        {
74 79
             $b->setType($this->getPropertyType($dependency));
75 80
         }
76 81
 
77
-        if ($this->renderDoc()) {
82
+        if ($this->renderDoc())
83
+        {
78 84
             $b->setDocComment(new Doc(sprintf('/** @var %s */', $this->getPropertyType($dependency))));
79 85
         }
80 86
 
@@ -93,8 +99,10 @@  discard block
 block discarded – undo
93 99
 
94 100
     private function getPropertyType(Dependency $dependency): string
95 101
     {
96
-        foreach ($this->definition->getStmts() as $stmt) {
97
-            if (($stmt->name === $dependency->type->fullName) && $stmt->alias) {
102
+        foreach ($this->definition->getStmts() as $stmt)
103
+        {
104
+            if (($stmt->name === $dependency->type->fullName) && $stmt->alias)
105
+            {
98 106
                 return $stmt->alias;
99 107
             }
100 108
         }
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/AddUse.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +34 added lines, -17 removed lines patch added patch discarded remove patch
@@ -40,16 +40,21 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function leaveNode(Node $node)
42 42
     {
43
-        if (!$node instanceof Namespace_) {
43
+        if (!$node instanceof Namespace_)
44
+        {
44 45
             return null;
45 46
         }
46 47
 
47 48
         $imported = [];
48
-        if (!$this->node->hasConstructor && $this->node->constructorParams) {
49
-            foreach ($this->node->constructorParams as $param) {
50
-                if (!empty($param->type) && $param->type->fullName) {
49
+        if (!$this->node->hasConstructor && $this->node->constructorParams)
50
+        {
51
+            foreach ($this->node->constructorParams as $param)
52
+            {
53
+                if (!empty($param->type) && $param->type->fullName)
54
+                {
51 55
                     $import = [$param->type->fullName, $param->type->alias];
52
-                    if (in_array($import, $imported, true)) {
56
+                    if (in_array($import, $imported, true))
57
+                    {
53 58
                         continue;
54 59
                     }
55 60
 
@@ -59,9 +64,11 @@  discard block
 block discarded – undo
59 64
             }
60 65
         }
61 66
 
62
-        foreach ($this->node->dependencies as $dependency) {
67
+        foreach ($this->node->dependencies as $dependency)
68
+        {
63 69
             $import = [$dependency->type->fullName, $dependency->type->alias];
64
-            if (in_array($import, $imported, true)) {
70
+            if (in_array($import, $imported, true))
71
+            {
65 72
                 continue;
66 73
             }
67 74
 
@@ -84,8 +91,10 @@  discard block
 block discarded – undo
84 91
 
85 92
     private function definePlacementID(Namespace_ $node): int
86 93
     {
87
-        foreach ($node->stmts as $index => $child) {
88
-            if ($child instanceof Class_) {
94
+        foreach ($node->stmts as $index => $child)
95
+        {
96
+            if ($child instanceof Class_)
97
+            {
89 98
                 return $index;
90 99
             }
91 100
         }
@@ -102,13 +111,17 @@  discard block
 block discarded – undo
102 111
     {
103 112
         $uses = $this->getExistingUseParts($stmts);
104 113
 
105
-        foreach ($nodes as $i => $node) {
106
-            if (!$node instanceof Node\Stmt\Use_) {
114
+        foreach ($nodes as $i => $node)
115
+        {
116
+            if (!$node instanceof Node\Stmt\Use_)
117
+            {
107 118
                 continue;
108 119
             }
109 120
 
110
-            foreach ($node->uses as $use) {
111
-                if (in_array($use->name->parts, $uses, true)) {
121
+            foreach ($node->uses as $use)
122
+            {
123
+                if (in_array($use->name->parts, $uses, true))
124
+                {
112 125
                     unset($nodes[$i]);
113 126
                 }
114 127
             }
@@ -127,12 +140,15 @@  discard block
 block discarded – undo
127 140
     private function getExistingUseParts(array $stmts): array
128 141
     {
129 142
         $uses = [];
130
-        foreach ($stmts as $stmt) {
131
-            if (!$stmt instanceof Node\Stmt\Use_) {
143
+        foreach ($stmts as $stmt)
144
+        {
145
+            if (!$stmt instanceof Node\Stmt\Use_)
146
+            {
132 147
                 continue;
133 148
             }
134 149
 
135
-            foreach ($stmt->uses as $use) {
150
+            foreach ($stmt->uses as $use)
151
+            {
136 152
                 $uses[] = $use->name->parts;
137 153
             }
138 154
         }
@@ -143,7 +159,8 @@  discard block
 block discarded – undo
143 159
     private function buildUse(string $type, ?string $alias = null): Node\Stmt\Use_
144 160
     {
145 161
         $b = new Use_(new Name($type), Node\Stmt\Use_::TYPE_NORMAL);
146
-        if (!empty($alias)) {
162
+        if (!empty($alias))
163
+        {
147 164
             $b->as($alias);
148 165
         }
149 166
 
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/ClassNode/LocateVariables.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,16 +27,16 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,16 +27,20 @@
 block discarded – undo
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
+        {
32
+            foreach ($node->stmts as $stmt)
33
+            {
34
+                if ($stmt instanceof ClassMethod && $stmt->name === '__construct')
35
+                {
33 36
                     return $stmt;
34 37
                 }
35 38
             }
36 39
             return NodeTraverser::DONT_TRAVERSE_CHILDREN;
37 40
         }
38 41
 
39
-        if ($node instanceof Variable) {
42
+        if ($node instanceof Variable)
43
+        {
40 44
             $this->vars[] = $node->name;
41 45
         }
42 46
 
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/ClassNode/DeclareClass.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,11 +27,13 @@
 block discarded – undo
27 27
      */
28 28
     public function enterNode(Node $node)
29 29
     {
30
-        if ($node instanceof Namespace_) {
30
+        if ($node instanceof Namespace_)
31
+        {
31 32
             $this->namespace = implode('\\', $node->name->parts);
32 33
         }
33 34
 
34
-        if ($node instanceof Class_) {
35
+        if ($node instanceof Class_)
36
+        {
35 37
             $this->class = $node->name->name;
36 38
 
37 39
             return NodeTraverser::STOP_TRAVERSAL;
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/ClassNode/LocateStatements.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@
 block discarded – undo
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,
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,10 @@
 block discarded – undo
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
+        {
32
+            foreach ($node->uses as $use)
33
+            {
32 34
                 $this->imports[] = [
33 35
                     'name'  => implode('\\', $use->name->parts),
34 36
                     'alias' => $use->alias->name ?? null,
Please login to merge, or discard this patch.