Passed
Pull Request — master (#736)
by Abdul Malik
06:39
created
src/Boot/src/Bootloader/ConfigurationBootloader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 
60 60
     public function addLoader(string $ext, FileLoaderInterface $loader): void
61 61
     {
62
-        if (!isset($this->loaders[$ext]) || get_class($this->loaders[$ext]) !== get_class($loader)) {
62
+        if (!isset($this->loaders[$ext]) || get_class($this->loaders[$ext]) !== get_class($loader)){
63 63
             $this->loaders[$ext] = $loader;
64 64
             $this->container->bindSingleton(ConfigManager::class, $this->createConfigManager());
65 65
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,8 @@
 block discarded – undo
59 59
 
60 60
     public function addLoader(string $ext, FileLoaderInterface $loader): void
61 61
     {
62
-        if (!isset($this->loaders[$ext]) || get_class($this->loaders[$ext]) !== get_class($loader)) {
62
+        if (!isset($this->loaders[$ext]) || get_class($this->loaders[$ext]) !== get_class($loader))
63
+        {
63 64
             $this->loaders[$ext] = $loader;
64 65
             $this->container->bindSingleton(ConfigManager::class, $this->createConfigManager());
65 66
         }
Please login to merge, or discard this patch.
src/Bridge/Stempler/tests/BaseTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
             DirectoriesInterface::class,
52 52
             new Directories(
53 53
                 [
54
-                    'app'   => __DIR__ . '/fixtures',
55
-                    'cache' => __DIR__ . '/cache'
54
+                    'app'   => __DIR__.'/fixtures',
55
+                    'cache' => __DIR__.'/cache'
56 56
                 ]
57 57
             )
58 58
         );
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         $this->container->bind(
62 62
             ConfiguratorInterface::class,
63 63
             new ConfigManager(
64
-                new DirectoryLoader(__DIR__ . '/config/', [
64
+                new DirectoryLoader(__DIR__.'/config/', [
65 65
                     'php'  => $this->container->get(PhpLoader::class),
66 66
                     'json' => $this->container->get(JsonLoader::class),
67 67
                 ]),
Please login to merge, or discard this patch.
src/Framework/Http/LegacyRrDispatcher.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         FinalizerInterface $finalizer,
50 50
         ContainerInterface $container,
51 51
         FactoryInterface $factory
52
-    ) {
52
+    ){
53 53
         $this->env = $env;
54 54
         $this->finalizer = $finalizer;
55 55
         $this->container = $container;
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 
76 76
         /** @var Http $http */
77 77
         $http = $this->container->get(Http::class);
78
-        while ($request = $client->acceptRequest()) {
79
-            try {
78
+        while ($request = $client->acceptRequest()){
79
+            try{
80 80
                 $client->respond($http->handle($request));
81
-            } catch (\Throwable $e) {
81
+            }catch (\Throwable $e){
82 82
                 $this->handleException($client, $e);
83
-            } finally {
83
+            }finally{
84 84
                 $this->finalizer->finalize(false);
85 85
             }
86 86
         }
@@ -94,17 +94,17 @@  discard block
 block discarded – undo
94 94
     {
95 95
         $handler = new HtmlHandler();
96 96
 
97
-        try {
97
+        try{
98 98
             /** @var SnapshotInterface $snapshot */
99 99
             $snapshot = $this->container->get(SnapshotterInterface::class)->register($e);
100 100
             error_log($snapshot->getMessage());
101 101
 
102 102
             // on demand
103 103
             $state = $this->container->get(StateInterface::class);
104
-            if ($state !== null) {
104
+            if ($state !== null){
105 105
                 $handler = $handler->withState($state);
106 106
             }
107
-        } catch (\Throwable | ContainerExceptionInterface $se) {
107
+        }catch (\Throwable | ContainerExceptionInterface $se){
108 108
             error_log((string)$e);
109 109
         }
110 110
 
Please login to merge, or discard this patch.
Braces   +17 added lines, -7 removed lines patch added patch discarded remove patch
@@ -75,12 +75,18 @@  discard block
 block discarded – undo
75 75
 
76 76
         /** @var Http $http */
77 77
         $http = $this->container->get(Http::class);
78
-        while ($request = $client->acceptRequest()) {
79
-            try {
78
+        while ($request = $client->acceptRequest())
79
+        {
80
+            try
81
+            {
80 82
                 $client->respond($http->handle($request));
81
-            } catch (\Throwable $e) {
83
+            }
84
+            catch (\Throwable $e)
85
+            {
82 86
                 $this->handleException($client, $e);
83
-            } finally {
87
+            }
88
+            finally
89
+            {
84 90
                 $this->finalizer->finalize(false);
85 91
             }
86 92
         }
@@ -94,17 +100,21 @@  discard block
 block discarded – undo
94 100
     {
95 101
         $handler = new HtmlHandler();
96 102
 
97
-        try {
103
+        try
104
+        {
98 105
             /** @var SnapshotInterface $snapshot */
99 106
             $snapshot = $this->container->get(SnapshotterInterface::class)->register($e);
100 107
             error_log($snapshot->getMessage());
101 108
 
102 109
             // on demand
103 110
             $state = $this->container->get(StateInterface::class);
104
-            if ($state !== null) {
111
+            if ($state !== null)
112
+            {
105 113
                 $handler = $handler->withState($state);
106 114
             }
107
-        } catch (\Throwable | ContainerExceptionInterface $se) {
115
+        }
116
+        catch (\Throwable | ContainerExceptionInterface $se)
117
+        {
108 118
             error_log((string)$e);
109 119
         }
110 120
 
Please login to merge, or discard this patch.
src/Framework/Debug/StateCollector/EnvironmentCollector.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,8 +43,8 @@
 block discarded – undo
43 43
     {
44 44
         $state->setTag('php', phpversion());
45 45
 
46
-        if ($this->container->has(DispatcherInterface::class)) {
47
-            switch (get_class($this->container->get(DispatcherInterface::class))) {
46
+        if ($this->container->has(DispatcherInterface::class)){
47
+            switch (get_class($this->container->get(DispatcherInterface::class))){
48 48
                 case LegacyRrDispatcher::class:
49 49
                     $state->setTag('dispatcher', 'roadrunner');
50 50
                     break;
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,8 +43,10 @@
 block discarded – undo
43 43
     {
44 44
         $state->setTag('php', phpversion());
45 45
 
46
-        if ($this->container->has(DispatcherInterface::class)) {
47
-            switch (get_class($this->container->get(DispatcherInterface::class))) {
46
+        if ($this->container->has(DispatcherInterface::class))
47
+        {
48
+            switch (get_class($this->container->get(DispatcherInterface::class)))
49
+            {
48 50
                 case LegacyRrDispatcher::class:
49 51
                     $state->setTag('dispatcher', 'roadrunner');
50 52
                     break;
Please login to merge, or discard this patch.
src/Framework/Bootloader/Server/LegacyRoadRunnerBootloader.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -39,15 +39,15 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function boot(Container $container)
41 41
     {
42
-        $container->bindSingleton(RPC::class, function (EnvironmentInterface $env) {
42
+        $container->bindSingleton(RPC::class, function (EnvironmentInterface $env){
43 43
             return $this->rpc($env);
44 44
         });
45 45
 
46
-        $container->bindSingleton(Worker::class, function (EnvironmentInterface $env) {
46
+        $container->bindSingleton(Worker::class, function (EnvironmentInterface $env){
47 47
             return $this->worker($env);
48 48
         });
49 49
 
50
-        $container->bindSingleton(MetricsInterface::class, function (RPC $rpc) {
50
+        $container->bindSingleton(MetricsInterface::class, function (RPC $rpc){
51 51
             return new Metrics($rpc);
52 52
         });
53 53
     }
@@ -60,21 +60,21 @@  discard block
 block discarded – undo
60 60
     {
61 61
         $conn = $env->get('RR_RPC', self::RPC_DEFAULT);
62 62
 
63
-        if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) {
63
+        if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)){
64 64
             throw new BootException(
65 65
                 "Unable to configure RPC connection, invalid DSN given `{$conn}`."
66 66
             );
67 67
         }
68 68
 
69
-        if (!in_array($parts[1], ['tcp', 'unix'])) {
69
+        if (!in_array($parts[1], ['tcp', 'unix'])){
70 70
             throw new BootException(
71 71
                 "Unable to configure RPC connection, invalid DSN given `{$conn}`."
72 72
             );
73 73
         }
74 74
 
75
-        if ($parts[1] == 'unix') {
75
+        if ($parts[1] == 'unix'){
76 76
             $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX);
77
-        } else {
77
+        }else{
78 78
             $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP);
79 79
         }
80 80
 
@@ -89,25 +89,25 @@  discard block
 block discarded – undo
89 89
     {
90 90
         $conn = $env->get('RR_RELAY', self::WORKER_DEFAULT);
91 91
 
92
-        if ($conn === 'pipes' || empty($conn)) {
92
+        if ($conn === 'pipes' || empty($conn)){
93 93
             return new Worker(new StreamRelay(STDIN, STDOUT));
94 94
         }
95 95
 
96
-        if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) {
96
+        if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)){
97 97
             throw new BootException(
98 98
                 "Unable to configure Worker connection, invalid DSN given `{$conn}`."
99 99
             );
100 100
         }
101 101
 
102
-        if (!in_array($parts[1], ['tcp', 'unix'])) {
102
+        if (!in_array($parts[1], ['tcp', 'unix'])){
103 103
             throw new BootException(
104 104
                 "Unable to configure Worker connection, invalid DSN given `{$conn}`."
105 105
             );
106 106
         }
107 107
 
108
-        if ($parts[1] == 'unix') {
108
+        if ($parts[1] == 'unix'){
109 109
             $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX);
110
-        } else {
110
+        }else{
111 111
             $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP);
112 112
         }
113 113
 
Please login to merge, or discard this patch.
Braces   +26 added lines, -12 removed lines patch added patch discarded remove patch
@@ -39,15 +39,18 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function boot(Container $container)
41 41
     {
42
-        $container->bindSingleton(RPC::class, function (EnvironmentInterface $env) {
42
+        $container->bindSingleton(RPC::class, function (EnvironmentInterface $env)
43
+        {
43 44
             return $this->rpc($env);
44 45
         });
45 46
 
46
-        $container->bindSingleton(Worker::class, function (EnvironmentInterface $env) {
47
+        $container->bindSingleton(Worker::class, function (EnvironmentInterface $env)
48
+        {
47 49
             return $this->worker($env);
48 50
         });
49 51
 
50
-        $container->bindSingleton(MetricsInterface::class, function (RPC $rpc) {
52
+        $container->bindSingleton(MetricsInterface::class, function (RPC $rpc)
53
+        {
51 54
             return new Metrics($rpc);
52 55
         });
53 56
     }
@@ -60,21 +63,26 @@  discard block
 block discarded – undo
60 63
     {
61 64
         $conn = $env->get('RR_RPC', self::RPC_DEFAULT);
62 65
 
63
-        if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) {
66
+        if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts))
67
+        {
64 68
             throw new BootException(
65 69
                 "Unable to configure RPC connection, invalid DSN given `{$conn}`."
66 70
             );
67 71
         }
68 72
 
69
-        if (!in_array($parts[1], ['tcp', 'unix'])) {
73
+        if (!in_array($parts[1], ['tcp', 'unix']))
74
+        {
70 75
             throw new BootException(
71 76
                 "Unable to configure RPC connection, invalid DSN given `{$conn}`."
72 77
             );
73 78
         }
74 79
 
75
-        if ($parts[1] == 'unix') {
80
+        if ($parts[1] == 'unix')
81
+        {
76 82
             $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX);
77
-        } else {
83
+        }
84
+        else
85
+        {
78 86
             $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP);
79 87
         }
80 88
 
@@ -89,25 +97,31 @@  discard block
 block discarded – undo
89 97
     {
90 98
         $conn = $env->get('RR_RELAY', self::WORKER_DEFAULT);
91 99
 
92
-        if ($conn === 'pipes' || empty($conn)) {
100
+        if ($conn === 'pipes' || empty($conn))
101
+        {
93 102
             return new Worker(new StreamRelay(STDIN, STDOUT));
94 103
         }
95 104
 
96
-        if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts)) {
105
+        if (!preg_match('#^([a-z]+)://([^:]+):?(\d+)?$#i', $conn, $parts))
106
+        {
97 107
             throw new BootException(
98 108
                 "Unable to configure Worker connection, invalid DSN given `{$conn}`."
99 109
             );
100 110
         }
101 111
 
102
-        if (!in_array($parts[1], ['tcp', 'unix'])) {
112
+        if (!in_array($parts[1], ['tcp', 'unix']))
113
+        {
103 114
             throw new BootException(
104 115
                 "Unable to configure Worker connection, invalid DSN given `{$conn}`."
105 116
             );
106 117
         }
107 118
 
108
-        if ($parts[1] == 'unix') {
119
+        if ($parts[1] == 'unix')
120
+        {
109 121
             $relay = new SocketRelay($parts[2], null, SocketRelay::SOCK_UNIX);
110
-        } else {
122
+        }
123
+        else
124
+        {
111 125
             $relay = new SocketRelay($parts[2], (int)$parts[3], SocketRelay::SOCK_TCP);
112 126
         }
113 127
 
Please login to merge, or discard this patch.
src/Framework/Bootloader/ServerBootloader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
      */
43 43
     private function isLegacy(): bool
44 44
     {
45
-        if (\class_exists(InstalledVersions::class)) {
45
+        if (\class_exists(InstalledVersions::class)){
46 46
             $version = InstalledVersions::getVersion('spiral/roadrunner');
47 47
 
48 48
             return \str_starts_with($version, '1.');
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,8 @@
 block discarded – undo
42 42
      */
43 43
     private function isLegacy(): bool
44 44
     {
45
-        if (\class_exists(InstalledVersions::class)) {
45
+        if (\class_exists(InstalledVersions::class))
46
+        {
46 47
             $version = InstalledVersions::getVersion('spiral/roadrunner');
47 48
 
48 49
             return \str_starts_with($version, '1.');
Please login to merge, or discard this patch.
src/Framework/Bootloader/Jobs/JobsBootloader.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,12 +47,12 @@
 block discarded – undo
47 47
     {
48 48
         $kernel->addDispatcher($jobs);
49 49
 
50
-        if (\class_exists(LegacyRPC::class)) {
51
-            $container->bindSingleton(QueueInterface::class, function (LegacyRPC $rpc, JobRegistry $registry) {
50
+        if (\class_exists(LegacyRPC::class)){
51
+            $container->bindSingleton(QueueInterface::class, function (LegacyRPC $rpc, JobRegistry $registry){
52 52
                 return new JobQueue($rpc, $registry);
53 53
             });
54
-        } else {
55
-            $container->bindSingleton(QueueInterface::class, function (RPC $rpc, JobRegistry $registry) {
54
+        }else{
55
+            $container->bindSingleton(QueueInterface::class, function (RPC $rpc, JobRegistry $registry){
56 56
                 return new JobQueue($rpc, $registry);
57 57
             });
58 58
         }
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,12 +47,17 @@
 block discarded – undo
47 47
     {
48 48
         $kernel->addDispatcher($jobs);
49 49
 
50
-        if (\class_exists(LegacyRPC::class)) {
51
-            $container->bindSingleton(QueueInterface::class, function (LegacyRPC $rpc, JobRegistry $registry) {
50
+        if (\class_exists(LegacyRPC::class))
51
+        {
52
+            $container->bindSingleton(QueueInterface::class, function (LegacyRPC $rpc, JobRegistry $registry)
53
+            {
52 54
                 return new JobQueue($rpc, $registry);
53 55
             });
54
-        } else {
55
-            $container->bindSingleton(QueueInterface::class, function (RPC $rpc, JobRegistry $registry) {
56
+        }
57
+        else
58
+        {
59
+            $container->bindSingleton(QueueInterface::class, function (RPC $rpc, JobRegistry $registry)
60
+            {
56 61
                 return new JobQueue($rpc, $registry);
57 62
             });
58 63
         }
Please login to merge, or discard this patch.
src/Dumper/src/Dumper.php 3 patches
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      * Directives for dump output forwarding.
31 31
      */
32 32
     public const OUTPUT            = 0;
33
-    public const RETURN            = 1;
33
+    public const return            = 1;
34 34
     public const LOGGER            = 2;
35 35
     public const ERROR_LOG         = 3;
36 36
     public const OUTPUT_CLI        = 4;
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         self::OUTPUT            => HtmlRenderer::class,
50 50
         self::OUTPUT_CLI        => PlainRenderer::class,
51 51
         self::OUTPUT_CLI_COLORS => ConsoleRenderer::class,
52
-        self::RETURN            => HtmlRenderer::class,
52
+        self::return            => HtmlRenderer::class,
53 53
         self::LOGGER            => PlainRenderer::class,
54 54
         self::ERROR_LOG         => PlainRenderer::class,
55 55
         self::ROADRUNNER        => PlainRenderer::class,
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
                 break;
95 95
 
96 96
             case self::ROADRUNNER:
97
-            case self::RETURN:
97
+            case self::return:
98 98
                 return $dump;
99 99
 
100 100
             case self::LOGGER:
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
     public function __construct(LoggerInterface $logger = null)
59 59
     {
60
-        if ($logger !== null) {
60
+        if ($logger !== null){
61 61
             $this->setLogger($logger);
62 62
         }
63 63
     }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         $r = $this->getRenderer($target);
84 84
         $dump = $r->wrapContent($this->renderValue($r, $value));
85 85
 
86
-        switch ($target) {
86
+        switch ($target){
87 87
             case self::OUTPUT:
88 88
                 echo $dump;
89 89
                 break;
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
                 return $dump;
94 94
 
95 95
             case self::LOGGER:
96
-                if ($this->logger === null) {
96
+                if ($this->logger === null){
97 97
                     throw new DumperException('Unable to dump value to log, no associated LoggerInterface.');
98 98
                 }
99
-                $this->logger->debug((string) $dump);
99
+                $this->logger->debug((string)$dump);
100 100
                 break;
101 101
 
102 102
             case self::ERROR_LOG:
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      */
115 115
     public function setRenderer(int $target, RendererInterface $renderer): Dumper
116 116
     {
117
-        if (!isset($this->targets[$target])) {
117
+        if (!isset($this->targets[$target])){
118 118
             throw new DumperException(sprintf('Undefined dump target %d', $target));
119 119
         }
120 120
 
@@ -131,19 +131,19 @@  discard block
 block discarded – undo
131 131
      */
132 132
     private function getRenderer(int $target): RendererInterface
133 133
     {
134
-        if ($target == self::OUTPUT && System::isCLI()) {
135
-            if (System::isColorsSupported(STDOUT)) {
134
+        if ($target == self::OUTPUT && System::isCLI()){
135
+            if (System::isColorsSupported(STDOUT)){
136 136
                 $target = self::OUTPUT_CLI_COLORS;
137
-            } else {
137
+            }else{
138 138
                 $target = self::OUTPUT_CLI;
139 139
             }
140 140
         }
141 141
 
142
-        if (!isset($this->targets[$target])) {
142
+        if (!isset($this->targets[$target])){
143 143
             throw new DumperException(sprintf('Undefined dump target %d', $target));
144 144
         }
145 145
 
146
-        if (is_string($this->targets[$target])) {
146
+        if (is_string($this->targets[$target])){
147 147
             $this->targets[$target] = new $this->targets[$target]();
148 148
         }
149 149
 
@@ -166,32 +166,32 @@  discard block
 block discarded – undo
166 166
         int $level = 0,
167 167
         bool $hideHeader = false
168 168
     ): string {
169
-        if (!$hideHeader && !empty($name)) {
170
-            $header = $r->indent($level) . $r->apply($name, 'name') . $r->apply(' = ', 'syntax', '=');
171
-        } else {
169
+        if (!$hideHeader && !empty($name)){
170
+            $header = $r->indent($level).$r->apply($name, 'name').$r->apply(' = ', 'syntax', '=');
171
+        }else{
172 172
             $header = $r->indent($level);
173 173
         }
174 174
 
175
-        if ($level > $this->maxLevel) {
175
+        if ($level > $this->maxLevel){
176 176
             //Renderer is not reference based, we can't dump too deep values
177
-            return $r->indent($level) . $r->apply('-too deep-', 'maxLevel') . "\n";
177
+            return $r->indent($level).$r->apply('-too deep-', 'maxLevel')."\n";
178 178
         }
179 179
 
180 180
         $type = strtolower(gettype($value));
181 181
 
182
-        if ($type === 'array') {
183
-            return $header . $this->renderArray($r, $value, $level, $hideHeader);
182
+        if ($type === 'array'){
183
+            return $header.$this->renderArray($r, $value, $level, $hideHeader);
184 184
         }
185 185
 
186
-        if ($type === 'object') {
187
-            return $header . $this->renderObject($r, $value, $level, $hideHeader);
186
+        if ($type === 'object'){
187
+            return $header.$this->renderObject($r, $value, $level, $hideHeader);
188 188
         }
189 189
 
190
-        if ($type === 'resource') {
190
+        if ($type === 'resource'){
191 191
             //No need to dump resource value
192
-            $element = get_resource_type($value) . ' resource ';
192
+            $element = get_resource_type($value).' resource ';
193 193
 
194
-            return $header . $r->apply($element, 'type', 'resource') . "\n";
194
+            return $header.$r->apply($element, 'type', 'resource')."\n";
195 195
         }
196 196
 
197 197
         //Value length
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         $header .= $r->apply("{$type}({$length})", 'type', $type);
202 202
 
203 203
         $element = null;
204
-        switch ($type) {
204
+        switch ($type){
205 205
             case 'string':
206 206
                 $element = $r->escapeStrings() ? htmlspecialchars($value) : $value;
207 207
                 break;
@@ -211,31 +211,31 @@  discard block
 block discarded – undo
211 211
                 break;
212 212
 
213 213
             default:
214
-                if ($value !== null) {
214
+                if ($value !== null){
215 215
                     //Not showing null value, type is enough
216 216
                     $element = var_export($value, true);
217 217
                 }
218 218
         }
219 219
 
220 220
         //Including value
221
-        return $header . ' ' . $r->apply($element, 'value', $type) . "\n";
221
+        return $header.' '.$r->apply($element, 'value', $type)."\n";
222 222
     }
223 223
 
224 224
     private function renderArray(RendererInterface $r, array $array, int $level, bool $hideHeader = false): string
225 225
     {
226
-        if (!$hideHeader) {
226
+        if (!$hideHeader){
227 227
             $count = count($array);
228 228
 
229 229
             //Array size and scope
230
-            $output = $r->apply("array({$count})", 'type', 'array') . "\n";
231
-            $output .= $r->indent($level) . $r->apply('[', 'syntax', '[') . "\n";
232
-        } else {
230
+            $output = $r->apply("array({$count})", 'type', 'array')."\n";
231
+            $output .= $r->indent($level).$r->apply('[', 'syntax', '[')."\n";
232
+        }else{
233 233
             $output = '';
234 234
         }
235 235
 
236
-        foreach ($array as $key => $value) {
237
-            if (!is_numeric($key)) {
238
-                if (is_string($key) && $r->escapeStrings()) {
236
+        foreach ($array as $key => $value){
237
+            if (!is_numeric($key)){
238
+                if (is_string($key) && $r->escapeStrings()){
239 239
                     $key = htmlspecialchars($key);
240 240
                 }
241 241
 
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
             $output .= $this->renderValue($r, $value, "[{$key}]", $level + 1);
246 246
         }
247 247
 
248
-        if (!$hideHeader) {
248
+        if (!$hideHeader){
249 249
             //Closing array scope
250
-            $output .= $r->indent($level) . $r->apply(']', 'syntax', ']') . "\n";
250
+            $output .= $r->indent($level).$r->apply(']', 'syntax', ']')."\n";
251 251
         }
252 252
 
253 253
         return $output;
@@ -264,47 +264,47 @@  discard block
 block discarded – undo
264 264
         bool $hideHeader = false,
265 265
         string $class = ''
266 266
     ): string {
267
-        if (!$hideHeader) {
268
-            $type = ($class ?: get_class($value)) . ' object ';
267
+        if (!$hideHeader){
268
+            $type = ($class ?: get_class($value)).' object ';
269 269
 
270
-            $header = $r->apply($type, 'type', 'object') . "\n";
271
-            $header .= $r->indent($level) . $r->apply('(', 'syntax', '(') . "\n";
272
-        } else {
270
+            $header = $r->apply($type, 'type', 'object')."\n";
271
+            $header .= $r->indent($level).$r->apply('(', 'syntax', '(')."\n";
272
+        }else{
273 273
             $header = '';
274 274
         }
275 275
 
276 276
         //Let's use method specifically created for dumping
277
-        if (method_exists($value, '__debugInfo') || $value instanceof \Closure) {
278
-            if ($value instanceof \Closure) {
277
+        if (method_exists($value, '__debugInfo') || $value instanceof \Closure){
278
+            if ($value instanceof \Closure){
279 279
                 $debugInfo = $this->describeClosure($value);
280
-            } else {
280
+            }else{
281 281
                 $debugInfo = $value->__debugInfo();
282 282
             }
283 283
 
284
-            if (is_array($debugInfo)) {
284
+            if (is_array($debugInfo)){
285 285
                 //Pretty view
286 286
                 $debugInfo = (object)$debugInfo;
287 287
             }
288 288
 
289
-            if (is_object($debugInfo)) {
289
+            if (is_object($debugInfo)){
290 290
                 //We are not including syntax elements here
291 291
                 return $this->renderObject($r, $debugInfo, $level, false, get_class($value));
292 292
             }
293 293
 
294 294
             return $header
295 295
                 . $this->renderValue($r, $debugInfo, '', $level + (is_scalar($value)), true)
296
-                . $r->indent($level) . $r->apply(')', 'syntax', ')') . "\n";
296
+                . $r->indent($level).$r->apply(')', 'syntax', ')')."\n";
297 297
         }
298 298
 
299 299
         $refection = new \ReflectionObject($value);
300 300
 
301 301
         $output = '';
302
-        foreach ($refection->getProperties() as $property) {
302
+        foreach ($refection->getProperties() as $property){
303 303
             $output .= $this->renderProperty($r, $value, $property, $level);
304 304
         }
305 305
 
306 306
         //Header, content, footer
307
-        return $header . $output . $r->indent($level) . $r->apply(')', 'syntax', ')') . "\n";
307
+        return $header.$output.$r->indent($level).$r->apply(')', 'syntax', ')')."\n";
308 308
     }
309 309
 
310 310
     /**
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
      */
314 314
     private function renderProperty(RendererInterface $r, $value, \ReflectionProperty $p, int $level): string
315 315
     {
316
-        if ($p->isStatic()) {
316
+        if ($p->isStatic()){
317 317
             return '';
318 318
         }
319 319
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
             !($value instanceof \stdClass)
322 322
             && is_string($p->getDocComment())
323 323
             && strpos($p->getDocComment(), '@internal') !== false
324
-        ) {
324
+        ){
325 325
             // Memory loop while reading doc comment for stdClass variables?
326 326
             // Report a PHP bug about treating comment INSIDE property declaration as doc comment.
327 327
             return '';
@@ -333,11 +333,11 @@  discard block
 block discarded – undo
333 333
         //To read private and protected properties
334 334
         $p->setAccessible(true);
335 335
 
336
-        if ($value instanceof \stdClass) {
336
+        if ($value instanceof \stdClass){
337 337
             $name = $r->apply($p->getName(), 'dynamic');
338
-        } else {
338
+        }else{
339 339
             //Property name includes access level
340
-            $name = $p->getName() . $r->apply(':' . $access, 'access', $access);
340
+            $name = $p->getName().$r->apply(':'.$access, 'access', $access);
341 341
         }
342 342
 
343 343
         return $this->renderValue($r, $p->getValue($value), $name, $level + 1);
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
      */
349 349
     private function describeClosure(\Closure $closure): array
350 350
     {
351
-        try {
351
+        try{
352 352
             $r = new \ReflectionFunction($closure);
353
-        } catch (\ReflectionException $e) {
353
+        }catch (\ReflectionException $e){
354 354
             return ['closure' => 'unable to resolve'];
355 355
         }
356 356
 
357 357
         return [
358
-            'name' => $r->getName() . " (lines {$r->getStartLine()}:{$r->getEndLine()})",
358
+            'name' => $r->getName()." (lines {$r->getStartLine()}:{$r->getEndLine()})",
359 359
             'file' => $r->getFileName(),
360 360
             'this' => $r->getClosureThis(),
361 361
         ];
@@ -368,9 +368,9 @@  discard block
 block discarded – undo
368 368
      */
369 369
     private function getAccess(\ReflectionProperty $p): string
370 370
     {
371
-        if ($p->isPrivate()) {
371
+        if ($p->isPrivate()){
372 372
             return 'private';
373
-        } elseif ($p->isProtected()) {
373
+        } elseif ($p->isProtected()){
374 374
             return 'protected';
375 375
         }
376 376
 
Please login to merge, or discard this patch.
Braces   +84 added lines, -38 removed lines patch added patch discarded remove patch
@@ -57,7 +57,8 @@  discard block
 block discarded – undo
57 57
 
58 58
     public function __construct(LoggerInterface $logger = null)
59 59
     {
60
-        if ($logger !== null) {
60
+        if ($logger !== null)
61
+        {
61 62
             $this->setLogger($logger);
62 63
         }
63 64
     }
@@ -83,7 +84,8 @@  discard block
 block discarded – undo
83 84
         $r = $this->getRenderer($target);
84 85
         $dump = $r->wrapContent($this->renderValue($r, $value));
85 86
 
86
-        switch ($target) {
87
+        switch ($target)
88
+        {
87 89
             case self::OUTPUT:
88 90
                 echo $dump;
89 91
                 break;
@@ -93,7 +95,8 @@  discard block
 block discarded – undo
93 95
                 return $dump;
94 96
 
95 97
             case self::LOGGER:
96
-                if ($this->logger === null) {
98
+                if ($this->logger === null)
99
+                {
97 100
                     throw new DumperException('Unable to dump value to log, no associated LoggerInterface.');
98 101
                 }
99 102
                 $this->logger->debug((string) $dump);
@@ -114,7 +117,8 @@  discard block
 block discarded – undo
114 117
      */
115 118
     public function setRenderer(int $target, RendererInterface $renderer): Dumper
116 119
     {
117
-        if (!isset($this->targets[$target])) {
120
+        if (!isset($this->targets[$target]))
121
+        {
118 122
             throw new DumperException(sprintf('Undefined dump target %d', $target));
119 123
         }
120 124
 
@@ -131,19 +135,25 @@  discard block
 block discarded – undo
131 135
      */
132 136
     private function getRenderer(int $target): RendererInterface
133 137
     {
134
-        if ($target == self::OUTPUT && System::isCLI()) {
135
-            if (System::isColorsSupported(STDOUT)) {
138
+        if ($target == self::OUTPUT && System::isCLI())
139
+        {
140
+            if (System::isColorsSupported(STDOUT))
141
+            {
136 142
                 $target = self::OUTPUT_CLI_COLORS;
137
-            } else {
143
+            }
144
+            else
145
+            {
138 146
                 $target = self::OUTPUT_CLI;
139 147
             }
140 148
         }
141 149
 
142
-        if (!isset($this->targets[$target])) {
150
+        if (!isset($this->targets[$target]))
151
+        {
143 152
             throw new DumperException(sprintf('Undefined dump target %d', $target));
144 153
         }
145 154
 
146
-        if (is_string($this->targets[$target])) {
155
+        if (is_string($this->targets[$target]))
156
+        {
147 157
             $this->targets[$target] = new $this->targets[$target]();
148 158
         }
149 159
 
@@ -166,28 +176,35 @@  discard block
 block discarded – undo
166 176
         int $level = 0,
167 177
         bool $hideHeader = false
168 178
     ): string {
169
-        if (!$hideHeader && !empty($name)) {
179
+        if (!$hideHeader && !empty($name))
180
+        {
170 181
             $header = $r->indent($level) . $r->apply($name, 'name') . $r->apply(' = ', 'syntax', '=');
171
-        } else {
182
+        }
183
+        else
184
+        {
172 185
             $header = $r->indent($level);
173 186
         }
174 187
 
175
-        if ($level > $this->maxLevel) {
188
+        if ($level > $this->maxLevel)
189
+        {
176 190
             //Renderer is not reference based, we can't dump too deep values
177 191
             return $r->indent($level) . $r->apply('-too deep-', 'maxLevel') . "\n";
178 192
         }
179 193
 
180 194
         $type = strtolower(gettype($value));
181 195
 
182
-        if ($type === 'array') {
196
+        if ($type === 'array')
197
+        {
183 198
             return $header . $this->renderArray($r, $value, $level, $hideHeader);
184 199
         }
185 200
 
186
-        if ($type === 'object') {
201
+        if ($type === 'object')
202
+        {
187 203
             return $header . $this->renderObject($r, $value, $level, $hideHeader);
188 204
         }
189 205
 
190
-        if ($type === 'resource') {
206
+        if ($type === 'resource')
207
+        {
191 208
             //No need to dump resource value
192 209
             $element = get_resource_type($value) . ' resource ';
193 210
 
@@ -201,7 +218,8 @@  discard block
 block discarded – undo
201 218
         $header .= $r->apply("{$type}({$length})", 'type', $type);
202 219
 
203 220
         $element = null;
204
-        switch ($type) {
221
+        switch ($type)
222
+        {
205 223
             case 'string':
206 224
                 $element = $r->escapeStrings() ? htmlspecialchars($value) : $value;
207 225
                 break;
@@ -211,7 +229,8 @@  discard block
 block discarded – undo
211 229
                 break;
212 230
 
213 231
             default:
214
-                if ($value !== null) {
232
+                if ($value !== null)
233
+                {
215 234
                     //Not showing null value, type is enough
216 235
                     $element = var_export($value, true);
217 236
                 }
@@ -223,19 +242,25 @@  discard block
 block discarded – undo
223 242
 
224 243
     private function renderArray(RendererInterface $r, array $array, int $level, bool $hideHeader = false): string
225 244
     {
226
-        if (!$hideHeader) {
245
+        if (!$hideHeader)
246
+        {
227 247
             $count = count($array);
228 248
 
229 249
             //Array size and scope
230 250
             $output = $r->apply("array({$count})", 'type', 'array') . "\n";
231 251
             $output .= $r->indent($level) . $r->apply('[', 'syntax', '[') . "\n";
232
-        } else {
252
+        }
253
+        else
254
+        {
233 255
             $output = '';
234 256
         }
235 257
 
236
-        foreach ($array as $key => $value) {
237
-            if (!is_numeric($key)) {
238
-                if (is_string($key) && $r->escapeStrings()) {
258
+        foreach ($array as $key => $value)
259
+        {
260
+            if (!is_numeric($key))
261
+            {
262
+                if (is_string($key) && $r->escapeStrings())
263
+                {
239 264
                     $key = htmlspecialchars($key);
240 265
                 }
241 266
 
@@ -245,7 +270,8 @@  discard block
 block discarded – undo
245 270
             $output .= $this->renderValue($r, $value, "[{$key}]", $level + 1);
246 271
         }
247 272
 
248
-        if (!$hideHeader) {
273
+        if (!$hideHeader)
274
+        {
249 275
             //Closing array scope
250 276
             $output .= $r->indent($level) . $r->apply(']', 'syntax', ']') . "\n";
251 277
         }
@@ -264,29 +290,38 @@  discard block
 block discarded – undo
264 290
         bool $hideHeader = false,
265 291
         string $class = ''
266 292
     ): string {
267
-        if (!$hideHeader) {
293
+        if (!$hideHeader)
294
+        {
268 295
             $type = ($class ?: get_class($value)) . ' object ';
269 296
 
270 297
             $header = $r->apply($type, 'type', 'object') . "\n";
271 298
             $header .= $r->indent($level) . $r->apply('(', 'syntax', '(') . "\n";
272
-        } else {
299
+        }
300
+        else
301
+        {
273 302
             $header = '';
274 303
         }
275 304
 
276 305
         //Let's use method specifically created for dumping
277
-        if (method_exists($value, '__debugInfo') || $value instanceof \Closure) {
278
-            if ($value instanceof \Closure) {
306
+        if (method_exists($value, '__debugInfo') || $value instanceof \Closure)
307
+        {
308
+            if ($value instanceof \Closure)
309
+            {
279 310
                 $debugInfo = $this->describeClosure($value);
280
-            } else {
311
+            }
312
+            else
313
+            {
281 314
                 $debugInfo = $value->__debugInfo();
282 315
             }
283 316
 
284
-            if (is_array($debugInfo)) {
317
+            if (is_array($debugInfo))
318
+            {
285 319
                 //Pretty view
286 320
                 $debugInfo = (object)$debugInfo;
287 321
             }
288 322
 
289
-            if (is_object($debugInfo)) {
323
+            if (is_object($debugInfo))
324
+            {
290 325
                 //We are not including syntax elements here
291 326
                 return $this->renderObject($r, $debugInfo, $level, false, get_class($value));
292 327
             }
@@ -299,7 +334,8 @@  discard block
 block discarded – undo
299 334
         $refection = new \ReflectionObject($value);
300 335
 
301 336
         $output = '';
302
-        foreach ($refection->getProperties() as $property) {
337
+        foreach ($refection->getProperties() as $property)
338
+        {
303 339
             $output .= $this->renderProperty($r, $value, $property, $level);
304 340
         }
305 341
 
@@ -313,7 +349,8 @@  discard block
 block discarded – undo
313 349
      */
314 350
     private function renderProperty(RendererInterface $r, $value, \ReflectionProperty $p, int $level): string
315 351
     {
316
-        if ($p->isStatic()) {
352
+        if ($p->isStatic())
353
+        {
317 354
             return '';
318 355
         }
319 356
 
@@ -333,9 +370,12 @@  discard block
 block discarded – undo
333 370
         //To read private and protected properties
334 371
         $p->setAccessible(true);
335 372
 
336
-        if ($value instanceof \stdClass) {
373
+        if ($value instanceof \stdClass)
374
+        {
337 375
             $name = $r->apply($p->getName(), 'dynamic');
338
-        } else {
376
+        }
377
+        else
378
+        {
339 379
             //Property name includes access level
340 380
             $name = $p->getName() . $r->apply(':' . $access, 'access', $access);
341 381
         }
@@ -348,9 +388,12 @@  discard block
 block discarded – undo
348 388
      */
349 389
     private function describeClosure(\Closure $closure): array
350 390
     {
351
-        try {
391
+        try
392
+        {
352 393
             $r = new \ReflectionFunction($closure);
353
-        } catch (\ReflectionException $e) {
394
+        }
395
+        catch (\ReflectionException $e)
396
+        {
354 397
             return ['closure' => 'unable to resolve'];
355 398
         }
356 399
 
@@ -368,9 +411,12 @@  discard block
 block discarded – undo
368 411
      */
369 412
     private function getAccess(\ReflectionProperty $p): string
370 413
     {
371
-        if ($p->isPrivate()) {
414
+        if ($p->isPrivate())
415
+        {
372 416
             return 'private';
373
-        } elseif ($p->isProtected()) {
417
+        }
418
+        elseif ($p->isProtected())
419
+        {
374 420
             return 'protected';
375 421
         }
376 422
 
Please login to merge, or discard this patch.
src/Validation/src/CheckerRule.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         string $method,
42 42
         array $args = [],
43 43
         ?string $message = null
44
-    ) {
44
+    ){
45 45
         $this->checker = $checker;
46 46
         $this->method = $method;
47 47
         $this->args = $args;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      */
70 70
     public function getMessage(string $field, $value): string
71 71
     {
72
-        if (!empty($this->message)) {
72
+        if (!empty($this->message)){
73 73
             return $this->say(
74 74
                 $this->message,
75 75
                 array_merge([$value, $field], $this->args)
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,8 @@
 block discarded – undo
69 69
      */
70 70
     public function getMessage(string $field, $value): string
71 71
     {
72
-        if (!empty($this->message)) {
72
+        if (!empty($this->message))
73
+        {
73 74
             return $this->say(
74 75
                 $this->message,
75 76
                 array_merge([$value, $field], $this->args)
Please login to merge, or discard this patch.