Test Failed
Pull Request — master (#925)
by butschster
16:57 queued 09:14
created
src/Prototype/src/NodeVisitors/DefineConstructor.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,15 +16,15 @@
 block discarded – undo
16 16
 {
17 17
     public function leaveNode(Node $node): ?Node
18 18
     {
19
-        if (!$node instanceof Node\Stmt\Class_) {
19
+        if (!$node instanceof Node\Stmt\Class_){
20 20
             return null;
21 21
         }
22 22
 
23 23
         $placementID = 0;
24
-        foreach ($node->stmts as $index => $child) {
24
+        foreach ($node->stmts as $index => $child){
25 25
             $placementID = $index;
26
-            if ($child instanceof Node\Stmt\ClassMethod) {
27
-                if ($child->name->name === '__construct') {
26
+            if ($child instanceof Node\Stmt\ClassMethod){
27
+                if ($child->name->name === '__construct'){
28 28
                     $node->setAttribute('constructor', $child);
29 29
 
30 30
                     return null;
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,15 +16,19 @@
 block discarded – undo
16 16
 {
17 17
     public function leaveNode(Node $node): ?Node
18 18
     {
19
-        if (!$node instanceof Node\Stmt\Class_) {
19
+        if (!$node instanceof Node\Stmt\Class_)
20
+        {
20 21
             return null;
21 22
         }
22 23
 
23 24
         $placementID = 0;
24
-        foreach ($node->stmts as $index => $child) {
25
+        foreach ($node->stmts as $index => $child)
26
+        {
25 27
             $placementID = $index;
26
-            if ($child instanceof Node\Stmt\ClassMethod) {
27
-                if ($child->name->name === '__construct') {
28
+            if ($child instanceof Node\Stmt\ClassMethod)
29
+            {
30
+                if ($child->name->name === '__construct')
31
+                {
28 32
                     $node->setAttribute('constructor', $child);
29 33
 
30 34
                     return null;
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/ClassNode/LocateVariables.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,18 +12,18 @@
 block discarded – undo
12 12
 {
13 13
     private array $vars = [];
14 14
 
15
-    public function enterNode(Node $node): int|Node\Stmt\ClassMethod|null
15
+    public function enterNode(Node $node): int | Node\Stmt\ClassMethod | null
16 16
     {
17
-        if ($node instanceof Node\Stmt\Class_) {
18
-            foreach ($node->stmts as $stmt) {
19
-                if ($stmt instanceof Node\Stmt\ClassMethod && $stmt->name === '__construct') {
17
+        if ($node instanceof Node\Stmt\Class_){
18
+            foreach ($node->stmts as $stmt){
19
+                if ($stmt instanceof Node\Stmt\ClassMethod && $stmt->name === '__construct'){
20 20
                     return $stmt;
21 21
                 }
22 22
             }
23 23
             return NodeTraverser::DONT_TRAVERSE_CHILDREN;
24 24
         }
25 25
 
26
-        if ($node instanceof Node\Expr\Variable) {
26
+        if ($node instanceof Node\Expr\Variable){
27 27
             $this->vars[] = $node->name;
28 28
         }
29 29
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,16 +14,20 @@
 block discarded – undo
14 14
 
15 15
     public function enterNode(Node $node): int|Node\Stmt\ClassMethod|null
16 16
     {
17
-        if ($node instanceof Node\Stmt\Class_) {
18
-            foreach ($node->stmts as $stmt) {
19
-                if ($stmt instanceof Node\Stmt\ClassMethod && $stmt->name === '__construct') {
17
+        if ($node instanceof Node\Stmt\Class_)
18
+        {
19
+            foreach ($node->stmts as $stmt)
20
+            {
21
+                if ($stmt instanceof Node\Stmt\ClassMethod && $stmt->name === '__construct')
22
+                {
20 23
                     return $stmt;
21 24
                 }
22 25
             }
23 26
             return NodeTraverser::DONT_TRAVERSE_CHILDREN;
24 27
         }
25 28
 
26
-        if ($node instanceof Node\Expr\Variable) {
29
+        if ($node instanceof Node\Expr\Variable)
30
+        {
27 31
             $this->vars[] = $node->name;
28 32
         }
29 33
 
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
@@ -16,8 +16,8 @@
 block discarded – undo
16 16
 
17 17
     public function enterNode(Node $node): void
18 18
     {
19
-        if ($node instanceof Node\Stmt\Use_) {
20
-            foreach ($node->uses as $use) {
19
+        if ($node instanceof Node\Stmt\Use_){
20
+            foreach ($node->uses as $use){
21 21
                 $this->imports[] = [
22 22
                     'name'  => \implode('\\', $use->name->parts),
23 23
                     '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
@@ -16,8 +16,10 @@
 block discarded – undo
16 16
 
17 17
     public function enterNode(Node $node): void
18 18
     {
19
-        if ($node instanceof Node\Stmt\Use_) {
20
-            foreach ($node->uses as $use) {
19
+        if ($node instanceof Node\Stmt\Use_)
20
+        {
21
+            foreach ($node->uses as $use)
22
+            {
21 23
                 $this->imports[] = [
22 24
                     'name'  => \implode('\\', $use->name->parts),
23 25
                     'alias' => $use->alias->name ?? null,
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
@@ -15,11 +15,11 @@
 block discarded – undo
15 15
 
16 16
     public function enterNode(Node $node): ?int
17 17
     {
18
-        if ($node instanceof Node\Stmt\Namespace_) {
18
+        if ($node instanceof Node\Stmt\Namespace_){
19 19
             $this->namespace = \implode('\\', $node->name->parts);
20 20
         }
21 21
 
22
-        if ($node instanceof Node\Stmt\Class_) {
22
+        if ($node instanceof Node\Stmt\Class_){
23 23
             $this->class = $node->name->name;
24 24
 
25 25
             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
@@ -15,11 +15,13 @@
 block discarded – undo
15 15
 
16 16
     public function enterNode(Node $node): ?int
17 17
     {
18
-        if ($node instanceof Node\Stmt\Namespace_) {
18
+        if ($node instanceof Node\Stmt\Namespace_)
19
+        {
19 20
             $this->namespace = \implode('\\', $node->name->parts);
20 21
         }
21 22
 
22
-        if ($node instanceof Node\Stmt\Class_) {
23
+        if ($node instanceof Node\Stmt\Class_)
24
+        {
23 25
             $this->class = $node->name->name;
24 26
 
25 27
             return NodeTraverser::STOP_TRAVERSAL;
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/AddProperty.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
         private readonly ClassNode $definition,
19 19
         private readonly bool $useTypedProperties = false,
20 20
         private readonly bool $noPhpDoc = false
21
-    ) {
21
+    ){
22 22
     }
23 23
 
24 24
     public function leaveNode(Node $node): ?Node
25 25
     {
26
-        if (!$node instanceof Node\Stmt\Class_) {
26
+        if (!$node instanceof Node\Stmt\Class_){
27 27
             return null;
28 28
         }
29 29
 
30 30
         $nodes = [];
31
-        foreach ($this->definition->dependencies as $dependency) {
31
+        foreach ($this->definition->dependencies as $dependency){
32 32
             $nodes[] = $this->buildProperty($dependency);
33 33
         }
34 34
 
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 
41 41
     private function definePlacementID(Node\Stmt\Class_ $node): int
42 42
     {
43
-        foreach ($node->stmts as $index => $child) {
44
-            if ($child instanceof Node\Stmt\ClassMethod || $child instanceof Node\Stmt\Property) {
43
+        foreach ($node->stmts as $index => $child){
44
+            if ($child instanceof Node\Stmt\ClassMethod || $child instanceof Node\Stmt\Property){
45 45
                 return $index;
46 46
             }
47 47
         }
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
         $b = new Property($dependency->property);
55 55
         $b->makePrivate();
56 56
 
57
-        if ($this->useTypedProperty()) {
57
+        if ($this->useTypedProperty()){
58 58
             $b->setType($this->getPropertyType($dependency));
59 59
         }
60 60
 
61
-        if ($this->renderDoc()) {
61
+        if ($this->renderDoc()){
62 62
             $b->setDocComment(new Doc(\sprintf('/** @var %s */', $this->getPropertyType($dependency))));
63 63
         }
64 64
 
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 
78 78
     private function getPropertyType(Dependency $dependency): string
79 79
     {
80
-        foreach ($this->definition->getStmts() as $stmt) {
81
-            if (($stmt->name === $dependency->type->fullName) && $stmt->alias) {
80
+        foreach ($this->definition->getStmts() as $stmt){
81
+            if (($stmt->name === $dependency->type->fullName) && $stmt->alias){
82 82
                 return $stmt->alias;
83 83
             }
84 84
         }
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,12 +23,14 @@  discard block
 block discarded – undo
23 23
 
24 24
     public function leaveNode(Node $node): ?Node
25 25
     {
26
-        if (!$node instanceof Node\Stmt\Class_) {
26
+        if (!$node instanceof Node\Stmt\Class_)
27
+        {
27 28
             return null;
28 29
         }
29 30
 
30 31
         $nodes = [];
31
-        foreach ($this->definition->dependencies as $dependency) {
32
+        foreach ($this->definition->dependencies as $dependency)
33
+        {
32 34
             $nodes[] = $this->buildProperty($dependency);
33 35
         }
34 36
 
@@ -40,8 +42,10 @@  discard block
 block discarded – undo
40 42
 
41 43
     private function definePlacementID(Node\Stmt\Class_ $node): int
42 44
     {
43
-        foreach ($node->stmts as $index => $child) {
44
-            if ($child instanceof Node\Stmt\ClassMethod || $child instanceof Node\Stmt\Property) {
45
+        foreach ($node->stmts as $index => $child)
46
+        {
47
+            if ($child instanceof Node\Stmt\ClassMethod || $child instanceof Node\Stmt\Property)
48
+            {
45 49
                 return $index;
46 50
             }
47 51
         }
@@ -54,11 +58,13 @@  discard block
 block discarded – undo
54 58
         $b = new Property($dependency->property);
55 59
         $b->makePrivate();
56 60
 
57
-        if ($this->useTypedProperty()) {
61
+        if ($this->useTypedProperty())
62
+        {
58 63
             $b->setType($this->getPropertyType($dependency));
59 64
         }
60 65
 
61
-        if ($this->renderDoc()) {
66
+        if ($this->renderDoc())
67
+        {
62 68
             $b->setDocComment(new Doc(\sprintf('/** @var %s */', $this->getPropertyType($dependency))));
63 69
         }
64 70
 
@@ -77,8 +83,10 @@  discard block
 block discarded – undo
77 83
 
78 84
     private function getPropertyType(Dependency $dependency): string
79 85
     {
80
-        foreach ($this->definition->getStmts() as $stmt) {
81
-            if (($stmt->name === $dependency->type->fullName) && $stmt->alias) {
86
+        foreach ($this->definition->getStmts() as $stmt)
87
+        {
88
+            if (($stmt->name === $dependency->type->fullName) && $stmt->alias)
89
+            {
82 90
                 return $stmt->alias;
83 91
             }
84 92
         }
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/RemoveTrait.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,28 +15,28 @@
 block discarded – undo
15 15
  */
16 16
 final class RemoveTrait extends NodeVisitorAbstract
17 17
 {
18
-    public function leaveNode(Node $node): int|Node|null
18
+    public function leaveNode(Node $node): int | Node | null
19 19
     {
20
-        if (!$node instanceof Node\Stmt\TraitUse) {
20
+        if (!$node instanceof Node\Stmt\TraitUse){
21 21
             return null;
22 22
         }
23 23
 
24
-        foreach ($node->traits as $index => $use) {
25
-            if ($use instanceof Node\Name) {
24
+        foreach ($node->traits as $index => $use){
25
+            if ($use instanceof Node\Name){
26 26
                 $name = $this->trimSlashes(\implode('\\', $use->parts));
27 27
                 if (
28 28
                     \in_array($name, [
29 29
                         $this->trimSlashes(PrototypeTrait::class),
30 30
                         Utils::shortName(PrototypeTrait::class),
31 31
                     ], true)
32
-                ) {
32
+                ){
33 33
                     unset($node->traits[$index]);
34 34
                 }
35 35
             }
36 36
         }
37 37
 
38 38
         $node->traits = \array_values($node->traits);
39
-        if (empty($node->traits)) {
39
+        if (empty($node->traits)){
40 40
             return NodeTraverser::REMOVE_NODE;
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
@@ -17,12 +17,15 @@  discard block
 block discarded – undo
17 17
 {
18 18
     public function leaveNode(Node $node): int|Node|null
19 19
     {
20
-        if (!$node instanceof Node\Stmt\TraitUse) {
20
+        if (!$node instanceof Node\Stmt\TraitUse)
21
+        {
21 22
             return null;
22 23
         }
23 24
 
24
-        foreach ($node->traits as $index => $use) {
25
-            if ($use instanceof Node\Name) {
25
+        foreach ($node->traits as $index => $use)
26
+        {
27
+            if ($use instanceof Node\Name)
28
+            {
26 29
                 $name = $this->trimSlashes(\implode('\\', $use->parts));
27 30
                 if (
28 31
                     \in_array($name, [
@@ -36,7 +39,8 @@  discard block
 block discarded – undo
36 39
         }
37 40
 
38 41
         $node->traits = \array_values($node->traits);
39
-        if (empty($node->traits)) {
42
+        if (empty($node->traits))
43
+        {
40 44
             return NodeTraverser::REMOVE_NODE;
41 45
         }
42 46
 
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/RemoveUse.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,19 +14,19 @@
 block discarded – undo
14 14
  */
15 15
 final class RemoveUse extends NodeVisitorAbstract
16 16
 {
17
-    public function leaveNode(Node $node): int|Node|null
17
+    public function leaveNode(Node $node): int | Node | null
18 18
     {
19
-        if (!$node instanceof Node\Stmt\Use_) {
19
+        if (!$node instanceof Node\Stmt\Use_){
20 20
             return null;
21 21
         }
22 22
 
23
-        foreach ($node->uses as $index => $use) {
24
-            if ($use->name->toString() === PrototypeTrait::class) {
23
+        foreach ($node->uses as $index => $use){
24
+            if ($use->name->toString() === PrototypeTrait::class){
25 25
                 unset($node->uses[$index]);
26 26
             }
27 27
         }
28 28
 
29
-        if (empty($node->uses)) {
29
+        if (empty($node->uses)){
30 30
             return NodeTraverser::REMOVE_NODE;
31 31
         }
32 32
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,17 +16,21 @@
 block discarded – undo
16 16
 {
17 17
     public function leaveNode(Node $node): int|Node|null
18 18
     {
19
-        if (!$node instanceof Node\Stmt\Use_) {
19
+        if (!$node instanceof Node\Stmt\Use_)
20
+        {
20 21
             return null;
21 22
         }
22 23
 
23
-        foreach ($node->uses as $index => $use) {
24
-            if ($use->name->toString() === PrototypeTrait::class) {
24
+        foreach ($node->uses as $index => $use)
25
+        {
26
+            if ($use->name->toString() === PrototypeTrait::class)
27
+            {
25 28
                 unset($node->uses[$index]);
26 29
             }
27 30
         }
28 31
 
29
-        if (empty($node->uses)) {
32
+        if (empty($node->uses))
33
+        {
30 34
             return NodeTraverser::REMOVE_NODE;
31 35
         }
32 36
 
Please login to merge, or discard this patch.
src/Prototype/src/PrototypeRegistry.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
     public function __construct(
20 20
         private readonly ContainerInterface $container
21
-    ) {
21
+    ){
22 22
     }
23 23
 
24 24
     /**
@@ -40,18 +40,18 @@  discard block
 block discarded – undo
40 40
     /**
41 41
      * Resolves the name of prototype dependency into target class name.
42 42
      */
43
-    public function resolveProperty(string $name): Dependency|ContainerExceptionInterface|null
43
+    public function resolveProperty(string $name): Dependency | ContainerExceptionInterface | null
44 44
     {
45 45
         $dependency = $this->dependencies[$name] ?? null;
46
-        if ($dependency === null) {
46
+        if ($dependency === null){
47 47
             return null;
48 48
         }
49 49
 
50
-        try {
50
+        try{
51 51
             $this->container->get($dependency->type->name());
52 52
 
53 53
             return $dependency;
54
-        } catch (ContainerExceptionInterface $e) {
54
+        }catch (ContainerExceptionInterface $e){
55 55
             return $e;
56 56
         }
57 57
     }
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,15 +43,19 @@
 block discarded – undo
43 43
     public function resolveProperty(string $name): Dependency|ContainerExceptionInterface|null
44 44
     {
45 45
         $dependency = $this->dependencies[$name] ?? null;
46
-        if ($dependency === null) {
46
+        if ($dependency === null)
47
+        {
47 48
             return null;
48 49
         }
49 50
 
50
-        try {
51
+        try
52
+        {
51 53
             $this->container->get($dependency->type->name());
52 54
 
53 55
             return $dependency;
54
-        } catch (ContainerExceptionInterface $e) {
56
+        }
57
+        catch (ContainerExceptionInterface $e)
58
+        {
55 59
             return $e;
56 60
         }
57 61
     }
Please login to merge, or discard this patch.
src/Prototype/src/Traits/PrototypeTrait.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     public function __get(string $name): mixed
24 24
     {
25 25
         $container = ContainerScope::getContainer();
26
-        if ($container === null || !$container->has(PrototypeRegistry::class)) {
26
+        if ($container === null || !$container->has(PrototypeRegistry::class)){
27 27
             throw new ScopeException(
28 28
                 \sprintf('Unable to resolve prototyped dependency `%s`, invalid container scope', $name)
29 29
             );
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             $target === null ||
38 38
             $target instanceof \Throwable ||
39 39
             $target->type->fullName === null
40
-        ) {
40
+        ){
41 41
             throw new PrototypeException(
42 42
                 \sprintf('Undefined prototype property `%s`', $name),
43 43
                 0,
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,8 @@
 block discarded – undo
23 23
     public function __get(string $name): mixed
24 24
     {
25 25
         $container = ContainerScope::getContainer();
26
-        if ($container === null || !$container->has(PrototypeRegistry::class)) {
26
+        if ($container === null || !$container->has(PrototypeRegistry::class))
27
+        {
27 28
             throw new ScopeException(
28 29
                 \sprintf('Unable to resolve prototyped dependency `%s`, invalid container scope', $name)
29 30
             );
Please login to merge, or discard this patch.