Test Failed
Pull Request — master (#1170)
by Aleksei
19:12 queued 08:18
created
src/Views/src/Exception/CompileException.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@
 block discarded – undo
10 10
 
11 11
     public function __construct(\Throwable $previous = null)
12 12
     {
13
-        parent::__construct((string) $previous?->getMessage(), (int) ($previous?->getCode() ?? 0), $previous);
13
+        parent::__construct((string)$previous?->getMessage(), (int)($previous?->getCode() ?? 0), $previous);
14 14
 
15
-        $this->file = (string) $previous?->getFile();
16
-        $this->line = (int) $previous?->getLine();
15
+        $this->file = (string)$previous?->getFile();
16
+        $this->line = (int)$previous?->getLine();
17 17
     }
18 18
 
19 19
     /**
Please login to merge, or discard this patch.
src/Views/src/Event/ViewNotFound.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,6 +8,6 @@
 block discarded – undo
8 8
 {
9 9
     public function __construct(
10 10
         public readonly string $path,
11
-    ) {
11
+    ){
12 12
     }
13 13
 }
Please login to merge, or discard this patch.
src/Views/src/ViewLoader.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         FilesInterface $files = null,
26 26
         private readonly string $defaultNamespace = self::DEFAULT_NAMESPACE,
27 27
         private readonly ?EventDispatcherInterface $dispatcher = null,
28
-    ) {
28
+    ){
29 29
         $this->files = $files ?? new Files();
30 30
     }
31 31
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function getExtension(): ?string
41 41
     {
42
-        if ($this->parser !== null) {
42
+        if ($this->parser !== null){
43 43
             return $this->parser->getExtension();
44 44
         }
45 45
 
@@ -50,24 +50,24 @@  discard block
 block discarded – undo
50 50
      * @psalm-assert-if-true non-empty-string $filename
51 51
      * @psalm-assert-if-true ViewPath $parsed
52 52
      */
53
-    public function exists(string $path, string &$filename = null, ViewPath &$parsed = null): bool
53
+    public function exists(string $path, string &$filename = null, ViewPath & $parsed = null): bool
54 54
     {
55
-        if (empty($this->parser)) {
55
+        if (empty($this->parser)){
56 56
             throw new LoaderException('Unable to locate view source, no extension has been associated.');
57 57
         }
58 58
 
59 59
         $parsed = $this->parser->parse($path);
60
-        if ($parsed === null) {
60
+        if ($parsed === null){
61 61
             return false;
62 62
         }
63 63
 
64
-        if (!isset($this->namespaces[$parsed->getNamespace()])) {
64
+        if (!isset($this->namespaces[$parsed->getNamespace()])){
65 65
             return false;
66 66
         }
67 67
 
68
-        foreach ((array)$this->namespaces[$parsed->getNamespace()] as $directory) {
68
+        foreach ((array)$this->namespaces[$parsed->getNamespace()] as $directory){
69 69
             $directory = $this->files->normalizePath($directory, true);
70
-            if ($this->files->exists(\sprintf('%s%s', $directory, $parsed->getBasename()))) {
70
+            if ($this->files->exists(\sprintf('%s%s', $directory, $parsed->getBasename()))){
71 71
                 $filename = \sprintf('%s%s', $directory, $parsed->getBasename());
72 72
 
73 73
                 return true;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
     public function load(string $path): ViewSource
81 81
     {
82
-        if (!$this->exists($path, $filename, $parsed)) {
82
+        if (!$this->exists($path, $filename, $parsed)){
83 83
             $this->dispatcher?->dispatch(new ViewNotFound($path));
84 84
 
85 85
             throw new LoaderException(\sprintf('Unable to load view `%s`, file does not exist.', $path));
@@ -94,21 +94,21 @@  discard block
 block discarded – undo
94 94
 
95 95
     public function list(string $namespace = null): array
96 96
     {
97
-        if (empty($this->parser)) {
97
+        if (empty($this->parser)){
98 98
             throw new LoaderException('Unable to list view sources, no extension has been associated.');
99 99
         }
100 100
 
101 101
         $result = [];
102
-        foreach ($this->namespaces as $ns => $directories) {
103
-            if (!empty($namespace) && $namespace != $ns) {
102
+        foreach ($this->namespaces as $ns => $directories){
103
+            if (!empty($namespace) && $namespace != $ns){
104 104
                 continue;
105 105
             }
106 106
 
107
-            foreach ((array)$directories as $directory) {
107
+            foreach ((array)$directories as $directory){
108 108
                 $files = $this->files->getFiles($directory);
109 109
 
110
-                foreach ($files as $filename) {
111
-                    if (!$this->parser->match($filename)) {
110
+                foreach ($files as $filename){
111
+                    if (!$this->parser->match($filename)){
112 112
                         // does not belong to this loader
113 113
                         continue;
114 114
                     }
Please login to merge, or discard this patch.
Braces   +26 added lines, -13 removed lines patch added patch discarded remove patch
@@ -39,7 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function getExtension(): ?string
41 41
     {
42
-        if ($this->parser !== null) {
42
+        if ($this->parser !== null)
43
+        {
43 44
             return $this->parser->getExtension();
44 45
         }
45 46
 
@@ -52,22 +53,27 @@  discard block
 block discarded – undo
52 53
      */
53 54
     public function exists(string $path, string &$filename = null, ViewPath &$parsed = null): bool
54 55
     {
55
-        if (empty($this->parser)) {
56
+        if (empty($this->parser))
57
+        {
56 58
             throw new LoaderException('Unable to locate view source, no extension has been associated.');
57 59
         }
58 60
 
59 61
         $parsed = $this->parser->parse($path);
60
-        if ($parsed === null) {
62
+        if ($parsed === null)
63
+        {
61 64
             return false;
62 65
         }
63 66
 
64
-        if (!isset($this->namespaces[$parsed->getNamespace()])) {
67
+        if (!isset($this->namespaces[$parsed->getNamespace()]))
68
+        {
65 69
             return false;
66 70
         }
67 71
 
68
-        foreach ((array)$this->namespaces[$parsed->getNamespace()] as $directory) {
72
+        foreach ((array)$this->namespaces[$parsed->getNamespace()] as $directory)
73
+        {
69 74
             $directory = $this->files->normalizePath($directory, true);
70
-            if ($this->files->exists(\sprintf('%s%s', $directory, $parsed->getBasename()))) {
75
+            if ($this->files->exists(\sprintf('%s%s', $directory, $parsed->getBasename())))
76
+            {
71 77
                 $filename = \sprintf('%s%s', $directory, $parsed->getBasename());
72 78
 
73 79
                 return true;
@@ -79,7 +85,8 @@  discard block
 block discarded – undo
79 85
 
80 86
     public function load(string $path): ViewSource
81 87
     {
82
-        if (!$this->exists($path, $filename, $parsed)) {
88
+        if (!$this->exists($path, $filename, $parsed))
89
+        {
83 90
             $this->dispatcher?->dispatch(new ViewNotFound($path));
84 91
 
85 92
             throw new LoaderException(\sprintf('Unable to load view `%s`, file does not exist.', $path));
@@ -94,21 +101,27 @@  discard block
 block discarded – undo
94 101
 
95 102
     public function list(string $namespace = null): array
96 103
     {
97
-        if (empty($this->parser)) {
104
+        if (empty($this->parser))
105
+        {
98 106
             throw new LoaderException('Unable to list view sources, no extension has been associated.');
99 107
         }
100 108
 
101 109
         $result = [];
102
-        foreach ($this->namespaces as $ns => $directories) {
103
-            if (!empty($namespace) && $namespace != $ns) {
110
+        foreach ($this->namespaces as $ns => $directories)
111
+        {
112
+            if (!empty($namespace) && $namespace != $ns)
113
+            {
104 114
                 continue;
105 115
             }
106 116
 
107
-            foreach ((array)$directories as $directory) {
117
+            foreach ((array)$directories as $directory)
118
+            {
108 119
                 $files = $this->files->getFiles($directory);
109 120
 
110
-                foreach ($files as $filename) {
111
-                    if (!$this->parser->match($filename)) {
121
+                foreach ($files as $filename)
122
+                {
123
+                    if (!$this->parser->match($filename))
124
+                    {
112 125
                         // does not belong to this loader
113 126
                         continue;
114 127
                     }
Please login to merge, or discard this patch.
src/Views/src/GlobalVariables.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 {
9 9
     public function __construct(
10 10
         private array $variables = []
11
-    ) {
11
+    ){
12 12
     }
13 13
 
14 14
     public function set(string $name, mixed $data): void
Please login to merge, or discard this patch.
src/Views/src/ViewCache.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
     public function reset(ContextInterface $context = null): void
14 14
     {
15
-        if (empty($context)) {
15
+        if (empty($context)){
16 16
             $this->cache = [];
17 17
             return;
18 18
         }
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function resetPath(string $path): void
27 27
     {
28
-        foreach ($this->cache as &$cache) {
28
+        foreach ($this->cache as &$cache){
29 29
             unset($cache[$path], $cache);
30 30
         }
31 31
     }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function get(ContextInterface $context, string $path): ViewInterface
47 47
     {
48
-        if (!$this->has($context, $path)) {
48
+        if (!$this->has($context, $path)){
49 49
             throw new CacheException(\sprintf('No cache is available for %s.', $path));
50 50
         }
51 51
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@  discard block
 block discarded – undo
12 12
 
13 13
     public function reset(ContextInterface $context = null): void
14 14
     {
15
-        if (empty($context)) {
15
+        if (empty($context))
16
+        {
16 17
             $this->cache = [];
17 18
             return;
18 19
         }
@@ -25,7 +26,8 @@  discard block
 block discarded – undo
25 26
      */
26 27
     public function resetPath(string $path): void
27 28
     {
28
-        foreach ($this->cache as &$cache) {
29
+        foreach ($this->cache as &$cache)
30
+        {
29 31
             unset($cache[$path], $cache);
30 32
         }
31 33
     }
@@ -45,7 +47,8 @@  discard block
 block discarded – undo
45 47
      */
46 48
     public function get(ContextInterface $context, string $path): ViewInterface
47 49
     {
48
-        if (!$this->has($context, $path)) {
50
+        if (!$this->has($context, $path))
51
+        {
49 52
             throw new CacheException(\sprintf('No cache is available for %s.', $path));
50 53
         }
51 54
 
Please login to merge, or discard this patch.
src/Views/src/Bootloader/ViewsBootloader.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
 
35 35
     public function __construct(
36 36
         private readonly ConfiguratorInterface $config
37
-    ) {
37
+    ){
38 38
     }
39 39
 
40 40
     public function init(EnvironmentInterface $env, DirectoriesInterface $dirs, DebugMode $debugMode): void
41 41
     {
42
-        if (!$dirs->has('views')) {
43
-            $dirs->set('views', $dirs->get('app') . 'views');
42
+        if (!$dirs->has('views')){
43
+            $dirs->set('views', $dirs->get('app').'views');
44 44
         }
45 45
 
46 46
         // default view config
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             [
50 50
                 'cache' => [
51 51
                     'enabled' => $env->get('VIEW_CACHE', !$debugMode->isEnabled()),
52
-                    'directory' => $dirs->get('cache') . 'views',
52
+                    'directory' => $dirs->get('cache').'views',
53 53
                 ],
54 54
                 'namespaces' => [
55 55
                     'default' => [$dirs->get('views')],
@@ -62,17 +62,17 @@  discard block
 block discarded – undo
62 62
 
63 63
     public function addDirectory(string $namespace, string $directory): void
64 64
     {
65
-        if (!isset($this->config->getConfig(ViewsConfig::CONFIG)['namespaces'][$namespace])) {
65
+        if (!isset($this->config->getConfig(ViewsConfig::CONFIG)['namespaces'][$namespace])){
66 66
             $this->config->modify(ViewsConfig::CONFIG, new Append('namespaces', $namespace, []));
67 67
         }
68 68
 
69 69
         $this->config->modify(
70 70
             ViewsConfig::CONFIG,
71
-            new Append('namespaces.' . $namespace, null, $directory)
71
+            new Append('namespaces.'.$namespace, null, $directory)
72 72
         );
73 73
     }
74 74
 
75
-    public function addEngine(string|EngineInterface $engine): void
75
+    public function addEngine(string | EngineInterface $engine): void
76 76
     {
77 77
         $this->config->modify(
78 78
             ViewsConfig::CONFIG,
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         );
81 81
     }
82 82
 
83
-    public function addCacheDependency(string|DependencyInterface $dependency): void
83
+    public function addCacheDependency(string | DependencyInterface $dependency): void
84 84
     {
85 85
         $this->config->modify(
86 86
             ViewsConfig::CONFIG,
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function init(EnvironmentInterface $env, DirectoriesInterface $dirs, DebugMode $debugMode): void
41 41
     {
42
-        if (!$dirs->has('views')) {
42
+        if (!$dirs->has('views'))
43
+        {
43 44
             $dirs->set('views', $dirs->get('app') . 'views');
44 45
         }
45 46
 
@@ -62,7 +63,8 @@  discard block
 block discarded – undo
62 63
 
63 64
     public function addDirectory(string $namespace, string $directory): void
64 65
     {
65
-        if (!isset($this->config->getConfig(ViewsConfig::CONFIG)['namespaces'][$namespace])) {
66
+        if (!isset($this->config->getConfig(ViewsConfig::CONFIG)['namespaces'][$namespace]))
67
+        {
66 68
             $this->config->modify(ViewsConfig::CONFIG, new Append('namespaces', $namespace, []));
67 69
         }
68 70
 
Please login to merge, or discard this patch.
src/Hmvc/tests/DemoInterceptor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,6 +11,6 @@
 block discarded – undo
11 11
 {
12 12
     public function process(string $controller, string $action, array $parameters, CoreInterface $core): string
13 13
     {
14
-        return '?' . $core->callAction($controller, $action, $parameters) . '!';
14
+        return '?'.$core->callAction($controller, $action, $parameters).'!';
15 15
     }
16 16
 }
Please login to merge, or discard this patch.
src/Hmvc/tests/InterceptorPipelineTest.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 {
16 16
     public function testInterceptorCallingEventShouldBeDispatched(): void
17 17
     {
18
-        $interceptor = new class implements CoreInterceptorInterface {
18
+        $interceptor = new class implements CoreInterceptorInterface{
19 19
             public function process(string $controller, string $action, array $parameters, CoreInterface $core): mixed
20 20
             {
21 21
                 return null;
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         $pipeline = new InterceptorPipeline($dispatcher);
32 32
         $pipeline->addInterceptor($interceptor);
33 33
 
34
-        $pipeline->withCore(new class implements CoreInterface {
34
+        $pipeline->withCore(new class implements CoreInterface{
35 35
             public function callAction(string $controller, string $action, array $parameters = []): mixed
36 36
             {
37 37
                 return null;
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,8 @@  discard block
 block discarded – undo
15 15
 {
16 16
     public function testInterceptorCallingEventShouldBeDispatched(): void
17 17
     {
18
-        $interceptor = new class implements CoreInterceptorInterface {
18
+        $interceptor = new class implements CoreInterceptorInterface
19
+        {
19 20
             public function process(string $controller, string $action, array $parameters, CoreInterface $core): mixed
20 21
             {
21 22
                 return null;
@@ -31,7 +32,8 @@  discard block
 block discarded – undo
31 32
         $pipeline = new InterceptorPipeline($dispatcher);
32 33
         $pipeline->addInterceptor($interceptor);
33 34
 
34
-        $pipeline->withCore(new class implements CoreInterface {
35
+        $pipeline->withCore(new class implements CoreInterface
36
+        {
35 37
             public function callAction(string $controller, string $action, array $parameters = []): mixed
36 38
             {
37 39
                 return null;
Please login to merge, or discard this patch.
src/Pagination/src/Paginator.php 2 patches
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,7 +71,8 @@  discard block
 block discarded – undo
71 71
     public function paginate(PaginableInterface $target): PaginatorInterface
72 72
     {
73 73
         $paginator = clone $this;
74
-        if ($target instanceof \Countable && $paginator->count === 0) {
74
+        if ($target instanceof \Countable && $paginator->count === 0)
75
+        {
75 76
             $paginator->setCount($target->count());
76 77
         }
77 78
 
@@ -93,7 +94,8 @@  discard block
 block discarded – undo
93 94
 
94 95
     public function countDisplayed(): int
95 96
     {
96
-        if ($this->getPage() === $this->countPages) {
97
+        if ($this->getPage() === $this->countPages)
98
+        {
97 99
             return $this->count - $this->getOffset();
98 100
         }
99 101
 
@@ -107,7 +109,8 @@  discard block
 block discarded – undo
107 109
 
108 110
     public function nextPage(): ?int
109 111
     {
110
-        if ($this->getPage() !== $this->countPages) {
112
+        if ($this->getPage() !== $this->countPages)
113
+        {
111 114
             return $this->getPage() + 1;
112 115
         }
113 116
 
@@ -116,7 +119,8 @@  discard block
 block discarded – undo
116 119
 
117 120
     public function previousPage(): ?int
118 121
     {
119
-        if ($this->getPage() > 1) {
122
+        if ($this->getPage() > 1)
123
+        {
120 124
             return $this->getPage() - 1;
121 125
         }
122 126
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
         private int $limit = 25,
18 18
         int $count = 0,
19 19
         private readonly ?string $parameter = null,
20
-    ) {
20
+    ){
21 21
         $this->setCount($count);
22 22
     }
23 23
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     public function paginate(PaginableInterface $target): PaginatorInterface
74 74
     {
75 75
         $paginator = clone $this;
76
-        if ($target instanceof \Countable && $paginator->count === 0) {
76
+        if ($target instanceof \Countable && $paginator->count === 0){
77 77
             $paginator->setCount($target->count());
78 78
         }
79 79
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
     public function countDisplayed(): int
97 97
     {
98
-        if ($this->getPage() === $this->countPages) {
98
+        if ($this->getPage() === $this->countPages){
99 99
             return $this->count - $this->getOffset();
100 100
         }
101 101
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
     public function nextPage(): ?int
111 111
     {
112
-        if ($this->getPage() !== $this->countPages) {
112
+        if ($this->getPage() !== $this->countPages){
113 113
             return $this->getPage() + 1;
114 114
         }
115 115
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
     public function previousPage(): ?int
120 120
     {
121
-        if ($this->getPage() > 1) {
121
+        if ($this->getPage() > 1){
122 122
             return $this->getPage() - 1;
123 123
         }
124 124
 
Please login to merge, or discard this patch.