Test Failed
Pull Request — master (#1190)
by butschster
10:27
created
src/Core/src/Internal/Resolver/ResolvingState.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
     public function __construct(
24 24
         public readonly ReflectionFunctionAbstract $reflection,
25 25
         private array $arguments,
26
-    ) {
26
+    ){
27 27
         $this->modeNamed = $this->isNamedMode();
28 28
     }
29 29
 
30 30
     public function addResolvedValue(mixed &$value, ?string $key = null): void
31 31
     {
32
-        if ($key === null) {
32
+        if ($key === null){
33 33
             $this->resolvedValues[] = &$value;
34
-        } else {
34
+        }else{
35 35
             $this->resolvedValues[$key] = &$value;
36 36
         }
37 37
     }
@@ -42,25 +42,25 @@  discard block
 block discarded – undo
42 42
             ? $parameter->getName()
43 43
             : $parameter->getPosition();
44 44
 
45
-        if (!\array_key_exists($key, $this->arguments)) {
45
+        if (!\array_key_exists($key, $this->arguments)){
46 46
             return [];
47 47
         }
48 48
         $_val = &$this->arguments[$key];
49 49
 
50
-        if ($variadic && \is_array($_val)) {
50
+        if ($variadic && \is_array($_val)){
51 51
             // Save keys is possible
52 52
             $positional = true;
53 53
             $result = [];
54
-            foreach ($_val as $key => &$item) {
55
-                if (!$positional && \is_int($key)) {
54
+            foreach ($_val as $key => &$item){
55
+                if (!$positional && \is_int($key)){
56 56
                     throw new ResolvingException(
57 57
                         'Cannot use positional argument after named argument during unpacking named variadic argument.'
58 58
                     );
59 59
                 }
60 60
                 $positional = $positional && \is_int($key);
61
-                if ($positional) {
61
+                if ($positional){
62 62
                     $result[] = &$item;
63
-                } else {
63
+                }else{
64 64
                     $result[$key] = &$item;
65 65
                 }
66 66
             }
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
     {
79 79
         $nums = 0;
80 80
         $strings = 0;
81
-        foreach ($this->arguments as $key => $_) {
82
-            if (\is_int($key)) {
81
+        foreach ($this->arguments as $key => $_){
82
+            if (\is_int($key)){
83 83
                 ++$nums;
84
-            } else {
84
+            }else{
85 85
                 ++$strings;
86 86
             }
87 87
         }
Please login to merge, or discard this patch.
Braces   +25 added lines, -11 removed lines patch added patch discarded remove patch
@@ -29,9 +29,12 @@  discard block
 block discarded – undo
29 29
 
30 30
     public function addResolvedValue(mixed &$value, ?string $key = null): void
31 31
     {
32
-        if ($key === null) {
32
+        if ($key === null)
33
+        {
33 34
             $this->resolvedValues[] = &$value;
34
-        } else {
35
+        }
36
+        else
37
+        {
35 38
             $this->resolvedValues[$key] = &$value;
36 39
         }
37 40
     }
@@ -42,25 +45,32 @@  discard block
 block discarded – undo
42 45
             ? $parameter->getName()
43 46
             : $parameter->getPosition();
44 47
 
45
-        if (!\array_key_exists($key, $this->arguments)) {
48
+        if (!\array_key_exists($key, $this->arguments))
49
+        {
46 50
             return [];
47 51
         }
48 52
         $_val = &$this->arguments[$key];
49 53
 
50
-        if ($variadic && \is_array($_val)) {
54
+        if ($variadic && \is_array($_val))
55
+        {
51 56
             // Save keys is possible
52 57
             $positional = true;
53 58
             $result = [];
54
-            foreach ($_val as $key => &$item) {
55
-                if (!$positional && \is_int($key)) {
59
+            foreach ($_val as $key => &$item)
60
+            {
61
+                if (!$positional && \is_int($key))
62
+                {
56 63
                     throw new ResolvingException(
57 64
                         'Cannot use positional argument after named argument during unpacking named variadic argument.'
58 65
                     );
59 66
                 }
60 67
                 $positional = $positional && \is_int($key);
61
-                if ($positional) {
68
+                if ($positional)
69
+                {
62 70
                     $result[] = &$item;
63
-                } else {
71
+                }
72
+                else
73
+                {
64 74
                     $result[$key] = &$item;
65 75
                 }
66 76
             }
@@ -78,10 +88,14 @@  discard block
 block discarded – undo
78 88
     {
79 89
         $nums = 0;
80 90
         $strings = 0;
81
-        foreach ($this->arguments as $key => $_) {
82
-            if (\is_int($key)) {
91
+        foreach ($this->arguments as $key => $_)
92
+        {
93
+            if (\is_int($key))
94
+            {
83 95
                 ++$nums;
84
-            } else {
96
+            }
97
+            else
98
+            {
85 99
                 ++$strings;
86 100
             }
87 101
         }
Please login to merge, or discard this patch.
src/Framework/Auth/Session/TokenStorage.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -19,28 +19,28 @@  discard block
 block discarded – undo
19 19
 
20 20
     public function __construct(
21 21
         private readonly SessionScope $session
22
-    ) {
22
+    ){
23 23
     }
24 24
 
25 25
     public function load(string $id): ?TokenInterface
26 26
     {
27
-        try {
27
+        try{
28 28
             $tokenData = $this->session->getSection(self::SESSION_SECTION)->get('token');
29
-            if ($tokenData === null) {
29
+            if ($tokenData === null){
30 30
                 return null;
31 31
             }
32 32
 
33 33
             $token = Token::unpack($tokenData);
34
-        } catch (\Throwable $e) {
35
-            throw new TokenStorageException('Unable to load session token', (int) $e->getCode(), $e);
34
+        }catch (\Throwable $e){
35
+            throw new TokenStorageException('Unable to load session token', (int)$e->getCode(), $e);
36 36
         }
37 37
 
38
-        if (!\hash_equals($token->getID(), $id)) {
38
+        if (!\hash_equals($token->getID(), $id)){
39 39
             return null;
40 40
         }
41 41
 
42 42
         $expiresAt = $token->getExpiresAt();
43
-        if ($expiresAt !== null && $expiresAt < new \DateTimeImmutable()) {
43
+        if ($expiresAt !== null && $expiresAt < new \DateTimeImmutable()){
44 44
             $this->delete($token);
45 45
             return null;
46 46
         }
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 
51 51
     public function create(array $payload, ?\DateTimeInterface $expiresAt = null): TokenInterface
52 52
     {
53
-        try {
53
+        try{
54 54
             $token = new Token($this->randomHash(128), $payload, $expiresAt);
55 55
             $this->session->getSection(self::SESSION_SECTION)->set('token', $token->pack());
56 56
 
57 57
             return $token;
58
-        } catch (\Throwable $e) {
59
-            throw new TokenStorageException('Unable to create session token', (int) $e->getCode(), $e);
58
+        }catch (\Throwable $e){
59
+            throw new TokenStorageException('Unable to create session token', (int)$e->getCode(), $e);
60 60
         }
61 61
     }
62 62
 
Please login to merge, or discard this patch.
Braces   +16 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,23 +24,29 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function load(string $id): ?TokenInterface
26 26
     {
27
-        try {
27
+        try
28
+        {
28 29
             $tokenData = $this->session->getSection(self::SESSION_SECTION)->get('token');
29
-            if ($tokenData === null) {
30
+            if ($tokenData === null)
31
+            {
30 32
                 return null;
31 33
             }
32 34
 
33 35
             $token = Token::unpack($tokenData);
34
-        } catch (\Throwable $e) {
36
+        }
37
+        catch (\Throwable $e)
38
+        {
35 39
             throw new TokenStorageException('Unable to load session token', (int) $e->getCode(), $e);
36 40
         }
37 41
 
38
-        if (!\hash_equals($token->getID(), $id)) {
42
+        if (!\hash_equals($token->getID(), $id))
43
+        {
39 44
             return null;
40 45
         }
41 46
 
42 47
         $expiresAt = $token->getExpiresAt();
43
-        if ($expiresAt !== null && $expiresAt < new \DateTimeImmutable()) {
48
+        if ($expiresAt !== null && $expiresAt < new \DateTimeImmutable())
49
+        {
44 50
             $this->delete($token);
45 51
             return null;
46 52
         }
@@ -50,12 +56,15 @@  discard block
 block discarded – undo
50 56
 
51 57
     public function create(array $payload, ?\DateTimeInterface $expiresAt = null): TokenInterface
52 58
     {
53
-        try {
59
+        try
60
+        {
54 61
             $token = new Token($this->randomHash(128), $payload, $expiresAt);
55 62
             $this->session->getSection(self::SESSION_SECTION)->set('token', $token->pack());
56 63
 
57 64
             return $token;
58
-        } catch (\Throwable $e) {
65
+        }
66
+        catch (\Throwable $e)
67
+        {
59 68
             throw new TokenStorageException('Unable to create session token', (int) $e->getCode(), $e);
60 69
         }
61 70
     }
Please login to merge, or discard this patch.
src/Framework/Command/Views/CompileCommand.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
         $generator = new ContextGenerator($views->getContext());
26 26
 
27 27
         $contexts = $generator->generate();
28
-        if (empty($contexts)) {
28
+        if (empty($contexts)){
29 29
             $contexts[] = $views->getContext();
30 30
         }
31 31
 
32
-        foreach ($contexts as $context) {
33
-            foreach ($views->getEngines() as $engine) {
34
-                if ($engine instanceof NativeEngine) {
32
+        foreach ($contexts as $context){
33
+            foreach ($views->getEngines() as $engine){
34
+                if ($engine instanceof NativeEngine){
35 35
                     // no need to compile
36 36
                     continue;
37 37
                 }
@@ -53,19 +53,19 @@  discard block
 block discarded – undo
53 53
             $this->describeContext($context) ?? 'default'
54 54
         );
55 55
 
56
-        foreach ($engine->getLoader()->list() as $path) {
56
+        foreach ($engine->getLoader()->list() as $path){
57 57
             $start = \microtime(true);
58
-            try {
58
+            try{
59 59
                 $engine->reset($path, $context);
60 60
                 $engine->compile($path, $context);
61 61
 
62
-                if ($this->isVerbose()) {
62
+                if ($this->isVerbose()){
63 63
                     $this->sprintf('<info>•</info> %s', $path);
64 64
                 }
65
-            } catch (\Throwable $e) {
65
+            }catch (\Throwable $e){
66 66
                 $this->renderError($path, $e);
67 67
                 continue;
68
-            } finally {
68
+            }finally{
69 69
                 $this->renderElapsed($start);
70 70
             }
71 71
         }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
     protected function renderError(string $path, \Throwable $e): void
77 77
     {
78
-        if (!$this->isVerbose()) {
78
+        if (!$this->isVerbose()){
79 79
             return;
80 80
         }
81 81
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     {
92 92
         $values = [];
93 93
 
94
-        foreach ($context->getDependencies() as $dependency) {
94
+        foreach ($context->getDependencies() as $dependency){
95 95
             $values[] = \sprintf(
96 96
                 '%s%s%s:%s%s%s',
97 97
                 Color::LIGHT_WHITE,
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
 
114 114
     private function renderSuccess(?string $lastPath = null): void
115 115
     {
116
-        if (!$this->isVerbose()) {
116
+        if (!$this->isVerbose()){
117 117
             return;
118 118
         }
119 119
 
120
-        if ($lastPath === null) {
120
+        if ($lastPath === null){
121 121
             $this->writeln('• no views found');
122 122
         }
123 123
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
     private function renderElapsed(float $start): void
128 128
     {
129
-        if (!$this->isVerbose()) {
129
+        if (!$this->isVerbose()){
130 130
             return;
131 131
         }
132 132
 
Please login to merge, or discard this patch.
Braces   +30 added lines, -14 removed lines patch added patch discarded remove patch
@@ -25,13 +25,17 @@  discard block
 block discarded – undo
25 25
         $generator = new ContextGenerator($views->getContext());
26 26
 
27 27
         $contexts = $generator->generate();
28
-        if (empty($contexts)) {
28
+        if (empty($contexts))
29
+        {
29 30
             $contexts[] = $views->getContext();
30 31
         }
31 32
 
32
-        foreach ($contexts as $context) {
33
-            foreach ($views->getEngines() as $engine) {
34
-                if ($engine instanceof NativeEngine) {
33
+        foreach ($contexts as $context)
34
+        {
35
+            foreach ($views->getEngines() as $engine)
36
+            {
37
+                if ($engine instanceof NativeEngine)
38
+                {
35 39
                     // no need to compile
36 40
                     continue;
37 41
                 }
@@ -53,19 +57,26 @@  discard block
 block discarded – undo
53 57
             $this->describeContext($context) ?? 'default'
54 58
         );
55 59
 
56
-        foreach ($engine->getLoader()->list() as $path) {
60
+        foreach ($engine->getLoader()->list() as $path)
61
+        {
57 62
             $start = \microtime(true);
58
-            try {
63
+            try
64
+            {
59 65
                 $engine->reset($path, $context);
60 66
                 $engine->compile($path, $context);
61 67
 
62
-                if ($this->isVerbose()) {
68
+                if ($this->isVerbose())
69
+                {
63 70
                     $this->sprintf('<info>•</info> %s', $path);
64 71
                 }
65
-            } catch (\Throwable $e) {
72
+            }
73
+            catch (\Throwable $e)
74
+            {
66 75
                 $this->renderError($path, $e);
67 76
                 continue;
68
-            } finally {
77
+            }
78
+            finally
79
+            {
69 80
                 $this->renderElapsed($start);
70 81
             }
71 82
         }
@@ -75,7 +86,8 @@  discard block
 block discarded – undo
75 86
 
76 87
     protected function renderError(string $path, \Throwable $e): void
77 88
     {
78
-        if (!$this->isVerbose()) {
89
+        if (!$this->isVerbose())
90
+        {
79 91
             return;
80 92
         }
81 93
 
@@ -91,7 +103,8 @@  discard block
 block discarded – undo
91 103
     {
92 104
         $values = [];
93 105
 
94
-        foreach ($context->getDependencies() as $dependency) {
106
+        foreach ($context->getDependencies() as $dependency)
107
+        {
95 108
             $values[] = \sprintf(
96 109
                 '%s%s%s:%s%s%s',
97 110
                 Color::LIGHT_WHITE,
@@ -113,11 +126,13 @@  discard block
 block discarded – undo
113 126
 
114 127
     private function renderSuccess(?string $lastPath = null): void
115 128
     {
116
-        if (!$this->isVerbose()) {
129
+        if (!$this->isVerbose())
130
+        {
117 131
             return;
118 132
         }
119 133
 
120
-        if ($lastPath === null) {
134
+        if ($lastPath === null)
135
+        {
121 136
             $this->writeln('• no views found');
122 137
         }
123 138
 
@@ -126,7 +141,8 @@  discard block
 block discarded – undo
126 141
 
127 142
     private function renderElapsed(float $start): void
128 143
     {
129
-        if (!$this->isVerbose()) {
144
+        if (!$this->isVerbose())
145
+        {
130 146
             return;
131 147
         }
132 148
 
Please login to merge, or discard this patch.
src/Stempler/tests/Transform/BaseTestCase.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 {
28 28
     protected function compile(string $source, array $visitors = [], ?LoaderInterface $loader = null)
29 29
     {
30
-        if ($loader === null) {
30
+        if ($loader === null){
31 31
             $loader = new StringLoader();
32 32
             $loader->set('root', $source);
33 33
         }
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
         $builder->getCompiler()->addRenderer(new DynamicRenderer(new DirectiveGroup()));
63 63
         $builder->getCompiler()->addRenderer(new HTMLRenderer());
64 64
 
65
-        foreach ($this->getVisitors() as $visitor) {
65
+        foreach ($this->getVisitors() as $visitor){
66 66
             $builder->addVisitor($visitor);
67 67
         }
68 68
 
69
-        foreach ($visitors as $visitor) {
69
+        foreach ($visitors as $visitor){
70 70
             $builder->addVisitor($visitor);
71 71
         }
72 72
 
@@ -80,6 +80,6 @@  discard block
 block discarded – undo
80 80
 
81 81
     protected function getFixtureLoader(): LoaderInterface
82 82
     {
83
-        return new DirectoryLoader(__DIR__ . '/../fixtures');
83
+        return new DirectoryLoader(__DIR__.'/../fixtures');
84 84
     }
85 85
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,8 @@  discard block
 block discarded – undo
27 27
 {
28 28
     protected function compile(string $source, array $visitors = [], ?LoaderInterface $loader = null)
29 29
     {
30
-        if ($loader === null) {
30
+        if ($loader === null)
31
+        {
31 32
             $loader = new StringLoader();
32 33
             $loader->set('root', $source);
33 34
         }
@@ -62,11 +63,13 @@  discard block
 block discarded – undo
62 63
         $builder->getCompiler()->addRenderer(new DynamicRenderer(new DirectiveGroup()));
63 64
         $builder->getCompiler()->addRenderer(new HTMLRenderer());
64 65
 
65
-        foreach ($this->getVisitors() as $visitor) {
66
+        foreach ($this->getVisitors() as $visitor)
67
+        {
66 68
             $builder->addVisitor($visitor);
67 69
         }
68 70
 
69
-        foreach ($visitors as $visitor) {
71
+        foreach ($visitors as $visitor)
72
+        {
70 73
             $builder->addVisitor($visitor);
71 74
         }
72 75
 
Please login to merge, or discard this patch.
src/Stempler/src/Transform/Import/Directory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,16 +22,16 @@
 block discarded – undo
22 22
         public string $path,
23 23
         ?string $prefix,
24 24
         ?Context $context = null
25
-    ) {
25
+    ){
26 26
         $this->prefix = $prefix ?? \substr($path, \strrpos($path, '/') + 1);
27 27
         $this->context = $context;
28 28
     }
29 29
 
30 30
     public function resolve(Builder $builder, string $name): ?Template
31 31
     {
32
-        $path = \substr($name, \strlen((string) $this->prefix) + 1);
32
+        $path = \substr($name, \strlen((string)$this->prefix) + 1);
33 33
         $path = \str_replace('.', DIRECTORY_SEPARATOR, $path);
34 34
 
35
-        return $builder->load($this->path . DIRECTORY_SEPARATOR . $path);
35
+        return $builder->load($this->path.DIRECTORY_SEPARATOR.$path);
36 36
     }
37 37
 }
Please login to merge, or discard this patch.
src/Stempler/src/Transform/Context/StackContext.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 {
14 14
     private function __construct(
15 15
         private readonly VisitorContext $ctx
16
-    ) {
16
+    ){
17 17
     }
18 18
 
19 19
     public function register(Aggregate $aggregate, int $level = 0): void
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function push(string $name, Tag $child, ?string $uniqueID = null): bool
30 30
     {
31
-        foreach ($this->getStacks() as $stack) {
32
-            if ($stack->accepts($name) !== $name) {
31
+        foreach ($this->getStacks() as $stack){
32
+            if ($stack->accepts($name) !== $name){
33 33
                 continue;
34 34
             }
35 35
 
36
-            if ($uniqueID !== null && isset($stack->uniqueIDs[$uniqueID])) {
36
+            if ($uniqueID !== null && isset($stack->uniqueIDs[$uniqueID])){
37 37
                 return true;
38 38
             }
39 39
             $stack->uniqueIDs[$uniqueID] = true;
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
              * @link https://github.com/spiral/framework/issues/767
44 44
              * @psalm-suppress NoInterfaceProperties
45 45
              */
46
-            foreach ($child->nodes as $child) {
46
+            foreach ($child->nodes as $child){
47 47
                 $stack->nodes[] = $child;
48 48
             }
49 49
 
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
 
56 56
     public function prepend(string $name, Tag $child, ?string $uniqueID = null): bool
57 57
     {
58
-        foreach ($this->getStacks() as $stack) {
59
-            if ($stack->accepts($name) !== $name) {
58
+        foreach ($this->getStacks() as $stack){
59
+            if ($stack->accepts($name) !== $name){
60 60
                 continue;
61 61
             }
62 62
 
63
-            if ($uniqueID !== null && isset($stack->uniqueIDs[$uniqueID])) {
63
+            if ($uniqueID !== null && isset($stack->uniqueIDs[$uniqueID])){
64 64
                 return true;
65 65
             }
66 66
             $stack->uniqueIDs[$uniqueID] = true;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
              * @link https://github.com/spiral/framework/issues/767
70 70
              * @psalm-suppress NoInterfaceProperties
71 71
              */
72
-            foreach ($child->nodes as $child) {
72
+            foreach ($child->nodes as $child){
73 73
                 \array_unshift($stack->nodes, $child);
74 74
             }
75 75
 
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
     public function getStacks(): array
88 88
     {
89 89
         $stacks = [];
90
-        foreach (\array_reverse($this->ctx->getScope()) as $node) {
91
-            if ($node instanceof AttributedInterface) {
92
-                foreach ($node->getAttribute(self::class, []) as $stack) {
90
+        foreach (\array_reverse($this->ctx->getScope()) as $node){
91
+            if ($node instanceof AttributedInterface){
92
+                foreach ($node->getAttribute(self::class, []) as $stack){
93 93
                     $stacks[] = $stack;
94 94
                 }
95 95
             }
@@ -105,16 +105,16 @@  discard block
 block discarded – undo
105 105
 
106 106
     private function getStackRootNode(int $level): AttributedInterface
107 107
     {
108
-        if ($level === 0) {
108
+        if ($level === 0){
109 109
             $node = $this->ctx->getParentNode();
110
-        } else {
110
+        }else{
111 111
             $scope = $this->ctx->getScope();
112 112
 
113 113
             // looking for the parent node via given nesting level
114 114
             $node = $scope[\count($scope) - 2 - $level] ?? $this->ctx->getFirstNode();
115 115
         }
116 116
 
117
-        if (!$node instanceof AttributedInterface) {
117
+        if (!$node instanceof AttributedInterface){
118 118
             throw new \LogicException(
119 119
                 \sprintf(
120 120
                     'Unable to create import on node without attribute storage (%s)',
Please login to merge, or discard this patch.
Braces   +29 added lines, -14 removed lines patch added patch discarded remove patch
@@ -28,12 +28,15 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function push(string $name, Tag $child, ?string $uniqueID = null): bool
30 30
     {
31
-        foreach ($this->getStacks() as $stack) {
32
-            if ($stack->accepts($name) !== $name) {
31
+        foreach ($this->getStacks() as $stack)
32
+        {
33
+            if ($stack->accepts($name) !== $name)
34
+            {
33 35
                 continue;
34 36
             }
35 37
 
36
-            if ($uniqueID !== null && isset($stack->uniqueIDs[$uniqueID])) {
38
+            if ($uniqueID !== null && isset($stack->uniqueIDs[$uniqueID]))
39
+            {
37 40
                 return true;
38 41
             }
39 42
             $stack->uniqueIDs[$uniqueID] = true;
@@ -43,7 +46,8 @@  discard block
 block discarded – undo
43 46
              * @link https://github.com/spiral/framework/issues/767
44 47
              * @psalm-suppress NoInterfaceProperties
45 48
              */
46
-            foreach ($child->nodes as $child) {
49
+            foreach ($child->nodes as $child)
50
+            {
47 51
                 $stack->nodes[] = $child;
48 52
             }
49 53
 
@@ -55,12 +59,15 @@  discard block
 block discarded – undo
55 59
 
56 60
     public function prepend(string $name, Tag $child, ?string $uniqueID = null): bool
57 61
     {
58
-        foreach ($this->getStacks() as $stack) {
59
-            if ($stack->accepts($name) !== $name) {
62
+        foreach ($this->getStacks() as $stack)
63
+        {
64
+            if ($stack->accepts($name) !== $name)
65
+            {
60 66
                 continue;
61 67
             }
62 68
 
63
-            if ($uniqueID !== null && isset($stack->uniqueIDs[$uniqueID])) {
69
+            if ($uniqueID !== null && isset($stack->uniqueIDs[$uniqueID]))
70
+            {
64 71
                 return true;
65 72
             }
66 73
             $stack->uniqueIDs[$uniqueID] = true;
@@ -69,7 +76,8 @@  discard block
 block discarded – undo
69 76
              * @link https://github.com/spiral/framework/issues/767
70 77
              * @psalm-suppress NoInterfaceProperties
71 78
              */
72
-            foreach ($child->nodes as $child) {
79
+            foreach ($child->nodes as $child)
80
+            {
73 81
                 \array_unshift($stack->nodes, $child);
74 82
             }
75 83
 
@@ -87,9 +95,12 @@  discard block
 block discarded – undo
87 95
     public function getStacks(): array
88 96
     {
89 97
         $stacks = [];
90
-        foreach (\array_reverse($this->ctx->getScope()) as $node) {
91
-            if ($node instanceof AttributedInterface) {
92
-                foreach ($node->getAttribute(self::class, []) as $stack) {
98
+        foreach (\array_reverse($this->ctx->getScope()) as $node)
99
+        {
100
+            if ($node instanceof AttributedInterface)
101
+            {
102
+                foreach ($node->getAttribute(self::class, []) as $stack)
103
+                {
93 104
                     $stacks[] = $stack;
94 105
                 }
95 106
             }
@@ -105,16 +116,20 @@  discard block
 block discarded – undo
105 116
 
106 117
     private function getStackRootNode(int $level): AttributedInterface
107 118
     {
108
-        if ($level === 0) {
119
+        if ($level === 0)
120
+        {
109 121
             $node = $this->ctx->getParentNode();
110
-        } else {
122
+        }
123
+        else
124
+        {
111 125
             $scope = $this->ctx->getScope();
112 126
 
113 127
             // looking for the parent node via given nesting level
114 128
             $node = $scope[\count($scope) - 2 - $level] ?? $this->ctx->getFirstNode();
115 129
         }
116 130
 
117
-        if (!$node instanceof AttributedInterface) {
131
+        if (!$node instanceof AttributedInterface)
132
+        {
118 133
             throw new \LogicException(
119 134
                 \sprintf(
120 135
                     'Unable to create import on node without attribute storage (%s)',
Please login to merge, or discard this patch.
src/Stempler/src/Compiler/Result.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,22 +24,22 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function withinContext(?Context $ctx, callable $body): void
26 26
     {
27
-        if ($ctx === null || $ctx->getPath() === null) {
27
+        if ($ctx === null || $ctx->getPath() === null){
28 28
             $body($this);
29 29
             return;
30 30
         }
31 31
 
32
-        try {
32
+        try{
33 33
             $this->parent = Location::fromContext($ctx, $this->parent);
34 34
             $body($this);
35
-        } finally {
35
+        }finally{
36 36
             $this->parent = $this->parent->parent;
37 37
         }
38 38
     }
39 39
 
40 40
     public function push(string $content, ?Context $ctx = null): void
41 41
     {
42
-        if ($ctx !== null && $ctx->getPath() !== null) {
42
+        if ($ctx !== null && $ctx->getPath() !== null){
43 43
             $this->locations[\strlen($this->content)] = Location::fromContext($ctx, $this->parent);
44 44
         }
45 45
 
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
         $paths = [];
60 60
 
61 61
         // We can scan top level only
62
-        foreach ($this->locations as $loc) {
63
-            if (!\in_array($loc->path, $paths, true)) {
62
+        foreach ($this->locations as $loc){
63
+            if (!\in_array($loc->path, $paths, true)){
64 64
                 $paths[] = $loc->path;
65 65
             }
66 66
         }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     {
76 76
         $locations = [];
77 77
 
78
-        foreach ($this->locations as $offset => $location) {
78
+        foreach ($this->locations as $offset => $location){
79 79
             $locations[$offset] = $location;
80 80
         }
81 81
 
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,22 +24,27 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function withinContext(?Context $ctx, callable $body): void
26 26
     {
27
-        if ($ctx === null || $ctx->getPath() === null) {
27
+        if ($ctx === null || $ctx->getPath() === null)
28
+        {
28 29
             $body($this);
29 30
             return;
30 31
         }
31 32
 
32
-        try {
33
+        try
34
+        {
33 35
             $this->parent = Location::fromContext($ctx, $this->parent);
34 36
             $body($this);
35
-        } finally {
37
+        }
38
+        finally
39
+        {
36 40
             $this->parent = $this->parent->parent;
37 41
         }
38 42
     }
39 43
 
40 44
     public function push(string $content, ?Context $ctx = null): void
41 45
     {
42
-        if ($ctx !== null && $ctx->getPath() !== null) {
46
+        if ($ctx !== null && $ctx->getPath() !== null)
47
+        {
43 48
             $this->locations[\strlen($this->content)] = Location::fromContext($ctx, $this->parent);
44 49
         }
45 50
 
@@ -59,8 +64,10 @@  discard block
 block discarded – undo
59 64
         $paths = [];
60 65
 
61 66
         // We can scan top level only
62
-        foreach ($this->locations as $loc) {
63
-            if (!\in_array($loc->path, $paths, true)) {
67
+        foreach ($this->locations as $loc)
68
+        {
69
+            if (!\in_array($loc->path, $paths, true))
70
+            {
64 71
                 $paths[] = $loc->path;
65 72
             }
66 73
         }
@@ -75,7 +82,8 @@  discard block
 block discarded – undo
75 82
     {
76 83
         $locations = [];
77 84
 
78
-        foreach ($this->locations as $offset => $location) {
85
+        foreach ($this->locations as $offset => $location)
86
+        {
79 87
             $locations[$offset] = $location;
80 88
         }
81 89
 
Please login to merge, or discard this patch.
src/Stempler/src/Exception/Traits/ContextTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
         string $message,
16 16
         private Context $context,
17 17
         ?\Throwable $previous = null
18
-    ) {
18
+    ){
19 19
         parent::__construct($message, 0, $previous);
20 20
     }
21 21
 
Please login to merge, or discard this patch.
src/Stempler/src/Node/Block.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
     public function __construct(
26 26
         public ?string $name,
27 27
         ?Context $context = null
28
-    ) {
28
+    ){
29 29
         $this->context = $context;
30 30
     }
31 31
 
Please login to merge, or discard this patch.