Passed
Pull Request — master (#1111)
by Aleksei
11:44
created
src/Tokenizer/src/Tokenizer.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
     public function __construct(
24 24
         private readonly TokenizerConfig $config
25
-    ) {
25
+    ){
26 26
     }
27 27
 
28 28
     /**
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
         $tokens = \token_get_all(\file_get_contents($filename));
64 64
 
65 65
         $line = 0;
66
-        foreach ($tokens as &$token) {
67
-            if (isset($token[self::LINE])) {
66
+        foreach ($tokens as &$token){
67
+            if (isset($token[self::LINE])){
68 68
                 $line = $token[self::LINE];
69 69
             }
70 70
 
71
-            if (!\is_array($token)) {
71
+            if (!\is_array($token)){
72 72
                 $token = [$token, $token, $line];
73 73
             }
74 74
 
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
     {
87 87
         $finder = new Finder();
88 88
 
89
-        if (empty($directories)) {
89
+        if (empty($directories)){
90 90
             $directories = $this->config->getDirectories();
91 91
         }
92 92
 
93
-        if (empty($exclude)) {
93
+        if (empty($exclude)){
94 94
             $exclude = $this->config->getExcludes();
95 95
         }
96 96
 
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -63,12 +63,15 @@  discard block
 block discarded – undo
63 63
         $tokens = \token_get_all(\file_get_contents($filename));
64 64
 
65 65
         $line = 0;
66
-        foreach ($tokens as &$token) {
67
-            if (isset($token[self::LINE])) {
66
+        foreach ($tokens as &$token)
67
+        {
68
+            if (isset($token[self::LINE]))
69
+            {
68 70
                 $line = $token[self::LINE];
69 71
             }
70 72
 
71
-            if (!\is_array($token)) {
73
+            if (!\is_array($token))
74
+            {
72 75
                 $token = [$token, $token, $line];
73 76
             }
74 77
 
@@ -86,11 +89,13 @@  discard block
 block discarded – undo
86 89
     {
87 90
         $finder = new Finder();
88 91
 
89
-        if (empty($directories)) {
92
+        if (empty($directories))
93
+        {
90 94
             $directories = $this->config->getDirectories();
91 95
         }
92 96
 
93
-        if (empty($exclude)) {
97
+        if (empty($exclude))
98
+        {
94 99
             $exclude = $this->config->getExcludes();
95 100
         }
96 101
 
Please login to merge, or discard this patch.
src/Logger/src/Event/LogEvent.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
         private readonly string $level,
13 13
         private readonly string $message,
14 14
         private readonly array $context = []
15
-    ) {
15
+    ){
16 16
     }
17 17
 
18 18
     public function getTime(): \DateTimeInterface
Please login to merge, or discard this patch.
src/Logger/src/ListenerRegistry.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
     public function addListener(callable $listener): self
16 16
     {
17
-        if (!\in_array($listener, $this->listeners, true)) {
17
+        if (!\in_array($listener, $this->listeners, true)){
18 18
             $this->listeners[] = $listener;
19 19
         }
20 20
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     public function removeListener(callable $listener): void
25 25
     {
26 26
         $key = \array_search($listener, $this->listeners, true);
27
-        if ($key !== null) {
27
+        if ($key !== null){
28 28
             unset($this->listeners[$key]);
29 29
         }
30 30
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,8 @@  discard block
 block discarded – undo
14 14
 
15 15
     public function addListener(callable $listener): self
16 16
     {
17
-        if (!\in_array($listener, $this->listeners, true)) {
17
+        if (!\in_array($listener, $this->listeners, true))
18
+        {
18 19
             $this->listeners[] = $listener;
19 20
         }
20 21
 
@@ -24,7 +25,8 @@  discard block
 block discarded – undo
24 25
     public function removeListener(callable $listener): void
25 26
     {
26 27
         $key = \array_search($listener, $this->listeners, true);
27
-        if ($key !== null) {
28
+        if ($key !== null)
29
+        {
28 30
             unset($this->listeners[$key]);
29 31
         }
30 32
     }
Please login to merge, or discard this patch.
src/Logger/src/LogFactory.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 {
15 15
     public function __construct(
16 16
         private readonly ListenerRegistryInterface $listenedRegistry
17
-    ) {
17
+    ){
18 18
     }
19 19
 
20 20
     public function getLogger(string $channel): LoggerInterface
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
         $e = new LogEvent(
28 28
             new \DateTime(),
29 29
             $channel,
30
-            (string) $level,
30
+            (string)$level,
31 31
             $message,
32 32
             $context
33 33
         );
34 34
 
35
-        foreach ($this->listenedRegistry->getListeners() as $listener) {
35
+        foreach ($this->listenedRegistry->getListeners() as $listener){
36 36
             \call_user_func($listener, $e);
37 37
         }
38 38
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,8 @@
 block discarded – undo
32 32
             $context
33 33
         );
34 34
 
35
-        foreach ($this->listenedRegistry->getListeners() as $listener) {
35
+        foreach ($this->listenedRegistry->getListeners() as $listener)
36
+        {
36 37
             \call_user_func($listener, $e);
37 38
         }
38 39
     }
Please login to merge, or discard this patch.
src/Cache/src/Config/CacheConfig.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function getDefaultStorage(): string
33 33
     {
34
-        if (!\is_string($this->config['default'])) {
34
+        if (!\is_string($this->config['default'])){
35 35
             throw new InvalidArgumentException('Default cache storage config value must be a string');
36 36
         }
37 37
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
     public function getStorageConfig(string $name): array
42 42
     {
43
-        if (!isset($this->config['storages'][$name])) {
43
+        if (!isset($this->config['storages'][$name])){
44 44
             throw new InvalidArgumentException(
45 45
                 \sprintf('Config for storage `%s` is not defined.', $name)
46 46
             );
@@ -48,19 +48,19 @@  discard block
 block discarded – undo
48 48
 
49 49
         $config = $this->config['storages'][$name];
50 50
 
51
-        if (!isset($config['type'])) {
51
+        if (!isset($config['type'])){
52 52
             throw new InvalidArgumentException(
53 53
                 \sprintf('Storage type for `%s` is not defined.', $name)
54 54
             );
55 55
         }
56 56
 
57
-        if (!\is_string($config['type'])) {
57
+        if (!\is_string($config['type'])){
58 58
             throw new InvalidArgumentException(
59 59
                 \sprintf('Storage type value for `%s` must be a string', $name)
60 60
             );
61 61
         }
62 62
 
63
-        if (isset($this->config['typeAliases'][$config['type']])) {
63
+        if (isset($this->config['typeAliases'][$config['type']])){
64 64
             $config['type'] = $this->config['typeAliases'][$config['type']];
65 65
         }
66 66
 
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function getDefaultStorage(): string
33 33
     {
34
-        if (!\is_string($this->config['default'])) {
34
+        if (!\is_string($this->config['default']))
35
+        {
35 36
             throw new InvalidArgumentException('Default cache storage config value must be a string');
36 37
         }
37 38
 
@@ -40,7 +41,8 @@  discard block
 block discarded – undo
40 41
 
41 42
     public function getStorageConfig(string $name): array
42 43
     {
43
-        if (!isset($this->config['storages'][$name])) {
44
+        if (!isset($this->config['storages'][$name]))
45
+        {
44 46
             throw new InvalidArgumentException(
45 47
                 \sprintf('Config for storage `%s` is not defined.', $name)
46 48
             );
@@ -48,19 +50,22 @@  discard block
 block discarded – undo
48 50
 
49 51
         $config = $this->config['storages'][$name];
50 52
 
51
-        if (!isset($config['type'])) {
53
+        if (!isset($config['type']))
54
+        {
52 55
             throw new InvalidArgumentException(
53 56
                 \sprintf('Storage type for `%s` is not defined.', $name)
54 57
             );
55 58
         }
56 59
 
57
-        if (!\is_string($config['type'])) {
60
+        if (!\is_string($config['type']))
61
+        {
58 62
             throw new InvalidArgumentException(
59 63
                 \sprintf('Storage type value for `%s` must be a string', $name)
60 64
             );
61 65
         }
62 66
 
63
-        if (isset($this->config['typeAliases'][$config['type']])) {
67
+        if (isset($this->config['typeAliases'][$config['type']]))
68
+        {
64 69
             $config['type'] = $this->config['typeAliases'][$config['type']];
65 70
         }
66 71
 
Please login to merge, or discard this patch.
src/Cache/src/Event/KeyWritten.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,6 +9,6 @@
 block discarded – undo
9 9
     public function __construct(
10 10
         public readonly string $key,
11 11
         public readonly mixed $value,
12
-    ) {
12
+    ){
13 13
     }
14 14
 }
Please login to merge, or discard this patch.
src/Cache/src/Event/KeyDeleted.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 $key,
11
-    ) {
11
+    ){
12 12
     }
13 13
 }
Please login to merge, or discard this patch.
src/Cache/src/Event/CacheHit.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,6 +9,6 @@
 block discarded – undo
9 9
     public function __construct(
10 10
         public readonly string $key,
11 11
         public readonly mixed $value
12
-    ) {
12
+    ){
13 13
     }
14 14
 }
Please login to merge, or discard this patch.
src/Cache/src/Core/CacheInjector.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -19,26 +19,26 @@  discard block
 block discarded – undo
19 19
 {
20 20
     public function __construct(
21 21
         private readonly CacheStorageProviderInterface $provider
22
-    ) {
22
+    ){
23 23
     }
24 24
 
25 25
     public function createInjection(ReflectionClass $class, string $context = null): CacheInterface
26 26
     {
27
-        try {
28
-            if ($context === null) {
27
+        try{
28
+            if ($context === null){
29 29
                 $connection = $this->provider->storage();
30
-            } else {
30
+            }else{
31 31
                 // Get Cache by context
32
-                try {
32
+                try{
33 33
                     $connection = $this->provider->storage($context);
34
-                } catch (InvalidArgumentException) {
34
+                }catch (InvalidArgumentException){
35 35
                     // Case when context doesn't match to configured connections
36 36
                     return $this->provider->storage();
37 37
                 }
38 38
             }
39 39
 
40 40
             $this->matchType($class, $context, $connection);
41
-        } catch (\Throwable $e) {
41
+        }catch (\Throwable $e){
42 42
             throw new ContainerException(sprintf("Can't inject the required cache. %s", $e->getMessage()), 0, $e);
43 43
         }
44 44
 
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
      */
53 53
     private function matchType(ReflectionClass $class, ?string $context, CacheInterface $connection): void
54 54
     {
55
-        if ($connection::class === CacheRepository::class) {
55
+        if ($connection::class === CacheRepository::class){
56 56
             $connection = $connection->getStorage();
57 57
         }
58 58
         $className = $class->getName();
59
-        if ($className !== CacheInterface::class && !$connection instanceof $className) {
59
+        if ($className !== CacheInterface::class && !$connection instanceof $className){
60 60
             throw new \RuntimeException(
61 61
                 \sprintf(
62 62
                     "The cache obtained by the context `%s` doesn't match the type `%s`.",
Please login to merge, or discard this patch.
Braces   +19 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,21 +24,30 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function createInjection(ReflectionClass $class, string $context = null): CacheInterface
26 26
     {
27
-        try {
28
-            if ($context === null) {
27
+        try
28
+        {
29
+            if ($context === null)
30
+            {
29 31
                 $connection = $this->provider->storage();
30
-            } else {
32
+            }
33
+            else
34
+            {
31 35
                 // Get Cache by context
32
-                try {
36
+                try
37
+                {
33 38
                     $connection = $this->provider->storage($context);
34
-                } catch (InvalidArgumentException) {
39
+                }
40
+                catch (InvalidArgumentException)
41
+                {
35 42
                     // Case when context doesn't match to configured connections
36 43
                     return $this->provider->storage();
37 44
                 }
38 45
             }
39 46
 
40 47
             $this->matchType($class, $context, $connection);
41
-        } catch (\Throwable $e) {
48
+        }
49
+        catch (\Throwable $e)
50
+        {
42 51
             throw new ContainerException(sprintf("Can't inject the required cache. %s", $e->getMessage()), 0, $e);
43 52
         }
44 53
 
@@ -52,11 +61,13 @@  discard block
 block discarded – undo
52 61
      */
53 62
     private function matchType(ReflectionClass $class, ?string $context, CacheInterface $connection): void
54 63
     {
55
-        if ($connection::class === CacheRepository::class) {
64
+        if ($connection::class === CacheRepository::class)
65
+        {
56 66
             $connection = $connection->getStorage();
57 67
         }
58 68
         $className = $class->getName();
59
-        if ($className !== CacheInterface::class && !$connection instanceof $className) {
69
+        if ($className !== CacheInterface::class && !$connection instanceof $className)
70
+        {
60 71
             throw new \RuntimeException(
61 72
                 \sprintf(
62 73
                     "The cache obtained by the context `%s` doesn't match the type `%s`.",
Please login to merge, or discard this patch.