Passed
Push — master ( c776c7...570285 )
by Kirill
04:05
created
src/Prototype/src/ClassNode/ClassStmt.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
      */
37 37
     public function __toString(): string
38 38
     {
39
-        if ($this->alias) {
39
+        if ($this->alias){
40 40
             return "{$this->name} as $this->alias";
41 41
         }
42 42
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,8 @@
 block discarded – undo
36 36
      */
37 37
     public function __toString(): string
38 38
     {
39
-        if ($this->alias) {
39
+        if ($this->alias)
40
+        {
40 41
             return "{$this->name} as $this->alias";
41 42
         }
42 43
 
Please login to merge, or discard this patch.
src/Prototype/src/ClassNode/Type.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $type = new self();
34 34
 
35 35
         $fullName = null;
36
-        if ($type->hasShortName($name)) {
36
+        if ($type->hasShortName($name)){
37 37
             $fullName = $name;
38 38
             $name = Utils::shortName($name);
39 39
         }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     public function getSlashedShortName(bool $builtIn): string
60 60
     {
61 61
         $type = $this->shortName;
62
-        if (!$builtIn && !$this->fullName) {
62
+        if (!$builtIn && !$this->fullName){
63 63
             $type = "\\$type";
64 64
         }
65 65
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,8 @@  discard block
 block discarded – undo
33 33
         $type = new self();
34 34
 
35 35
         $fullName = null;
36
-        if ($type->hasShortName($name)) {
36
+        if ($type->hasShortName($name))
37
+        {
37 38
             $fullName = $name;
38 39
             $name = Utils::shortName($name);
39 40
         }
@@ -59,7 +60,8 @@  discard block
 block discarded – undo
59 60
     public function getSlashedShortName(bool $builtIn): string
60 61
     {
61 62
         $type = $this->shortName;
62
-        if (!$builtIn && !$this->fullName) {
63
+        if (!$builtIn && !$this->fullName)
64
+        {
63 65
             $type = "\\$type";
64 66
         }
65 67
 
Please login to merge, or discard this patch.
src/Prototype/src/Command/ListCommand.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public function perform(): void
23 23
     {
24 24
         $prototyped = $this->locator->getTargetClasses();
25
-        if ($prototyped === []) {
25
+        if ($prototyped === []){
26 26
             $this->writeln('<comment>No prototyped classes found.</comment>');
27 27
 
28 28
             return;
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
         $grid = $this->table(['Class:', 'Property:', 'Target:']);
32 32
 
33
-        foreach ($prototyped as $class) {
33
+        foreach ($prototyped as $class){
34 34
             $proto = $this->getPrototypeProperties($class);
35 35
 
36 36
             $grid->addRow([$class->getName(), $this->mergeNames($proto), $this->mergeTargets($proto)]);
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,8 @@  discard block
 block discarded – undo
22 22
     public function perform(): void
23 23
     {
24 24
         $prototyped = $this->locator->getTargetClasses();
25
-        if ($prototyped === []) {
25
+        if ($prototyped === [])
26
+        {
26 27
             $this->writeln('<comment>No prototyped classes found.</comment>');
27 28
 
28 29
             return;
@@ -30,7 +31,8 @@  discard block
 block discarded – undo
30 31
 
31 32
         $grid = $this->table(['Class:', 'Property:', 'Target:']);
32 33
 
33
-        foreach ($prototyped as $class) {
34
+        foreach ($prototyped as $class)
35
+        {
34 36
             $proto = $this->getPrototypeProperties($class);
35 37
 
36 38
             $grid->addRow([$class->getName(), $this->mergeNames($proto), $this->mergeTargets($proto)]);
Please login to merge, or discard this patch.
src/Prototype/src/Command/InjectCommand.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     public function perform(): void
33 33
     {
34 34
         $prototyped = $this->locator->getTargetClasses();
35
-        if ($prototyped === []) {
35
+        if ($prototyped === []){
36 36
             $this->writeln('<comment>No prototyped classes found.</comment>');
37 37
 
38 38
             return;
@@ -40,19 +40,19 @@  discard block
 block discarded – undo
40 40
 
41 41
         $targets = [];
42 42
 
43
-        foreach ($prototyped as $class) {
43
+        foreach ($prototyped as $class){
44 44
             $proto = $this->getPrototypeProperties($class);
45
-            if (empty($proto)) {
45
+            if (empty($proto)){
46 46
                 continue;
47 47
             }
48 48
 
49
-            foreach ($proto as $target) {
50
-                if ($target instanceof \Throwable) {
49
+            foreach ($proto as $target){
50
+                if ($target instanceof \Throwable){
51 51
                     $targets[] = [$class->getName(), $target->getMessage(), $target->getFile(), $target->getLine()];
52 52
                     continue 2;
53 53
                 }
54 54
 
55
-                if ($target === null) {
55
+                if ($target === null){
56 56
                     continue 2;
57 57
                 }
58 58
             }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
             $classDefinition = $this->extractor->extract($class->getFilename(), $proto);
63 63
 
64
-            try {
64
+            try{
65 65
                 $modified = (new Injector())->injectDependencies(
66 66
                     file_get_contents($class->getFileName()),
67 67
                     $classDefinition,
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
                 );
70 70
 
71 71
                 file_put_contents($class->getFileName(), $modified);
72
-            } catch (\Throwable $e) {
72
+            }catch (\Throwable $e){
73 73
                 $targets[] = [$class, $e->getMessage(), $e->getFile(), $e->getLine()];
74 74
             }
75 75
         }
76 76
 
77
-        if (!empty($targets)) {
77
+        if (!empty($targets)){
78 78
             $grid = $this->table(['Class:', 'Property:', 'Target:']);
79
-            foreach ($targets as $target) {
79
+            foreach ($targets as $target){
80 80
                 $grid->addRow($target);
81 81
             }
82 82
 
Please login to merge, or discard this patch.
Braces   +21 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,7 +32,8 @@  discard block
 block discarded – undo
32 32
     public function perform(): void
33 33
     {
34 34
         $prototyped = $this->locator->getTargetClasses();
35
-        if ($prototyped === []) {
35
+        if ($prototyped === [])
36
+        {
36 37
             $this->writeln('<comment>No prototyped classes found.</comment>');
37 38
 
38 39
             return;
@@ -40,19 +41,24 @@  discard block
 block discarded – undo
40 41
 
41 42
         $targets = [];
42 43
 
43
-        foreach ($prototyped as $class) {
44
+        foreach ($prototyped as $class)
45
+        {
44 46
             $proto = $this->getPrototypeProperties($class);
45
-            if (empty($proto)) {
47
+            if (empty($proto))
48
+            {
46 49
                 continue;
47 50
             }
48 51
 
49
-            foreach ($proto as $target) {
50
-                if ($target instanceof \Throwable) {
52
+            foreach ($proto as $target)
53
+            {
54
+                if ($target instanceof \Throwable)
55
+                {
51 56
                     $targets[] = [$class->getName(), $target->getMessage(), $target->getFile(), $target->getLine()];
52 57
                     continue 2;
53 58
                 }
54 59
 
55
-                if ($target === null) {
60
+                if ($target === null)
61
+                {
56 62
                     continue 2;
57 63
                 }
58 64
             }
@@ -61,7 +67,8 @@  discard block
 block discarded – undo
61 67
 
62 68
             $classDefinition = $this->extractor->extract($class->getFilename(), $proto);
63 69
 
64
-            try {
70
+            try
71
+            {
65 72
                 $modified = (new Injector())->injectDependencies(
66 73
                     file_get_contents($class->getFileName()),
67 74
                     $classDefinition,
@@ -69,14 +76,18 @@  discard block
 block discarded – undo
69 76
                 );
70 77
 
71 78
                 file_put_contents($class->getFileName(), $modified);
72
-            } catch (\Throwable $e) {
79
+            }
80
+            catch (\Throwable $e)
81
+            {
73 82
                 $targets[] = [$class, $e->getMessage(), $e->getFile(), $e->getLine()];
74 83
             }
75 84
         }
76 85
 
77
-        if (!empty($targets)) {
86
+        if (!empty($targets))
87
+        {
78 88
             $grid = $this->table(['Class:', 'Property:', 'Target:']);
79
-            foreach ($targets as $target) {
89
+            foreach ($targets as $target)
90
+            {
80 91
                 $grid->addRow($target);
81 92
             }
82 93
 
Please login to merge, or discard this patch.
src/Prototype/src/Command/AbstractCommand.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         $proto = $this->getExtractor()->getPrototypeProperties(file_get_contents($class->getFilename()));
55 55
 
56 56
         $result = [];
57
-        foreach ($proto as $name) {
57
+        foreach ($proto as $name){
58 58
             $result[$name] = $this->registry->resolveProperty($name);
59 59
         }
60 60
 
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
     {
87 87
         $result = [];
88 88
 
89
-        foreach ($properties as $target) {
90
-            if ($target instanceof \Throwable) {
89
+        foreach ($properties as $target){
90
+            if ($target instanceof \Throwable){
91 91
                 $result[] = sprintf(
92 92
                     '<fg=red>%s [f: %s, l: %s]</fg=red>',
93 93
                     $target->getMessage(),
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
                 continue;
98 98
             }
99 99
 
100
-            if ($target === null) {
100
+            if ($target === null){
101 101
                 $result[] = '<fg=yellow>undefined</fg=yellow>';
102 102
                 continue;
103 103
             }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,7 +54,8 @@  discard block
 block discarded – undo
54 54
         $proto = $this->getExtractor()->getPrototypeProperties(file_get_contents($class->getFilename()));
55 55
 
56 56
         $result = [];
57
-        foreach ($proto as $name) {
57
+        foreach ($proto as $name)
58
+        {
58 59
             $result[$name] = $this->registry->resolveProperty($name);
59 60
         }
60 61
 
@@ -86,8 +87,10 @@  discard block
 block discarded – undo
86 87
     {
87 88
         $result = [];
88 89
 
89
-        foreach ($properties as $target) {
90
-            if ($target instanceof \Throwable) {
90
+        foreach ($properties as $target)
91
+        {
92
+            if ($target instanceof \Throwable)
93
+            {
91 94
                 $result[] = sprintf(
92 95
                     '<fg=red>%s [f: %s, l: %s]</fg=red>',
93 96
                     $target->getMessage(),
@@ -97,7 +100,8 @@  discard block
 block discarded – undo
97 100
                 continue;
98 101
             }
99 102
 
100
-            if ($target === null) {
103
+            if ($target === null)
104
+            {
101 105
                 $result[] = '<fg=yellow>undefined</fg=yellow>';
102 106
                 continue;
103 107
             }
Please login to merge, or discard this patch.
src/Prototype/src/Command/DumpCommand.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $prototypeBootloader->initAnnotations($this->container, true);
34 34
 
35 35
         $dependencies = $this->registry->getPropertyBindings();
36
-        if ($dependencies === []) {
36
+        if ($dependencies === []){
37 37
             $this->writeln('<comment>No prototyped shortcuts found.</comment>');
38 38
             return;
39 39
         }
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
 
43 43
         $trait = new \ReflectionClass(PrototypeTrait::class);
44 44
         $docComment = $trait->getDocComment();
45
-        if ($docComment === false) {
45
+        if ($docComment === false){
46 46
             $this->write('<fg=reg>DOCComment is missing</fg=red>');
47 47
             return;
48 48
         }
49 49
 
50 50
         $filename = $trait->getFileName();
51 51
 
52
-        try {
52
+        try{
53 53
             file_put_contents(
54 54
                 $filename,
55 55
                 str_replace(
@@ -58,17 +58,17 @@  discard block
 block discarded – undo
58 58
                     file_get_contents($filename)
59 59
                 )
60 60
             );
61
-        } catch (\Throwable $e) {
62
-            $this->write('<fg=red>' . $e->getMessage() . "</fg=red>\n");
61
+        }catch (\Throwable $e){
62
+            $this->write('<fg=red>'.$e->getMessage()."</fg=red>\n");
63 63
             return;
64 64
         }
65 65
 
66 66
         $this->write("<fg=green>complete</fg=green>\n");
67 67
 
68
-        if ($this->isVerbose()) {
68
+        if ($this->isVerbose()){
69 69
             $grid = $this->table(['Property:', 'Target:']);
70 70
 
71
-            foreach ($dependencies as $dependency) {
71
+            foreach ($dependencies as $dependency){
72 72
                 $grid->addRow([$dependency->var, $dependency->type->fullName]);
73 73
             }
74 74
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         );
89 89
         $an->lines[] = new Annotation\Line('');
90 90
 
91
-        foreach ($dependencies as $dependency) {
91
+        foreach ($dependencies as $dependency){
92 92
             $an->lines[] = new Annotation\Line(
93 93
                 sprintf('\\%s $%s', $dependency->type->fullName, $dependency->var),
94 94
                 'property'
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,7 +33,8 @@  discard block
 block discarded – undo
33 33
         $prototypeBootloader->initAnnotations($this->container, true);
34 34
 
35 35
         $dependencies = $this->registry->getPropertyBindings();
36
-        if ($dependencies === []) {
36
+        if ($dependencies === [])
37
+        {
37 38
             $this->writeln('<comment>No prototyped shortcuts found.</comment>');
38 39
             return;
39 40
         }
@@ -42,14 +43,16 @@  discard block
 block discarded – undo
42 43
 
43 44
         $trait = new \ReflectionClass(PrototypeTrait::class);
44 45
         $docComment = $trait->getDocComment();
45
-        if ($docComment === false) {
46
+        if ($docComment === false)
47
+        {
46 48
             $this->write('<fg=reg>DOCComment is missing</fg=red>');
47 49
             return;
48 50
         }
49 51
 
50 52
         $filename = $trait->getFileName();
51 53
 
52
-        try {
54
+        try
55
+        {
53 56
             file_put_contents(
54 57
                 $filename,
55 58
                 str_replace(
@@ -58,17 +61,21 @@  discard block
 block discarded – undo
58 61
                     file_get_contents($filename)
59 62
                 )
60 63
             );
61
-        } catch (\Throwable $e) {
64
+        }
65
+        catch (\Throwable $e)
66
+        {
62 67
             $this->write('<fg=red>' . $e->getMessage() . "</fg=red>\n");
63 68
             return;
64 69
         }
65 70
 
66 71
         $this->write("<fg=green>complete</fg=green>\n");
67 72
 
68
-        if ($this->isVerbose()) {
73
+        if ($this->isVerbose())
74
+        {
69 75
             $grid = $this->table(['Property:', 'Target:']);
70 76
 
71
-            foreach ($dependencies as $dependency) {
77
+            foreach ($dependencies as $dependency)
78
+            {
72 79
                 $grid->addRow([$dependency->var, $dependency->type->fullName]);
73 80
             }
74 81
 
@@ -88,7 +95,8 @@  discard block
 block discarded – undo
88 95
         );
89 96
         $an->lines[] = new Annotation\Line('');
90 97
 
91
-        foreach ($dependencies as $dependency) {
98
+        foreach ($dependencies as $dependency)
99
+        {
92 100
             $an->lines[] = new Annotation\Line(
93 101
                 sprintf('\\%s $%s', $dependency->type->fullName, $dependency->var),
94 102
                 'property'
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
@@ -28,26 +28,26 @@
 block discarded – undo
28 28
      */
29 29
     public function leaveNode(Node $node)
30 30
     {
31
-        if (!$node instanceof Node\Stmt\TraitUse) {
31
+        if (!$node instanceof Node\Stmt\TraitUse){
32 32
             return null;
33 33
         }
34 34
 
35
-        foreach ($node->traits as $index => $use) {
36
-            if ($use instanceof Node\Name) {
35
+        foreach ($node->traits as $index => $use){
36
+            if ($use instanceof Node\Name){
37 37
                 $name = $this->trimSlashes(join('\\', $use->parts));
38 38
                 if (
39 39
                     in_array($name, [
40 40
                     $this->trimSlashes(PrototypeTrait::class),
41 41
                     Utils::shortName(PrototypeTrait::class)
42 42
                     ], true)
43
-                ) {
43
+                ){
44 44
                     unset($node->traits[$index]);
45 45
                 }
46 46
             }
47 47
         }
48 48
 
49 49
         $node->traits = array_values($node->traits);
50
-        if (empty($node->traits)) {
50
+        if (empty($node->traits)){
51 51
             return NodeTraverser::REMOVE_NODE;
52 52
         }
53 53
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,12 +28,15 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function leaveNode(Node $node)
30 30
     {
31
-        if (!$node instanceof Node\Stmt\TraitUse) {
31
+        if (!$node instanceof Node\Stmt\TraitUse)
32
+        {
32 33
             return null;
33 34
         }
34 35
 
35
-        foreach ($node->traits as $index => $use) {
36
-            if ($use instanceof Node\Name) {
36
+        foreach ($node->traits as $index => $use)
37
+        {
38
+            if ($use instanceof Node\Name)
39
+            {
37 40
                 $name = $this->trimSlashes(join('\\', $use->parts));
38 41
                 if (
39 42
                     in_array($name, [
@@ -47,7 +50,8 @@  discard block
 block discarded – undo
47 50
         }
48 51
 
49 52
         $node->traits = array_values($node->traits);
50
-        if (empty($node->traits)) {
53
+        if (empty($node->traits))
54
+        {
51 55
             return NodeTraverser::REMOVE_NODE;
52 56
         }
53 57
 
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
@@ -50,13 +50,13 @@
 block discarded – undo
50 50
             $node instanceof Node\Expr\PropertyFetch &&
51 51
             $node->var instanceof Node\Expr\Variable &&
52 52
             $node->var->name === 'this'
53
-        ) {
53
+        ){
54 54
             $this->requested[$node->name->name] = $node->name->name;
55 55
         }
56 56
 
57
-        if ($node instanceof Node\Stmt\Property) {
58
-            foreach ($node->props as $prop) {
59
-                if ($prop instanceof Node\Stmt\PropertyProperty) {
57
+        if ($node instanceof Node\Stmt\Property){
58
+            foreach ($node->props as $prop){
59
+                if ($prop instanceof Node\Stmt\PropertyProperty){
60 60
                     $this->properties[$prop->name->name] = $prop->name->name;
61 61
                 }
62 62
             }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,9 +54,12 @@
 block discarded – undo
54 54
             $this->requested[$node->name->name] = $node->name->name;
55 55
         }
56 56
 
57
-        if ($node instanceof Node\Stmt\Property) {
58
-            foreach ($node->props as $prop) {
59
-                if ($prop instanceof Node\Stmt\PropertyProperty) {
57
+        if ($node instanceof Node\Stmt\Property)
58
+        {
59
+            foreach ($node->props as $prop)
60
+            {
61
+                if ($prop instanceof Node\Stmt\PropertyProperty)
62
+                {
60 63
                     $this->properties[$prop->name->name] = $prop->name->name;
61 64
                 }
62 65
             }
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
@@ -26,11 +26,11 @@
 block discarded – undo
26 26
      */
27 27
     public function enterNode(Node $node)
28 28
     {
29
-        if ($node instanceof Node\Stmt\Namespace_) {
29
+        if ($node instanceof Node\Stmt\Namespace_){
30 30
             $this->namespace = join('\\', $node->name->parts);
31 31
         }
32 32
 
33
-        if ($node instanceof Node\Stmt\Class_) {
33
+        if ($node instanceof Node\Stmt\Class_){
34 34
             $this->class = $node->name->name;
35 35
 
36 36
             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
@@ -26,11 +26,13 @@
 block discarded – undo
26 26
      */
27 27
     public function enterNode(Node $node)
28 28
     {
29
-        if ($node instanceof Node\Stmt\Namespace_) {
29
+        if ($node instanceof Node\Stmt\Namespace_)
30
+        {
30 31
             $this->namespace = join('\\', $node->name->parts);
31 32
         }
32 33
 
33
-        if ($node instanceof Node\Stmt\Class_) {
34
+        if ($node instanceof Node\Stmt\Class_)
35
+        {
34 36
             $this->class = $node->name->name;
35 37
 
36 38
             return NodeTraverser::STOP_TRAVERSAL;
Please login to merge, or discard this patch.