Passed
Pull Request — master (#1005)
by Maxim
11:25
created
src/Prototype/src/PrototypeLocatorListener.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,8 @@  discard block
 block discarded – undo
29 29
     public function listen(ReflectionClass $class): void
30 30
     {
31 31
         $attribute = $this->reader->firstClassMetadata($class, Prototyped::class);
32
-        if ($attribute === null) {
32
+        if ($attribute === null)
33
+        {
33 34
             return;
34 35
         }
35 36
 
@@ -38,7 +39,8 @@  discard block
 block discarded – undo
38 39
 
39 40
     public function finalize(): void
40 41
     {
41
-        foreach ($this->attributes as $property => $class) {
42
+        foreach ($this->attributes as $property => $class)
43
+        {
42 44
             $this->prototype->bindProperty($property, $class);
43 45
         }
44 46
     }
Please login to merge, or discard this patch.
src/Prototype/src/Command/ListCommand.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@  discard block
 block discarded – undo
12 12
     public function perform(): int
13 13
     {
14 14
         $bindings = $this->getRegistry()->getPropertyBindings();
15
-        if ($bindings === []) {
15
+        if ($bindings === [])
16
+        {
16 17
             $this->comment('No prototype dependencies found.');
17 18
 
18 19
             return self::SUCCESS;
@@ -20,7 +21,8 @@  discard block
 block discarded – undo
20 21
 
21 22
         $grid = $this->table(['Name:', 'Target:']);
22 23
 
23
-        foreach ($bindings as $binding) {
24
+        foreach ($bindings as $binding)
25
+        {
24 26
             $grid->addRow([$binding->property, $binding->type->name()]);
25 27
         }
26 28
 
Please login to merge, or discard this patch.
src/Prototype/src/Command/AbstractCommand.php 1 patch
Braces   +19 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,7 +34,8 @@  discard block
 block discarded – undo
34 34
         $results = [$this->readProperties($class)];
35 35
 
36 36
         $parent = $class->getParentClass();
37
-        while ($parent instanceof \ReflectionClass && isset($all[$parent->getName()])) {
37
+        while ($parent instanceof \ReflectionClass && isset($all[$parent->getName()]))
38
+        {
38 39
             $results[] = $this->readProperties($parent);
39 40
             $parent = $parent->getParentClass();
40 41
         }
@@ -67,8 +68,10 @@  discard block
 block discarded – undo
67 68
     {
68 69
         $result = [];
69 70
 
70
-        foreach ($properties as $target) {
71
-            if ($target instanceof Throwable) {
71
+        foreach ($properties as $target)
72
+        {
73
+            if ($target instanceof Throwable)
74
+            {
72 75
                 $result[] = \sprintf(
73 76
                     '<fg=red>%s [f: %s, l: %s]</fg=red>',
74 77
                     $target->getMessage(),
@@ -78,7 +81,8 @@  discard block
 block discarded – undo
78 81
                 continue;
79 82
             }
80 83
 
81
-            if ($target === null) {
84
+            if ($target === null)
85
+            {
82 86
                 $result[] = '<fg=yellow>undefined</fg=yellow>';
83 87
                 continue;
84 88
             }
@@ -94,16 +98,21 @@  discard block
 block discarded – undo
94 98
      */
95 99
     private function readProperties(\ReflectionClass $class): array
96 100
     {
97
-        if (isset($this->cache[$class->getFileName()])) {
101
+        if (isset($this->cache[$class->getFileName()]))
102
+        {
98 103
             $proto = $this->cache[$class->getFileName()];
99
-        } else {
104
+        }
105
+        else
106
+        {
100 107
             $proto = $this->getExtractor()->getPrototypeProperties(\file_get_contents($class->getFileName()));
101 108
             $this->cache[$class->getFileName()] = $proto;
102 109
         }
103 110
 
104 111
         $result = [];
105
-        foreach ($proto as $name) {
106
-            if (!isset($result[$name])) {
112
+        foreach ($proto as $name)
113
+        {
114
+            if (!isset($result[$name]))
115
+            {
107 116
                 $result[$name] = $this->getRegistry()->resolveProperty($name);
108 117
             }
109 118
         }
@@ -120,7 +129,8 @@  discard block
 block discarded – undo
120 129
      */
121 130
     private function reverse(array $results): \Generator
122 131
     {
123
-        foreach (\array_reverse($results) as $result) {
132
+        foreach (\array_reverse($results) as $result)
133
+        {
124 134
             yield from $result;
125 135
         }
126 136
     }
Please login to merge, or discard this patch.
src/Prototype/src/Command/DumpCommand.php 1 patch
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,7 +22,8 @@  discard block
 block discarded – undo
22 22
     public function perform(): int
23 23
     {
24 24
         $dependencies = $this->getRegistry()->getPropertyBindings();
25
-        if ($dependencies === []) {
25
+        if ($dependencies === [])
26
+        {
26 27
             $this->writeln('<comment>No prototyped shortcuts found.</comment>');
27 28
 
28 29
             return self::SUCCESS;
@@ -32,7 +33,8 @@  discard block
 block discarded – undo
32 33
 
33 34
         $trait = new \ReflectionClass(PrototypeTrait::class);
34 35
         $docComment = $trait->getDocComment();
35
-        if ($docComment === false) {
36
+        if ($docComment === false)
37
+        {
36 38
             $this->write('<fg=red>DOCComment is missing</fg=red>');
37 39
 
38 40
             return self::FAILURE;
@@ -40,7 +42,8 @@  discard block
 block discarded – undo
40 42
 
41 43
         $filename = $trait->getFileName();
42 44
 
43
-        try {
45
+        try
46
+        {
44 47
             \file_put_contents(
45 48
                 $filename,
46 49
                 \str_replace(
@@ -49,7 +52,9 @@  discard block
 block discarded – undo
49 52
                     \file_get_contents($filename)
50 53
                 )
51 54
             );
52
-        } catch (\Throwable $e) {
55
+        }
56
+        catch (\Throwable $e)
57
+        {
53 58
             $this->write('<fg=red>' . $e->getMessage() . "</fg=red>\n");
54 59
 
55 60
             return self::FAILURE;
@@ -57,10 +62,12 @@  discard block
 block discarded – undo
57 62
 
58 63
         $this->write("<fg=green>complete</fg=green>\n");
59 64
 
60
-        if ($this->isVerbose()) {
65
+        if ($this->isVerbose())
66
+        {
61 67
             $grid = $this->table(['Property:', 'Target:']);
62 68
 
63
-            foreach ($dependencies as $dependency) {
69
+            foreach ($dependencies as $dependency)
70
+            {
64 71
                 $grid->addRow([$dependency->var, $dependency->type->fullName]);
65 72
             }
66 73
 
@@ -78,7 +85,8 @@  discard block
 block discarded – undo
78 85
         );
79 86
         $an->lines[] = new Annotation\Line('');
80 87
 
81
-        foreach ($dependencies as $dependency) {
88
+        foreach ($dependencies as $dependency)
89
+        {
82 90
             $an->lines[] = new Annotation\Line(
83 91
                 \sprintf('\\%s $%s', $dependency->type->fullName, $dependency->var),
84 92
                 'property'
Please login to merge, or discard this patch.
src/Prototype/src/Bootloader/PrototypeBootloader.php 1 patch
Braces   +19 added lines, -9 removed lines patch added patch discarded remove patch
@@ -124,30 +124,40 @@
 block discarded – undo
124 124
     {
125 125
         $registry = new PrototypeRegistry($container);
126 126
 
127
-        foreach ($config->getBindings() as $property => $shortcut) {
128
-            if (\is_array($shortcut) && isset($shortcut['resolve'])) {
129
-                if (isset($shortcut['with'])) {
127
+        foreach ($config->getBindings() as $property => $shortcut)
128
+        {
129
+            if (\is_array($shortcut) && isset($shortcut['resolve']))
130
+            {
131
+                if (isset($shortcut['with']))
132
+                {
130 133
                     // check dependencies
131
-                    foreach ($shortcut['with'] as $dep) {
132
-                        if (!\class_exists($dep, true) && !\interface_exists($dep, true)) {
134
+                    foreach ($shortcut['with'] as $dep)
135
+                    {
136
+                        if (!\class_exists($dep, true) && !\interface_exists($dep, true))
137
+                        {
133 138
                             continue 2;
134 139
                         }
135 140
                     }
136 141
                 }
137 142
 
138
-                try {
143
+                try
144
+                {
139 145
                     $target = $container->get($shortcut['resolve']);
140
-                    if (\is_object($target)) {
146
+                    if (\is_object($target))
147
+                    {
141 148
                         $registry->bindProperty($property, $target::class);
142 149
                     }
143
-                } catch (ContainerExceptionInterface) {
150
+                }
151
+                catch (ContainerExceptionInterface)
152
+                {
144 153
                     continue;
145 154
                 }
146 155
 
147 156
                 continue;
148 157
             }
149 158
 
150
-            if (\is_string($shortcut) && (\class_exists($shortcut, true) || \interface_exists($shortcut, true))) {
159
+            if (\is_string($shortcut) && (\class_exists($shortcut, true) || \interface_exists($shortcut, true)))
160
+            {
151 161
                 $registry->bindProperty($property, $shortcut);
152 162
             }
153 163
         }
Please login to merge, or discard this patch.