Passed
Pull Request — master (#1205)
by Aleksei
15:01 queued 03:15
created
src/Framework/Bootloader/DebugBootloader.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     public function __construct(
37 37
         private readonly InvokerInterface $invoker,
38 38
         private readonly ConfiguratorInterface $config,
39
-    ) {}
39
+    ){}
40 40
 
41 41
     /**
42 42
      * Boot default state collector.
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      * @param non-empty-string $key
52 52
      * @param TTag $value
53 53
      */
54
-    public function addTag(string $key, string|\Stringable|\Closure $value): void
54
+    public function addTag(string $key, string | \Stringable | \Closure $value): void
55 55
     {
56 56
         $this->config->modify(DebugConfig::CONFIG, new Append('tags', $key, $value));
57 57
     }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     /**
60 60
      * @psalm-param TCollector $collector
61 61
      */
62
-    public function addStateCollector(string|StateCollectorInterface|Autowire $collector): void
62
+    public function addStateCollector(string | StateCollectorInterface | Autowire $collector): void
63 63
     {
64 64
         $this->config->modify(DebugConfig::CONFIG, new Append('collectors', null, $collector));
65 65
     }
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
     ): StateInterface {
74 74
         $state = new State();
75 75
 
76
-        foreach ($config->getTags() as $key => $value) {
77
-            if ($value instanceof \Closure) {
76
+        foreach ($config->getTags() as $key => $value){
77
+            if ($value instanceof \Closure){
78 78
                 $value = $this->invoker->invoke($value);
79 79
             }
80 80
 
81
-            if (!\is_string($value) && !$value instanceof \Stringable) {
81
+            if (!\is_string($value) && !$value instanceof \Stringable){
82 82
                 throw new StateException(
83 83
                     \sprintf(
84 84
                         'Invalid tag value, `string` expected got `%s`',
@@ -87,26 +87,26 @@  discard block
 block discarded – undo
87 87
                 );
88 88
             }
89 89
 
90
-            $state->setTag((string) $key, (string) $value);
90
+            $state->setTag((string)$key, (string)$value);
91 91
         }
92 92
 
93 93
         $errors = [];
94 94
 
95
-        foreach ($config->getCollectors() as $collector) {
96
-            try {
95
+        foreach ($config->getCollectors() as $collector){
96
+            try{
97 97
                 $collector = match (true) {
98 98
                     \is_string($collector) => $factory->make($collector),
99 99
                     $collector instanceof Autowire => $collector->resolve($factory),
100 100
                     default => $collector,
101 101
                 };
102
-            } catch (\Throwable) {
102
+            }catch (\Throwable){
103 103
                 $errors[] = \is_string($collector) || $collector instanceof \Stringable
104
-                    ? (string) $collector
104
+                    ? (string)$collector
105 105
                     : \get_debug_type($collector);
106 106
                 continue;
107 107
             }
108 108
 
109
-            if (!$collector instanceof StateCollectorInterface) {
109
+            if (!$collector instanceof StateCollectorInterface){
110 110
                 throw new StateException(
111 111
                     \sprintf(
112 112
                         'Unable to populate state, invalid state collector %s',
Please login to merge, or discard this patch.
Braces   +17 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,7 +36,8 @@  discard block
 block discarded – undo
36 36
     public function __construct(
37 37
         private readonly InvokerInterface $invoker,
38 38
         private readonly ConfiguratorInterface $config,
39
-    ) {}
39
+    ) {
40
+}
40 41
 
41 42
     /**
42 43
      * Boot default state collector.
@@ -73,12 +74,15 @@  discard block
 block discarded – undo
73 74
     ): StateInterface {
74 75
         $state = new State();
75 76
 
76
-        foreach ($config->getTags() as $key => $value) {
77
-            if ($value instanceof \Closure) {
77
+        foreach ($config->getTags() as $key => $value)
78
+        {
79
+            if ($value instanceof \Closure)
80
+            {
78 81
                 $value = $this->invoker->invoke($value);
79 82
             }
80 83
 
81
-            if (!\is_string($value) && !$value instanceof \Stringable) {
84
+            if (!\is_string($value) && !$value instanceof \Stringable)
85
+            {
82 86
                 throw new StateException(
83 87
                     \sprintf(
84 88
                         'Invalid tag value, `string` expected got `%s`',
@@ -92,21 +96,26 @@  discard block
 block discarded – undo
92 96
 
93 97
         $errors = [];
94 98
 
95
-        foreach ($config->getCollectors() as $collector) {
96
-            try {
99
+        foreach ($config->getCollectors() as $collector)
100
+        {
101
+            try
102
+            {
97 103
                 $collector = match (true) {
98 104
                     \is_string($collector) => $factory->make($collector),
99 105
                     $collector instanceof Autowire => $collector->resolve($factory),
100 106
                     default => $collector,
101 107
                 };
102
-            } catch (\Throwable) {
108
+            }
109
+            catch (\Throwable)
110
+            {
103 111
                 $errors[] = \is_string($collector) || $collector instanceof \Stringable
104 112
                     ? (string) $collector
105 113
                     : \get_debug_type($collector);
106 114
                 continue;
107 115
             }
108 116
 
109
-            if (!$collector instanceof StateCollectorInterface) {
117
+            if (!$collector instanceof StateCollectorInterface)
118
+            {
110 119
                 throw new StateException(
111 120
                     \sprintf(
112 121
                         'Unable to populate state, invalid state collector %s',
Please login to merge, or discard this patch.
src/Framework/Bootloader/I18nBootloader.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@
 block discarded – undo
42 42
 
43 43
     public function __construct(
44 44
         private readonly ConfiguratorInterface $config,
45
-    ) {}
45
+    ){}
46 46
 
47 47
     public function init(EnvironmentInterface $env, DirectoriesInterface $dirs, DebugMode $debugMode): void
48 48
     {
49
-        if (!$dirs->has('locale')) {
50
-            $dirs->set('locale', $dirs->get('app') . 'locale/');
49
+        if (!$dirs->has('locale')){
50
+            $dirs->set('locale', $dirs->get('app').'locale/');
51 51
         }
52 52
 
53 53
         $this->config->setDefaults(
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,11 +42,13 @@
 block discarded – undo
42 42
 
43 43
     public function __construct(
44 44
         private readonly ConfiguratorInterface $config,
45
-    ) {}
45
+    ) {
46
+}
46 47
 
47 48
     public function init(EnvironmentInterface $env, DirectoriesInterface $dirs, DebugMode $debugMode): void
48 49
     {
49
-        if (!$dirs->has('locale')) {
50
+        if (!$dirs->has('locale'))
51
+        {
50 52
             $dirs->set('locale', $dirs->get('app') . 'locale/');
51 53
         }
52 54
 
Please login to merge, or discard this patch.
src/Framework/Bootloader/Attributes/AttributesConfig.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@
 block discarded – undo
28 28
 
29 29
     public function isAnnotationsReaderEnabled(): bool
30 30
     {
31
-        return (bool) $this->config['annotations']['support'];
31
+        return (bool)$this->config['annotations']['support'];
32 32
     }
33 33
 
34 34
     public function isCacheEnabled(): bool
35 35
     {
36
-        return (bool) ($this->config['cache']['enabled'] ?? false);
36
+        return (bool)($this->config['cache']['enabled'] ?? false);
37 37
     }
38 38
 
39 39
     /**
Please login to merge, or discard this patch.
src/Framework/Bootloader/Attributes/AttributesBootloader.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function __construct(
32 32
         private readonly ConfiguratorInterface $config,
33
-    ) {}
33
+    ){}
34 34
 
35 35
     public function init(EnvironmentInterface $env): void
36 36
     {
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
     private function initInstantiator(AttributesConfig $config): InstantiatorInterface
52 52
     {
53
-        if ($config->isAnnotationsReaderEnabled()) {
53
+        if ($config->isAnnotationsReaderEnabled()){
54 54
             return new Facade();
55 55
         }
56 56
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     ): ReaderInterface {
66 66
         $reader = new AttributeReader($instantiator);
67 67
 
68
-        if ($config->isCacheEnabled()) {
68
+        if ($config->isCacheEnabled()){
69 69
             $provider = $container->get(CacheStorageProviderInterface::class);
70 70
             \assert($provider instanceof CacheStorageProviderInterface);
71 71
 
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 
75 75
         $supportAnnotations = $config->isAnnotationsReaderEnabled();
76 76
 
77
-        if ($supportAnnotations) {
78
-            if (!\interface_exists(DoctrineReaderInterface::class)) {
77
+        if ($supportAnnotations){
78
+            if (!\interface_exists(DoctrineReaderInterface::class)){
79 79
                 throw new InitializationException(
80 80
                     'Doctrine annotations reader is not available, please install "doctrine/annotations" package',
81 81
                 );
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,7 +30,8 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function __construct(
32 32
         private readonly ConfiguratorInterface $config,
33
-    ) {}
33
+    ) {
34
+}
34 35
 
35 36
     public function init(EnvironmentInterface $env): void
36 37
     {
@@ -50,7 +51,8 @@  discard block
 block discarded – undo
50 51
 
51 52
     private function initInstantiator(AttributesConfig $config): InstantiatorInterface
52 53
     {
53
-        if ($config->isAnnotationsReaderEnabled()) {
54
+        if ($config->isAnnotationsReaderEnabled())
55
+        {
54 56
             return new Facade();
55 57
         }
56 58
 
@@ -65,7 +67,8 @@  discard block
 block discarded – undo
65 67
     ): ReaderInterface {
66 68
         $reader = new AttributeReader($instantiator);
67 69
 
68
-        if ($config->isCacheEnabled()) {
70
+        if ($config->isCacheEnabled())
71
+        {
69 72
             $provider = $container->get(CacheStorageProviderInterface::class);
70 73
             \assert($provider instanceof CacheStorageProviderInterface);
71 74
 
@@ -74,8 +77,10 @@  discard block
 block discarded – undo
74 77
 
75 78
         $supportAnnotations = $config->isAnnotationsReaderEnabled();
76 79
 
77
-        if ($supportAnnotations) {
78
-            if (!\interface_exists(DoctrineReaderInterface::class)) {
80
+        if ($supportAnnotations)
81
+        {
82
+            if (!\interface_exists(DoctrineReaderInterface::class))
83
+            {
79 84
                 throw new InitializationException(
80 85
                     'Doctrine annotations reader is not available, please install "doctrine/annotations" package',
81 86
                 );
Please login to merge, or discard this patch.
src/Framework/Console/Logger/DebugListener.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
     public function __construct(
29 29
         private readonly ListenerRegistryInterface $listenerRegistry,
30
-    ) {}
30
+    ){}
31 31
 
32 32
     /**
33 33
      * Configure listener with new output.
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function __invoke(LogEvent $event): void
69 69
     {
70
-        if (empty($this->output)) {
70
+        if (empty($this->output)){
71 71
             return;
72 72
         }
73 73
 
74
-        if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) {
74
+        if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE){
75 75
             return;
76 76
         }
77 77
 
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
 
96 96
     private function getChannel(string $channel): string
97 97
     {
98
-        if (!\class_exists($channel, false)) {
98
+        if (!\class_exists($channel, false)){
99 99
             return \sprintf('[%s]', $channel);
100 100
         }
101 101
 
102
-        try {
102
+        try{
103 103
             $reflection = new \ReflectionClass($channel);
104
-        } catch (\ReflectionException) {
104
+        }catch (\ReflectionException){
105 105
             return $channel;
106 106
         }
107 107
 
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 
111 111
     private function getMessage(bool $decorated, string $message): string
112 112
     {
113
-        if (!$decorated) {
113
+        if (!$decorated){
114 114
             return $message;
115 115
         }
116 116
 
117
-        return Color::GRAY . $message . Color::RESET;
117
+        return Color::GRAY.$message.Color::RESET;
118 118
     }
119 119
 }
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,7 +27,8 @@  discard block
 block discarded – undo
27 27
 
28 28
     public function __construct(
29 29
         private readonly ListenerRegistryInterface $listenerRegistry,
30
-    ) {}
30
+    ) {
31
+}
31 32
 
32 33
     /**
33 34
      * Configure listener with new output.
@@ -67,11 +68,13 @@  discard block
 block discarded – undo
67 68
      */
68 69
     public function __invoke(LogEvent $event): void
69 70
     {
70
-        if (empty($this->output)) {
71
+        if (empty($this->output))
72
+        {
71 73
             return;
72 74
         }
73 75
 
74
-        if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) {
76
+        if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE)
77
+        {
75 78
             return;
76 79
         }
77 80
 
@@ -95,13 +98,17 @@  discard block
 block discarded – undo
95 98
 
96 99
     private function getChannel(string $channel): string
97 100
     {
98
-        if (!\class_exists($channel, false)) {
101
+        if (!\class_exists($channel, false))
102
+        {
99 103
             return \sprintf('[%s]', $channel);
100 104
         }
101 105
 
102
-        try {
106
+        try
107
+        {
103 108
             $reflection = new \ReflectionClass($channel);
104
-        } catch (\ReflectionException) {
109
+        }
110
+        catch (\ReflectionException)
111
+        {
105 112
             return $channel;
106 113
         }
107 114
 
@@ -110,7 +117,8 @@  discard block
 block discarded – undo
110 117
 
111 118
     private function getMessage(bool $decorated, string $message): string
112 119
     {
113
-        if (!$decorated) {
120
+        if (!$decorated)
121
+        {
114 122
             return $message;
115 123
         }
116 124
 
Please login to merge, or discard this patch.
src/Framework/Console/ConsoleDispatcher.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         private readonly FinalizerInterface $finalizer,
29 29
         private readonly ContainerInterface $container,
30 30
         private readonly ExceptionHandlerInterface $errorHandler,
31
-    ) {}
31
+    ){}
32 32
 
33 33
     public static function canServe(EnvironmentInterface $env): bool
34 34
     {
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
         /** @var Console $console */
50 50
         $console = $this->container->get(Console::class);
51 51
 
52
-        try {
52
+        try{
53 53
             return $console->start($input ?? new ArgvInput(), $output);
54
-        } catch (\Throwable $e) {
54
+        }catch (\Throwable $e){
55 55
             $this->handleException($e, $output);
56 56
 
57 57
             return 255;
58
-        } finally {
58
+        }finally{
59 59
             $listener->disable();
60 60
             $this->finalizer->finalize(false);
61 61
         }
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,7 +28,8 @@  discard block
 block discarded – undo
28 28
         private readonly FinalizerInterface $finalizer,
29 29
         private readonly ContainerInterface $container,
30 30
         private readonly ExceptionHandlerInterface $errorHandler,
31
-    ) {}
31
+    ) {
32
+}
32 33
 
33 34
     public static function canServe(EnvironmentInterface $env): bool
34 35
     {
@@ -49,13 +50,18 @@  discard block
 block discarded – undo
49 50
         /** @var Console $console */
50 51
         $console = $this->container->get(Console::class);
51 52
 
52
-        try {
53
+        try
54
+        {
53 55
             return $console->start($input ?? new ArgvInput(), $output);
54
-        } catch (\Throwable $e) {
56
+        }
57
+        catch (\Throwable $e)
58
+        {
55 59
             $this->handleException($e, $output);
56 60
 
57 61
             return 255;
58
-        } finally {
62
+        }
63
+        finally
64
+        {
59 65
             $listener->disable();
60 66
             $this->finalizer->finalize(false);
61 67
         }
Please login to merge, or discard this patch.
src/Framework/Console/Sequence/RuntimeDirectory.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     public function __construct(
17 17
         private readonly FilesInterface $files,
18 18
         private readonly DirectoriesInterface $dirs,
19
-    ) {}
19
+    ){}
20 20
 
21 21
     public function ensure(OutputInterface $output): void
22 22
     {
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
         $runtimeDirectory = $this->dirs->get('runtime');
26 26
 
27
-        if (!$this->files->exists($runtimeDirectory)) {
27
+        if (!$this->files->exists($runtimeDirectory)){
28 28
             $this->files->ensureDirectory($runtimeDirectory);
29 29
             $output->writeln('<comment>created</comment>');
30 30
             return;
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
         $output->writeln('<info>exists</info>');
33 33
 
34 34
 
35
-        foreach ($this->files->getFiles($runtimeDirectory) as $filename) {
36
-            try {
35
+        foreach ($this->files->getFiles($runtimeDirectory) as $filename){
36
+            try{
37 37
                 $this->files->setPermissions($filename, FilesInterface::RUNTIME);
38 38
                 $this->files->setPermissions(\dirname($filename), FilesInterface::RUNTIME);
39
-            } catch (\Throwable $e) {
39
+            }catch (\Throwable $e){
40 40
                 // @codeCoverageIgnoreStart
41 41
                 $output->writeln(
42 42
                     \sprintf(
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
                 // @codeCoverageIgnoreEnd
50 50
             }
51 51
 
52
-            if ($output->isVerbose()) {
52
+            if ($output->isVerbose()){
53 53
                 $output->writeln(
54 54
                     \sprintf(
55 55
                         '<fg=green>[updated]</fg=green> `%s`',
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,7 +16,8 @@  discard block
 block discarded – undo
16 16
     public function __construct(
17 17
         private readonly FilesInterface $files,
18 18
         private readonly DirectoriesInterface $dirs,
19
-    ) {}
19
+    ) {
20
+}
20 21
 
21 22
     public function ensure(OutputInterface $output): void
22 23
     {
@@ -24,7 +25,8 @@  discard block
 block discarded – undo
24 25
 
25 26
         $runtimeDirectory = $this->dirs->get('runtime');
26 27
 
27
-        if (!$this->files->exists($runtimeDirectory)) {
28
+        if (!$this->files->exists($runtimeDirectory))
29
+        {
28 30
             $this->files->ensureDirectory($runtimeDirectory);
29 31
             $output->writeln('<comment>created</comment>');
30 32
             return;
@@ -32,11 +34,15 @@  discard block
 block discarded – undo
32 34
         $output->writeln('<info>exists</info>');
33 35
 
34 36
 
35
-        foreach ($this->files->getFiles($runtimeDirectory) as $filename) {
36
-            try {
37
+        foreach ($this->files->getFiles($runtimeDirectory) as $filename)
38
+        {
39
+            try
40
+            {
37 41
                 $this->files->setPermissions($filename, FilesInterface::RUNTIME);
38 42
                 $this->files->setPermissions(\dirname($filename), FilesInterface::RUNTIME);
39
-            } catch (\Throwable $e) {
43
+            }
44
+            catch (\Throwable $e)
45
+            {
40 46
                 // @codeCoverageIgnoreStart
41 47
                 $output->writeln(
42 48
                     \sprintf(
@@ -49,7 +55,8 @@  discard block
 block discarded – undo
49 55
                 // @codeCoverageIgnoreEnd
50 56
             }
51 57
 
52
-            if ($output->isVerbose()) {
58
+            if ($output->isVerbose())
59
+            {
53 60
                 $output->writeln(
54 61
                     \sprintf(
55 62
                         '<fg=green>[updated]</fg=green> `%s`',
Please login to merge, or discard this patch.
src/Framework/Attribute/DispatcherScope.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,6 +11,6 @@
 block discarded – undo
11 11
 final class DispatcherScope
12 12
 {
13 13
     public function __construct(
14
-        public readonly string|\BackedEnum $scope,
15
-    ) {}
14
+        public readonly string | \BackedEnum $scope,
15
+    ){}
16 16
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,5 +12,6 @@
 block discarded – undo
12 12
 {
13 13
     public function __construct(
14 14
         public readonly string|\BackedEnum $scope,
15
-    ) {}
15
+    ) {
16
+}
16 17
 }
Please login to merge, or discard this patch.
src/Framework/Domain/GuardPermissionsProvider.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     public function __construct(
27 27
         private readonly ReaderInterface $reader,
28 28
         private readonly ?string $namespace = null,
29
-    ) {}
29
+    ){}
30 30
 
31 31
     /**
32 32
      * Get method RBAC permission if any. Automatically merges with controller namespace.
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     public function getPermission(string $controller, string $action): Permission
35 35
     {
36 36
         $key = \sprintf('%s:%s', $controller, $action);
37
-        if (!\array_key_exists($key, $this->cache)) {
37
+        if (!\array_key_exists($key, $this->cache)){
38 38
             $this->cache[$key] = $this->generatePermission($controller, $action);
39 39
         }
40 40
 
@@ -43,20 +43,20 @@  discard block
 block discarded – undo
43 43
 
44 44
     private function generatePermission(string $controller, string $action): Permission
45 45
     {
46
-        try {
46
+        try{
47 47
             $method = new \ReflectionMethod($controller, $action);
48
-        } catch (\ReflectionException) {
48
+        }catch (\ReflectionException){
49 49
             return Permission::failed();
50 50
         }
51 51
 
52 52
         $guarded = $this->reader->firstFunctionMetadata($method, Guarded::class);
53
-        if (!$guarded instanceof Guarded) {
53
+        if (!$guarded instanceof Guarded){
54 54
             return Permission::failed();
55 55
         }
56 56
 
57 57
         $namespace = $this->reader->firstClassMetadata($method->getDeclaringClass(), GuardNamespace::class);
58 58
 
59
-        if ($guarded->permission || ($namespace instanceof GuardNamespace && $namespace->namespace)) {
59
+        if ($guarded->permission || ($namespace instanceof GuardNamespace && $namespace->namespace)){
60 60
             return Permission::ok(
61 61
                 $this->makePermission($guarded, $method, $namespace),
62 62
                 $this->mapFailureException($guarded),
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
     private function makePermission(Guarded $guarded, \ReflectionMethod $method, ?GuardNamespace $ns): string
80 80
     {
81 81
         $permission = [];
82
-        if ($this->namespace) {
82
+        if ($this->namespace){
83 83
             $permission[] = $this->namespace;
84 84
         }
85 85
 
86
-        if ($ns !== null && $ns->namespace) {
86
+        if ($ns !== null && $ns->namespace){
87 87
             $permission[] = $ns->namespace;
88 88
         }
89 89
 
Please login to merge, or discard this patch.
Braces   +17 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@  discard block
 block discarded – undo
26 26
     public function __construct(
27 27
         private readonly ReaderInterface $reader,
28 28
         private readonly ?string $namespace = null,
29
-    ) {}
29
+    ) {
30
+}
30 31
 
31 32
     /**
32 33
      * Get method RBAC permission if any. Automatically merges with controller namespace.
@@ -34,7 +35,8 @@  discard block
 block discarded – undo
34 35
     public function getPermission(string $controller, string $action): Permission
35 36
     {
36 37
         $key = \sprintf('%s:%s', $controller, $action);
37
-        if (!\array_key_exists($key, $this->cache)) {
38
+        if (!\array_key_exists($key, $this->cache))
39
+        {
38 40
             $this->cache[$key] = $this->generatePermission($controller, $action);
39 41
         }
40 42
 
@@ -43,20 +45,25 @@  discard block
 block discarded – undo
43 45
 
44 46
     private function generatePermission(string $controller, string $action): Permission
45 47
     {
46
-        try {
48
+        try
49
+        {
47 50
             $method = new \ReflectionMethod($controller, $action);
48
-        } catch (\ReflectionException) {
51
+        }
52
+        catch (\ReflectionException)
53
+        {
49 54
             return Permission::failed();
50 55
         }
51 56
 
52 57
         $guarded = $this->reader->firstFunctionMetadata($method, Guarded::class);
53
-        if (!$guarded instanceof Guarded) {
58
+        if (!$guarded instanceof Guarded)
59
+        {
54 60
             return Permission::failed();
55 61
         }
56 62
 
57 63
         $namespace = $this->reader->firstClassMetadata($method->getDeclaringClass(), GuardNamespace::class);
58 64
 
59
-        if ($guarded->permission || ($namespace instanceof GuardNamespace && $namespace->namespace)) {
65
+        if ($guarded->permission || ($namespace instanceof GuardNamespace && $namespace->namespace))
66
+        {
60 67
             return Permission::ok(
61 68
                 $this->makePermission($guarded, $method, $namespace),
62 69
                 $this->mapFailureException($guarded),
@@ -79,11 +86,13 @@  discard block
 block discarded – undo
79 86
     private function makePermission(Guarded $guarded, \ReflectionMethod $method, ?GuardNamespace $ns): string
80 87
     {
81 88
         $permission = [];
82
-        if ($this->namespace) {
89
+        if ($this->namespace)
90
+        {
83 91
             $permission[] = $this->namespace;
84 92
         }
85 93
 
86
-        if ($ns !== null && $ns->namespace) {
94
+        if ($ns !== null && $ns->namespace)
95
+        {
87 96
             $permission[] = $ns->namespace;
88 97
         }
89 98
 
Please login to merge, or discard this patch.