Passed
Pull Request — master (#370)
by Valentin
04:34
created
src/Models/src/DataEntity.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
      */
73 73
     protected function isFillable(string $field): bool
74 74
     {
75
-        if (static::FILLABLE === '*') {
75
+        if (static::FILLABLE === '*'){
76 76
             return true;
77 77
         }
78 78
 
79
-        if (!empty(static::FILLABLE)) {
79
+        if (!empty(static::FILLABLE)){
80 80
             return in_array($field, static::FILLABLE);
81 81
         }
82 82
 
83
-        if (static::SECURED === '*') {
83
+        if (static::SECURED === '*'){
84 84
             return false;
85 85
         }
86 86
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     protected function getMutator(string $field, string $mutator)
100 100
     {
101 101
         $target = [];
102
-        switch ($mutator) {
102
+        switch ($mutator){
103 103
             case ModelSchema::MUTATOR_ACCESSOR:
104 104
                 $target = static::ACCESSORS;
105 105
                 break;
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                 break;
112 112
         }
113 113
 
114
-        if (isset($target[$field])) {
114
+        if (isset($target[$field])){
115 115
             return $target[$field];
116 116
         }
117 117
 
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -72,15 +72,18 @@  discard block
 block discarded – undo
72 72
      */
73 73
     protected function isFillable(string $field): bool
74 74
     {
75
-        if (static::FILLABLE === '*') {
75
+        if (static::FILLABLE === '*')
76
+        {
76 77
             return true;
77 78
         }
78 79
 
79
-        if (!empty(static::FILLABLE)) {
80
+        if (!empty(static::FILLABLE))
81
+        {
80 82
             return in_array($field, static::FILLABLE);
81 83
         }
82 84
 
83
-        if (static::SECURED === '*') {
85
+        if (static::SECURED === '*')
86
+        {
84 87
             return false;
85 88
         }
86 89
 
@@ -99,7 +102,8 @@  discard block
 block discarded – undo
99 102
     protected function getMutator(string $field, string $mutator)
100 103
     {
101 104
         $target = [];
102
-        switch ($mutator) {
105
+        switch ($mutator)
106
+        {
103 107
             case ModelSchema::MUTATOR_ACCESSOR:
104 108
                 $target = static::ACCESSORS;
105 109
                 break;
@@ -111,7 +115,8 @@  discard block
 block discarded – undo
111 115
                 break;
112 116
         }
113 117
 
114
-        if (isset($target[$field])) {
118
+        if (isset($target[$field]))
119
+        {
115 120
             return $target[$field];
116 121
         }
117 122
 
Please login to merge, or discard this patch.
src/Models/src/SchematicEntity.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
      */
35 35
     protected function isFillable(string $field): bool
36 36
     {
37
-        if (!empty($this->schema[ModelSchema::FILLABLE]) && $this->schema[ModelSchema::FILLABLE] === '*') {
37
+        if (!empty($this->schema[ModelSchema::FILLABLE]) && $this->schema[ModelSchema::FILLABLE] === '*'){
38 38
             return true;
39 39
         }
40 40
 
41
-        if (!empty($this->schema[ModelSchema::FILLABLE])) {
41
+        if (!empty($this->schema[ModelSchema::FILLABLE])){
42 42
             return in_array($field, $this->schema[ModelSchema::FILLABLE]);
43 43
         }
44 44
 
45
-        if (!empty($this->schema[ModelSchema::SECURED]) && $this->schema[ModelSchema::SECURED] === '*') {
45
+        if (!empty($this->schema[ModelSchema::SECURED]) && $this->schema[ModelSchema::SECURED] === '*'){
46 46
             return false;
47 47
         }
48 48
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     protected function getMutator(string $field, string $mutator)
56 56
     {
57
-        if (isset($this->schema[ModelSchema::MUTATORS][$mutator][$field])) {
57
+        if (isset($this->schema[ModelSchema::MUTATORS][$mutator][$field])){
58 58
             return $this->schema[ModelSchema::MUTATORS][$mutator][$field];
59 59
         }
60 60
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,15 +34,18 @@  discard block
 block discarded – undo
34 34
      */
35 35
     protected function isFillable(string $field): bool
36 36
     {
37
-        if (!empty($this->schema[ModelSchema::FILLABLE]) && $this->schema[ModelSchema::FILLABLE] === '*') {
37
+        if (!empty($this->schema[ModelSchema::FILLABLE]) && $this->schema[ModelSchema::FILLABLE] === '*')
38
+        {
38 39
             return true;
39 40
         }
40 41
 
41
-        if (!empty($this->schema[ModelSchema::FILLABLE])) {
42
+        if (!empty($this->schema[ModelSchema::FILLABLE]))
43
+        {
42 44
             return in_array($field, $this->schema[ModelSchema::FILLABLE]);
43 45
         }
44 46
 
45
-        if (!empty($this->schema[ModelSchema::SECURED]) && $this->schema[ModelSchema::SECURED] === '*') {
47
+        if (!empty($this->schema[ModelSchema::SECURED]) && $this->schema[ModelSchema::SECURED] === '*')
48
+        {
46 49
             return false;
47 50
         }
48 51
 
@@ -54,7 +57,8 @@  discard block
 block discarded – undo
54 57
      */
55 58
     protected function getMutator(string $field, string $mutator)
56 59
     {
57
-        if (isset($this->schema[ModelSchema::MUTATORS][$mutator][$field])) {
60
+        if (isset($this->schema[ModelSchema::MUTATORS][$mutator][$field]))
61
+        {
58 62
             return $this->schema[ModelSchema::MUTATORS][$mutator][$field];
59 63
         }
60 64
 
Please login to merge, or discard this patch.
src/Models/tests/GetEntity.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 
21 21
     protected static function filter($v)
22 22
     {
23
-        if (is_array($v)) {
23
+        if (is_array($v)){
24 24
             throw new RuntimeException("can't be array");
25 25
         }
26 26
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,8 @@
 block discarded – undo
20 20
 
21 21
     protected static function filter($v)
22 22
     {
23
-        if (is_array($v)) {
23
+        if (is_array($v))
24
+        {
24 25
             throw new RuntimeException("can't be array");
25 26
         }
26 27
 
Please login to merge, or discard this patch.
src/Models/tests/DataEntityTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
         $this->assertEquals([], $entity->getValue());
76 76
 
77 77
         $entity['a'] = 90;
78
-        foreach ($entity as $key => $value) {
78
+        foreach ($entity as $key => $value){
79 79
             $this->assertSame('a', $key);
80 80
             $this->assertSame(90, $value);
81 81
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,8 @@
 block discarded – undo
75 75
         $this->assertEquals([], $entity->getValue());
76 76
 
77 77
         $entity['a'] = 90;
78
-        foreach ($entity as $key => $value) {
78
+        foreach ($entity as $key => $value)
79
+        {
79 80
             $this->assertSame('a', $key);
80 81
             $this->assertSame(90, $value);
81 82
         }
Please login to merge, or discard this patch.
src/Models/tests/NullableEntity.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 
21 21
     protected function isNullable(string $field): bool
22 22
     {
23
-        if (parent::isNullable($field)) {
23
+        if (parent::isNullable($field)){
24 24
             return true;
25 25
         }
26 26
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,8 @@
 block discarded – undo
20 20
 
21 21
     protected function isNullable(string $field): bool
22 22
     {
23
-        if (parent::isNullable($field)) {
23
+        if (parent::isNullable($field))
24
+        {
24 25
             return true;
25 26
         }
26 27
 
Please login to merge, or discard this patch.
src/Auth/src/AuthContext.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,11 +68,11 @@
 block discarded – undo
68 68
      */
69 69
     public function getActor(): ?object
70 70
     {
71
-        if ($this->closed) {
71
+        if ($this->closed){
72 72
             return null;
73 73
         }
74 74
 
75
-        if ($this->actor === null && $this->token !== null) {
75
+        if ($this->actor === null && $this->token !== null){
76 76
             $this->actor = $this->actorProvider->getActor($this->token);
77 77
         }
78 78
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,11 +68,13 @@
 block discarded – undo
68 68
      */
69 69
     public function getActor(): ?object
70 70
     {
71
-        if ($this->closed) {
71
+        if ($this->closed)
72
+        {
72 73
             return null;
73 74
         }
74 75
 
75
-        if ($this->actor === null && $this->token !== null) {
76
+        if ($this->actor === null && $this->token !== null)
77
+        {
76 78
             $this->actor = $this->actorProvider->getActor($this->token);
77 79
         }
78 80
 
Please login to merge, or discard this patch.
src/Dumper/tests/DumperTest.php 2 patches
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -89,7 +89,8 @@  discard block
 block discarded – undo
89 89
     {
90 90
         $d = $this->makeDumper();
91 91
 
92
-        $result = $d->dump(new class() {
92
+        $result = $d->dump(new class()
93
+        {
93 94
             private $name = 'Test';
94 95
         }, Dumper::RETURN);
95 96
 
@@ -151,7 +152,8 @@  discard block
 block discarded – undo
151 152
     public function testDebugInfo(): void
152 153
     {
153 154
         $d = $this->makeDumper();
154
-        $result = $d->dump(new class() {
155
+        $result = $d->dump(new class()
156
+        {
155 157
             protected $inner = '_kk_';
156 158
 
157 159
             public function __debugInfo()
@@ -171,7 +173,8 @@  discard block
 block discarded – undo
171 173
     public function testinternal(): void
172 174
     {
173 175
         $d = $this->makeDumper();
174
-        $result = $d->dump(new class() {
176
+        $result = $d->dump(new class()
177
+        {
175 178
             protected $visible = '_kk_';
176 179
 
177 180
             /** @internal */
@@ -198,7 +201,8 @@  discard block
 block discarded – undo
198 201
         $d = $this->makeDumper();
199 202
         $d->setRenderer(Dumper::RETURN, new HtmlRenderer());
200 203
 
201
-        $result = $d->dump(new class() {
204
+        $result = $d->dump(new class()
205
+        {
202 206
             protected static $static = 'yes';
203 207
 
204 208
             private $value = 123;
@@ -222,7 +226,8 @@  discard block
 block discarded – undo
222 226
         $d->setRenderer(Dumper::RETURN, new HtmlRenderer(HtmlRenderer::INVERTED));
223 227
         $d->setMaxLevel(5);
224 228
 
225
-        $result = $d->dump(new class() {
229
+        $result = $d->dump(new class()
230
+        {
226 231
             private $value = 123;
227 232
 
228 233
             protected $visible = '_kk_';
@@ -246,7 +251,8 @@  discard block
 block discarded – undo
246 251
         $d->setRenderer(Dumper::RETURN, new ConsoleRenderer());
247 252
         $d->setMaxLevel(5);
248 253
 
249
-        $result = $d->dump(new class() {
254
+        $result = $d->dump(new class()
255
+        {
250 256
             private $value = 123;
251 257
 
252 258
             protected $visible = '_kk_';
Please login to merge, or discard this patch.
Upper-Lower-Casing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
         $d->dump(1);
30 30
         $result = ob_get_clean();
31 31
 
32
-        $this->assertSame($d->dump(1, Dumper::RETURN), $result);
32
+        $this->assertSame($d->dump(1, Dumper::return), $result);
33 33
     }
34 34
 
35 35
     private function makeDumper(LoggerInterface $logger = null)
36 36
     {
37 37
         $d = new Dumper($logger);
38 38
         $d->setRenderer(Dumper::OUTPUT, new PlainRenderer());
39
-        $d->setRenderer(Dumper::RETURN, new PlainRenderer());
39
+        $d->setRenderer(Dumper::return, new PlainRenderer());
40 40
         $d->setRenderer(Dumper::OUTPUT_CLI_COLORS, new PlainRenderer());
41 41
 
42 42
         return $d;
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     public function testScalar(): void
46 46
     {
47 47
         $d = $this->makeDumper();
48
-        $result = $d->dump(123, Dumper::RETURN);
48
+        $result = $d->dump(123, Dumper::return);
49 49
 
50 50
         $this->assertStringContainsString('123', $result);
51 51
     }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     public function testString(): void
54 54
     {
55 55
         $d = $this->makeDumper();
56
-        $result = $d->dump('hello world', Dumper::RETURN);
56
+        $result = $d->dump('hello world', Dumper::return);
57 57
 
58 58
         $this->assertStringContainsString('hello world', $result);
59 59
     }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     public function testResource(): void
62 62
     {
63 63
         $d = $this->makeDumper();
64
-        $result = $d->dump(STDOUT, Dumper::RETURN);
64
+        $result = $d->dump(STDOUT, Dumper::return);
65 65
 
66 66
         $this->assertStringContainsString('resource', $result);
67 67
     }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     public function testHTML(): void
70 70
     {
71 71
         $d = $this->makeDumper();
72
-        $result = $d->dump('hello <br/>world', Dumper::RETURN);
72
+        $result = $d->dump('hello <br/>world', Dumper::return);
73 73
 
74 74
         $this->assertStringContainsString('hello &lt;br/&gt;world', $result);
75 75
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     public function testArray(): void
78 78
     {
79 79
         $d = $this->makeDumper();
80
-        $result = $d->dump(['G', 'B', 'N'], Dumper::RETURN);
80
+        $result = $d->dump(['G', 'B', 'N'], Dumper::return);
81 81
 
82 82
         $this->assertStringContainsString('array', $result);
83 83
         $this->assertStringContainsString('G', $result);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
         $result = $d->dump(new class() {
93 93
             private $name = 'Test';
94
-        }, Dumper::RETURN);
94
+        }, Dumper::return);
95 95
 
96 96
         $this->assertStringContainsString('object', $result);
97 97
         $this->assertStringContainsString('private', $result);
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
         $result = $d->dump(static function (): void {
108 108
             echo 'hello world';
109
-        }, Dumper::RETURN);
109
+        }, Dumper::return);
110 110
 
111 111
         $this->assertStringContainsString('Closure', $result);
112 112
         $this->assertStringContainsString('DumperTest.php', $result);
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         $mock = $this->createMock(LoggerInterface::class);
118 118
         $d = $this->makeDumper($mock);
119 119
 
120
-        $mock->method('debug')->with($d->dump('abc', Dumper::RETURN));
120
+        $mock->method('debug')->with($d->dump('abc', Dumper::return));
121 121
         $this->assertNull($d->dump('abc', Dumper::LOGGER));
122 122
     }
123 123
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
                     '_magic_' => '_value_',
161 161
                 ];
162 162
             }
163
-        }, Dumper::RETURN);
163
+        }, Dumper::return);
164 164
 
165 165
         $this->assertStringContainsString('_magic_', $result);
166 166
         $this->assertStringContainsString('_value_', $result);
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
             /** @internal */
178 178
             protected $internal = '_ok_';
179
-        }, Dumper::RETURN);
179
+        }, Dumper::return);
180 180
 
181 181
         $this->assertStringContainsString('visible', $result);
182 182
         $this->assertStringContainsString('_kk_', $result);
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     public function testHtmlRenderer(): void
197 197
     {
198 198
         $d = $this->makeDumper();
199
-        $d->setRenderer(Dumper::RETURN, new HtmlRenderer());
199
+        $d->setRenderer(Dumper::return, new HtmlRenderer());
200 200
 
201 201
         $result = $d->dump(new class() {
202 202
             protected static $static = 'yes';
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
             /** @internal */
209 209
             protected $internal = '_ok_';
210
-        }, Dumper::RETURN);
210
+        }, Dumper::return);
211 211
 
212 212
         $this->assertStringContainsString('visible', $result);
213 213
         $this->assertStringContainsString('_kk_', $result);
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     public function testInvertedRenderer(): void
220 220
     {
221 221
         $d = $this->makeDumper();
222
-        $d->setRenderer(Dumper::RETURN, new HtmlRenderer(HtmlRenderer::INVERTED));
222
+        $d->setRenderer(Dumper::return, new HtmlRenderer(HtmlRenderer::INVERTED));
223 223
         $d->setMaxLevel(5);
224 224
 
225 225
         $result = $d->dump(new class() {
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
             /** @internal */
233 233
             protected $internal = '_ok_';
234
-        }, Dumper::RETURN);
234
+        }, Dumper::return);
235 235
 
236 236
         $this->assertStringContainsString('visible', $result);
237 237
         $this->assertStringContainsString('_kk_', $result);
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     public function testConsoleRenderer(): void
244 244
     {
245 245
         $d = $this->makeDumper();
246
-        $d->setRenderer(Dumper::RETURN, new ConsoleRenderer());
246
+        $d->setRenderer(Dumper::return, new ConsoleRenderer());
247 247
         $d->setMaxLevel(5);
248 248
 
249 249
         $result = $d->dump(new class() {
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 
256 256
             /** @internal */
257 257
             protected $internal = '_ok_';
258
-        }, Dumper::RETURN);
258
+        }, Dumper::return);
259 259
 
260 260
         $this->assertStringContainsString('visible', $result);
261 261
         $this->assertStringContainsString('_kk_', $result);
Please login to merge, or discard this patch.
src/Dumper/src/System.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public static function isCLI(): bool
26 26
     {
27
-        if (!empty(getenv('RR'))) {
27
+        if (!empty(getenv('RR'))){
28 28
             // Do not treat RoadRunner as CLI.
29 29
             return false;
30 30
         }
31 31
 
32
-        if (php_sapi_name() === 'cli') {
32
+        if (php_sapi_name() === 'cli'){
33 33
             return true;
34 34
         }
35 35
 
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public static function isColorsSupported($stream = STDOUT): bool
48 48
     {
49
-        if ('Hyper' === getenv('TERM_PROGRAM')) {
49
+        if ('Hyper' === getenv('TERM_PROGRAM')){
50 50
             return true;
51 51
         }
52 52
 
53
-        try {
54
-            if (\DIRECTORY_SEPARATOR === '\\') {
53
+        try{
54
+            if (\DIRECTORY_SEPARATOR === '\\'){
55 55
                 return (
56 56
                         function_exists('sapi_windows_vt100_support')
57 57
                         && @sapi_windows_vt100_support($stream)
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
                     || getenv('TERM') == 'xterm';
61 61
             }
62 62
 
63
-            if (\function_exists('stream_isatty')) {
63
+            if (\function_exists('stream_isatty')){
64 64
                 return @stream_isatty($stream);
65 65
             }
66 66
 
67
-            if (\function_exists('posix_isatty')) {
67
+            if (\function_exists('posix_isatty')){
68 68
                 return @posix_isatty($stream);
69 69
             }
70 70
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
             // Check if formatted mode is S_IFCHR
74 74
             return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
75
-        } catch (\Throwable $e) {
75
+        }catch (\Throwable $e){
76 76
             return false;
77 77
         }
78 78
     }
Please login to merge, or discard this patch.
Braces   +17 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,12 +24,14 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public static function isCLI(): bool
26 26
     {
27
-        if (!empty(getenv('RR'))) {
27
+        if (!empty(getenv('RR')))
28
+        {
28 29
             // Do not treat RoadRunner as CLI.
29 30
             return false;
30 31
         }
31 32
 
32
-        if (php_sapi_name() === 'cli') {
33
+        if (php_sapi_name() === 'cli')
34
+        {
33 35
             return true;
34 36
         }
35 37
 
@@ -46,12 +48,15 @@  discard block
 block discarded – undo
46 48
      */
47 49
     public static function isColorsSupported($stream = STDOUT): bool
48 50
     {
49
-        if ('Hyper' === getenv('TERM_PROGRAM')) {
51
+        if ('Hyper' === getenv('TERM_PROGRAM'))
52
+        {
50 53
             return true;
51 54
         }
52 55
 
53
-        try {
54
-            if (\DIRECTORY_SEPARATOR === '\\') {
56
+        try
57
+        {
58
+            if (\DIRECTORY_SEPARATOR === '\\')
59
+            {
55 60
                 return (
56 61
                         function_exists('sapi_windows_vt100_support')
57 62
                         && @sapi_windows_vt100_support($stream)
@@ -60,11 +65,13 @@  discard block
 block discarded – undo
60 65
                     || getenv('TERM') == 'xterm';
61 66
             }
62 67
 
63
-            if (\function_exists('stream_isatty')) {
68
+            if (\function_exists('stream_isatty'))
69
+            {
64 70
                 return @stream_isatty($stream);
65 71
             }
66 72
 
67
-            if (\function_exists('posix_isatty')) {
73
+            if (\function_exists('posix_isatty'))
74
+            {
68 75
                 return @posix_isatty($stream);
69 76
             }
70 77
 
@@ -72,7 +79,9 @@  discard block
 block discarded – undo
72 79
 
73 80
             // Check if formatted mode is S_IFCHR
74 81
             return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
75
-        } catch (\Throwable $e) {
82
+        }
83
+        catch (\Throwable $e)
84
+        {
76 85
             return false;
77 86
         }
78 87
     }
Please login to merge, or discard this patch.
src/Dumper/src/Dumper.php 3 patches
Braces   +84 added lines, -38 removed lines patch added patch discarded remove patch
@@ -58,7 +58,8 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public function __construct(LoggerInterface $logger = null)
60 60
     {
61
-        if (!empty($logger)) {
61
+        if (!empty($logger))
62
+        {
62 63
             $this->setLogger($logger);
63 64
         }
64 65
     }
@@ -86,7 +87,8 @@  discard block
 block discarded – undo
86 87
         $r = $this->getRenderer($target);
87 88
         $dump = $r->wrapContent($this->renderValue($r, $value));
88 89
 
89
-        switch ($target) {
90
+        switch ($target)
91
+        {
90 92
             case self::OUTPUT:
91 93
                 echo $dump;
92 94
                 break;
@@ -95,7 +97,8 @@  discard block
 block discarded – undo
95 97
                 return $dump;
96 98
 
97 99
             case self::LOGGER:
98
-                if ($this->logger == null) {
100
+                if ($this->logger == null)
101
+                {
99 102
                     throw new DumperException('Unable to dump value to log, no associated LoggerInterface');
100 103
                 }
101 104
                 $this->logger->debug($dump);
@@ -119,7 +122,8 @@  discard block
 block discarded – undo
119 122
      */
120 123
     public function setRenderer(int $target, RendererInterface $renderer): Dumper
121 124
     {
122
-        if (!isset($this->targets[$target])) {
125
+        if (!isset($this->targets[$target]))
126
+        {
123 127
             throw new DumperException(sprintf('Undefined dump target %d', $target));
124 128
         }
125 129
 
@@ -138,19 +142,25 @@  discard block
 block discarded – undo
138 142
      */
139 143
     private function getRenderer(int $target): RendererInterface
140 144
     {
141
-        if ($target == self::OUTPUT && System::isCLI()) {
142
-            if (System::isColorsSupported(STDOUT)) {
145
+        if ($target == self::OUTPUT && System::isCLI())
146
+        {
147
+            if (System::isColorsSupported(STDOUT))
148
+            {
143 149
                 $target = self::OUTPUT_CLI_COLORS;
144
-            } else {
150
+            }
151
+            else
152
+            {
145 153
                 $target = self::OUTPUT_CLI;
146 154
             }
147 155
         }
148 156
 
149
-        if (!isset($this->targets[$target])) {
157
+        if (!isset($this->targets[$target]))
158
+        {
150 159
             throw new DumperException(sprintf('Undefined dump target %d', $target));
151 160
         }
152 161
 
153
-        if (is_string($this->targets[$target])) {
162
+        if (is_string($this->targets[$target]))
163
+        {
154 164
             $this->targets[$target] = new $this->targets[$target]();
155 165
         }
156 166
 
@@ -175,28 +185,35 @@  discard block
 block discarded – undo
175 185
         int $level = 0,
176 186
         bool $hideHeader = false
177 187
     ): string {
178
-        if (!$hideHeader && !empty($name)) {
188
+        if (!$hideHeader && !empty($name))
189
+        {
179 190
             $header = $r->indent($level) . $r->apply($name, 'name') . $r->apply(' = ', 'syntax', '=');
180
-        } else {
191
+        }
192
+        else
193
+        {
181 194
             $header = $r->indent($level);
182 195
         }
183 196
 
184
-        if ($level > $this->maxLevel) {
197
+        if ($level > $this->maxLevel)
198
+        {
185 199
             //Renderer is not reference based, we can't dump too deep values
186 200
             return $r->indent($level) . $r->apply('-too deep-', 'maxLevel') . "\n";
187 201
         }
188 202
 
189 203
         $type = strtolower(gettype($value));
190 204
 
191
-        if ($type == 'array') {
205
+        if ($type == 'array')
206
+        {
192 207
             return $header . $this->renderArray($r, $value, $level, $hideHeader);
193 208
         }
194 209
 
195
-        if ($type == 'object') {
210
+        if ($type == 'object')
211
+        {
196 212
             return $header . $this->renderObject($r, $value, $level, $hideHeader);
197 213
         }
198 214
 
199
-        if ($type == 'resource') {
215
+        if ($type == 'resource')
216
+        {
200 217
             //No need to dump resource value
201 218
             $element = get_resource_type($value) . ' resource ';
202 219
 
@@ -210,7 +227,8 @@  discard block
 block discarded – undo
210 227
         $header .= $r->apply("{$type}({$length})", 'type', $type);
211 228
 
212 229
         $element = null;
213
-        switch ($type) {
230
+        switch ($type)
231
+        {
214 232
             case 'string':
215 233
                 $element = $r->escapeStrings() ? htmlspecialchars($value) : $value;
216 234
                 break;
@@ -220,7 +238,8 @@  discard block
 block discarded – undo
220 238
                 break;
221 239
 
222 240
             default:
223
-                if ($value !== null) {
241
+                if ($value !== null)
242
+                {
224 243
                     //Not showing null value, type is enough
225 244
                     $element = var_export($value, true);
226 245
                 }
@@ -240,19 +259,25 @@  discard block
 block discarded – undo
240 259
      */
241 260
     private function renderArray(RendererInterface $r, array $array, int $level, bool $hideHeader = false): string
242 261
     {
243
-        if (!$hideHeader) {
262
+        if (!$hideHeader)
263
+        {
244 264
             $count = count($array);
245 265
 
246 266
             //Array size and scope
247 267
             $output = $r->apply("array({$count})", 'type', 'array') . "\n";
248 268
             $output .= $r->indent($level) . $r->apply('[', 'syntax', '[') . "\n";
249
-        } else {
269
+        }
270
+        else
271
+        {
250 272
             $output = '';
251 273
         }
252 274
 
253
-        foreach ($array as $key => $value) {
254
-            if (!is_numeric($key)) {
255
-                if (is_string($key) && $r->escapeStrings()) {
275
+        foreach ($array as $key => $value)
276
+        {
277
+            if (!is_numeric($key))
278
+            {
279
+                if (is_string($key) && $r->escapeStrings())
280
+                {
256 281
                     $key = htmlspecialchars($key);
257 282
                 }
258 283
 
@@ -262,7 +287,8 @@  discard block
 block discarded – undo
262 287
             $output .= $this->renderValue($r, $value, "[{$key}]", $level + 1);
263 288
         }
264 289
 
265
-        if (!$hideHeader) {
290
+        if (!$hideHeader)
291
+        {
266 292
             //Closing array scope
267 293
             $output .= $r->indent($level) . $r->apply(']', 'syntax', ']') . "\n";
268 294
         }
@@ -286,29 +312,38 @@  discard block
 block discarded – undo
286 312
         bool $hideHeader = false,
287 313
         string $class = ''
288 314
     ): string {
289
-        if (!$hideHeader) {
315
+        if (!$hideHeader)
316
+        {
290 317
             $type = ($class ?: get_class($value)) . ' object ';
291 318
 
292 319
             $header = $r->apply($type, 'type', 'object') . "\n";
293 320
             $header .= $r->indent($level) . $r->apply('(', 'syntax', '(') . "\n";
294
-        } else {
321
+        }
322
+        else
323
+        {
295 324
             $header = '';
296 325
         }
297 326
 
298 327
         //Let's use method specifically created for dumping
299
-        if (method_exists($value, '__debugInfo') || $value instanceof \Closure) {
300
-            if ($value instanceof \Closure) {
328
+        if (method_exists($value, '__debugInfo') || $value instanceof \Closure)
329
+        {
330
+            if ($value instanceof \Closure)
331
+            {
301 332
                 $debugInfo = $this->describeClosure($value);
302
-            } else {
333
+            }
334
+            else
335
+            {
303 336
                 $debugInfo = $value->__debugInfo();
304 337
             }
305 338
 
306
-            if (is_array($debugInfo)) {
339
+            if (is_array($debugInfo))
340
+            {
307 341
                 //Pretty view
308 342
                 $debugInfo = (object)$debugInfo;
309 343
             }
310 344
 
311
-            if (is_object($debugInfo)) {
345
+            if (is_object($debugInfo))
346
+            {
312 347
                 //We are not including syntax elements here
313 348
                 return $this->renderObject($r, $debugInfo, $level, false, get_class($value));
314 349
             }
@@ -321,7 +356,8 @@  discard block
 block discarded – undo
321 356
         $refection = new \ReflectionObject($value);
322 357
 
323 358
         $output = '';
324
-        foreach ($refection->getProperties() as $property) {
359
+        foreach ($refection->getProperties() as $property)
360
+        {
325 361
             $output .= $this->renderProperty($r, $value, $property, $level);
326 362
         }
327 363
 
@@ -339,7 +375,8 @@  discard block
 block discarded – undo
339 375
      */
340 376
     private function renderProperty(RendererInterface $r, $value, \ReflectionProperty $p, int $level): string
341 377
     {
342
-        if ($p->isStatic()) {
378
+        if ($p->isStatic())
379
+        {
343 380
             return '';
344 381
         }
345 382
 
@@ -359,9 +396,12 @@  discard block
 block discarded – undo
359 396
         //To read private and protected properties
360 397
         $p->setAccessible(true);
361 398
 
362
-        if ($value instanceof \stdClass) {
399
+        if ($value instanceof \stdClass)
400
+        {
363 401
             $name = $r->apply($p->getName(), 'dynamic');
364
-        } else {
402
+        }
403
+        else
404
+        {
365 405
             //Property name includes access level
366 406
             $name = $p->getName() . $r->apply(':' . $access, 'access', $access);
367 407
         }
@@ -377,9 +417,12 @@  discard block
 block discarded – undo
377 417
      */
378 418
     private function describeClosure(\Closure $closure): array
379 419
     {
380
-        try {
420
+        try
421
+        {
381 422
             $r = new \ReflectionFunction($closure);
382
-        } catch (\ReflectionException $e) {
423
+        }
424
+        catch (\ReflectionException $e)
425
+        {
383 426
             return ['closure' => 'unable to resolve'];
384 427
         }
385 428
 
@@ -399,9 +442,12 @@  discard block
 block discarded – undo
399 442
      */
400 443
     private function getAccess(\ReflectionProperty $p): string
401 444
     {
402
-        if ($p->isPrivate()) {
445
+        if ($p->isPrivate())
446
+        {
403 447
             return 'private';
404
-        } elseif ($p->isProtected()) {
448
+        }
449
+        elseif ($p->isProtected())
450
+        {
405 451
             return 'protected';
406 452
         }
407 453
 
Please login to merge, or discard this patch.
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;
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         self::OUTPUT            => HtmlRenderer::class,
49 49
         self::OUTPUT_CLI        => PlainRenderer::class,
50 50
         self::OUTPUT_CLI_COLORS => ConsoleRenderer::class,
51
-        self::RETURN            => HtmlRenderer::class,
51
+        self::return            => HtmlRenderer::class,
52 52
         self::LOGGER            => PlainRenderer::class,
53 53
         self::ERROR_LOG         => PlainRenderer::class,
54 54
     ];
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
                 echo $dump;
92 92
                 break;
93 93
 
94
-            case self::RETURN:
94
+            case self::return:
95 95
                 return $dump;
96 96
 
97 97
             case self::LOGGER:
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public function __construct(LoggerInterface $logger = null)
60 60
     {
61
-        if (!empty($logger)) {
61
+        if (!empty($logger)){
62 62
             $this->setLogger($logger);
63 63
         }
64 64
     }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $r = $this->getRenderer($target);
87 87
         $dump = $r->wrapContent($this->renderValue($r, $value));
88 88
 
89
-        switch ($target) {
89
+        switch ($target){
90 90
             case self::OUTPUT:
91 91
                 echo $dump;
92 92
                 break;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                 return $dump;
96 96
 
97 97
             case self::LOGGER:
98
-                if ($this->logger == null) {
98
+                if ($this->logger == null){
99 99
                     throw new DumperException('Unable to dump value to log, no associated LoggerInterface');
100 100
                 }
101 101
                 $this->logger->debug($dump);
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      */
120 120
     public function setRenderer(int $target, RendererInterface $renderer): Dumper
121 121
     {
122
-        if (!isset($this->targets[$target])) {
122
+        if (!isset($this->targets[$target])){
123 123
             throw new DumperException(sprintf('Undefined dump target %d', $target));
124 124
         }
125 125
 
@@ -138,19 +138,19 @@  discard block
 block discarded – undo
138 138
      */
139 139
     private function getRenderer(int $target): RendererInterface
140 140
     {
141
-        if ($target == self::OUTPUT && System::isCLI()) {
142
-            if (System::isColorsSupported(STDOUT)) {
141
+        if ($target == self::OUTPUT && System::isCLI()){
142
+            if (System::isColorsSupported(STDOUT)){
143 143
                 $target = self::OUTPUT_CLI_COLORS;
144
-            } else {
144
+            }else{
145 145
                 $target = self::OUTPUT_CLI;
146 146
             }
147 147
         }
148 148
 
149
-        if (!isset($this->targets[$target])) {
149
+        if (!isset($this->targets[$target])){
150 150
             throw new DumperException(sprintf('Undefined dump target %d', $target));
151 151
         }
152 152
 
153
-        if (is_string($this->targets[$target])) {
153
+        if (is_string($this->targets[$target])){
154 154
             $this->targets[$target] = new $this->targets[$target]();
155 155
         }
156 156
 
@@ -175,32 +175,32 @@  discard block
 block discarded – undo
175 175
         int $level = 0,
176 176
         bool $hideHeader = false
177 177
     ): string {
178
-        if (!$hideHeader && !empty($name)) {
179
-            $header = $r->indent($level) . $r->apply($name, 'name') . $r->apply(' = ', 'syntax', '=');
180
-        } else {
178
+        if (!$hideHeader && !empty($name)){
179
+            $header = $r->indent($level).$r->apply($name, 'name').$r->apply(' = ', 'syntax', '=');
180
+        }else{
181 181
             $header = $r->indent($level);
182 182
         }
183 183
 
184
-        if ($level > $this->maxLevel) {
184
+        if ($level > $this->maxLevel){
185 185
             //Renderer is not reference based, we can't dump too deep values
186
-            return $r->indent($level) . $r->apply('-too deep-', 'maxLevel') . "\n";
186
+            return $r->indent($level).$r->apply('-too deep-', 'maxLevel')."\n";
187 187
         }
188 188
 
189 189
         $type = strtolower(gettype($value));
190 190
 
191
-        if ($type == 'array') {
192
-            return $header . $this->renderArray($r, $value, $level, $hideHeader);
191
+        if ($type == 'array'){
192
+            return $header.$this->renderArray($r, $value, $level, $hideHeader);
193 193
         }
194 194
 
195
-        if ($type == 'object') {
196
-            return $header . $this->renderObject($r, $value, $level, $hideHeader);
195
+        if ($type == 'object'){
196
+            return $header.$this->renderObject($r, $value, $level, $hideHeader);
197 197
         }
198 198
 
199
-        if ($type == 'resource') {
199
+        if ($type == 'resource'){
200 200
             //No need to dump resource value
201
-            $element = get_resource_type($value) . ' resource ';
201
+            $element = get_resource_type($value).' resource ';
202 202
 
203
-            return $header . $r->apply($element, 'type', 'resource') . "\n";
203
+            return $header.$r->apply($element, 'type', 'resource')."\n";
204 204
         }
205 205
 
206 206
         //Value length
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         $header .= $r->apply("{$type}({$length})", 'type', $type);
211 211
 
212 212
         $element = null;
213
-        switch ($type) {
213
+        switch ($type){
214 214
             case 'string':
215 215
                 $element = $r->escapeStrings() ? htmlspecialchars($value) : $value;
216 216
                 break;
@@ -220,14 +220,14 @@  discard block
 block discarded – undo
220 220
                 break;
221 221
 
222 222
             default:
223
-                if ($value !== null) {
223
+                if ($value !== null){
224 224
                     //Not showing null value, type is enough
225 225
                     $element = var_export($value, true);
226 226
                 }
227 227
         }
228 228
 
229 229
         //Including value
230
-        return $header . ' ' . $r->apply($element, 'value', $type) . "\n";
230
+        return $header.' '.$r->apply($element, 'value', $type)."\n";
231 231
     }
232 232
 
233 233
     /**
@@ -240,19 +240,19 @@  discard block
 block discarded – undo
240 240
      */
241 241
     private function renderArray(RendererInterface $r, array $array, int $level, bool $hideHeader = false): string
242 242
     {
243
-        if (!$hideHeader) {
243
+        if (!$hideHeader){
244 244
             $count = count($array);
245 245
 
246 246
             //Array size and scope
247
-            $output = $r->apply("array({$count})", 'type', 'array') . "\n";
248
-            $output .= $r->indent($level) . $r->apply('[', 'syntax', '[') . "\n";
249
-        } else {
247
+            $output = $r->apply("array({$count})", 'type', 'array')."\n";
248
+            $output .= $r->indent($level).$r->apply('[', 'syntax', '[')."\n";
249
+        }else{
250 250
             $output = '';
251 251
         }
252 252
 
253
-        foreach ($array as $key => $value) {
254
-            if (!is_numeric($key)) {
255
-                if (is_string($key) && $r->escapeStrings()) {
253
+        foreach ($array as $key => $value){
254
+            if (!is_numeric($key)){
255
+                if (is_string($key) && $r->escapeStrings()){
256 256
                     $key = htmlspecialchars($key);
257 257
                 }
258 258
 
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
             $output .= $this->renderValue($r, $value, "[{$key}]", $level + 1);
263 263
         }
264 264
 
265
-        if (!$hideHeader) {
265
+        if (!$hideHeader){
266 266
             //Closing array scope
267
-            $output .= $r->indent($level) . $r->apply(']', 'syntax', ']') . "\n";
267
+            $output .= $r->indent($level).$r->apply(']', 'syntax', ']')."\n";
268 268
         }
269 269
 
270 270
         return $output;
@@ -286,47 +286,47 @@  discard block
 block discarded – undo
286 286
         bool $hideHeader = false,
287 287
         string $class = ''
288 288
     ): string {
289
-        if (!$hideHeader) {
290
-            $type = ($class ?: get_class($value)) . ' object ';
289
+        if (!$hideHeader){
290
+            $type = ($class ?: get_class($value)).' object ';
291 291
 
292
-            $header = $r->apply($type, 'type', 'object') . "\n";
293
-            $header .= $r->indent($level) . $r->apply('(', 'syntax', '(') . "\n";
294
-        } else {
292
+            $header = $r->apply($type, 'type', 'object')."\n";
293
+            $header .= $r->indent($level).$r->apply('(', 'syntax', '(')."\n";
294
+        }else{
295 295
             $header = '';
296 296
         }
297 297
 
298 298
         //Let's use method specifically created for dumping
299
-        if (method_exists($value, '__debugInfo') || $value instanceof \Closure) {
300
-            if ($value instanceof \Closure) {
299
+        if (method_exists($value, '__debugInfo') || $value instanceof \Closure){
300
+            if ($value instanceof \Closure){
301 301
                 $debugInfo = $this->describeClosure($value);
302
-            } else {
302
+            }else{
303 303
                 $debugInfo = $value->__debugInfo();
304 304
             }
305 305
 
306
-            if (is_array($debugInfo)) {
306
+            if (is_array($debugInfo)){
307 307
                 //Pretty view
308 308
                 $debugInfo = (object)$debugInfo;
309 309
             }
310 310
 
311
-            if (is_object($debugInfo)) {
311
+            if (is_object($debugInfo)){
312 312
                 //We are not including syntax elements here
313 313
                 return $this->renderObject($r, $debugInfo, $level, false, get_class($value));
314 314
             }
315 315
 
316 316
             return $header
317 317
                 . $this->renderValue($r, $debugInfo, '', $level + (is_scalar($value)), true)
318
-                . $r->indent($level) . $r->apply(')', 'syntax', ')') . "\n";
318
+                . $r->indent($level).$r->apply(')', 'syntax', ')')."\n";
319 319
         }
320 320
 
321 321
         $refection = new \ReflectionObject($value);
322 322
 
323 323
         $output = '';
324
-        foreach ($refection->getProperties() as $property) {
324
+        foreach ($refection->getProperties() as $property){
325 325
             $output .= $this->renderProperty($r, $value, $property, $level);
326 326
         }
327 327
 
328 328
         //Header, content, footer
329
-        return $header . $output . $r->indent($level) . $r->apply(')', 'syntax', ')') . "\n";
329
+        return $header.$output.$r->indent($level).$r->apply(')', 'syntax', ')')."\n";
330 330
     }
331 331
 
332 332
     /**
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
      */
340 340
     private function renderProperty(RendererInterface $r, $value, \ReflectionProperty $p, int $level): string
341 341
     {
342
-        if ($p->isStatic()) {
342
+        if ($p->isStatic()){
343 343
             return '';
344 344
         }
345 345
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
             !($value instanceof \stdClass)
348 348
             && is_string($p->getDocComment())
349 349
             && strpos($p->getDocComment(), '@internal') !== false
350
-        ) {
350
+        ){
351 351
             // Memory loop while reading doc comment for stdClass variables?
352 352
             // Report a PHP bug about treating comment INSIDE property declaration as doc comment.
353 353
             return '';
@@ -359,11 +359,11 @@  discard block
 block discarded – undo
359 359
         //To read private and protected properties
360 360
         $p->setAccessible(true);
361 361
 
362
-        if ($value instanceof \stdClass) {
362
+        if ($value instanceof \stdClass){
363 363
             $name = $r->apply($p->getName(), 'dynamic');
364
-        } else {
364
+        }else{
365 365
             //Property name includes access level
366
-            $name = $p->getName() . $r->apply(':' . $access, 'access', $access);
366
+            $name = $p->getName().$r->apply(':'.$access, 'access', $access);
367 367
         }
368 368
 
369 369
         return $this->renderValue($r, $p->getValue($value), $name, $level + 1);
@@ -377,14 +377,14 @@  discard block
 block discarded – undo
377 377
      */
378 378
     private function describeClosure(\Closure $closure): array
379 379
     {
380
-        try {
380
+        try{
381 381
             $r = new \ReflectionFunction($closure);
382
-        } catch (\ReflectionException $e) {
382
+        }catch (\ReflectionException $e){
383 383
             return ['closure' => 'unable to resolve'];
384 384
         }
385 385
 
386 386
         return [
387
-            'name' => $r->getName() . " (lines {$r->getStartLine()}:{$r->getEndLine()})",
387
+            'name' => $r->getName()." (lines {$r->getStartLine()}:{$r->getEndLine()})",
388 388
             'file' => $r->getFileName(),
389 389
             'this' => $r->getClosureThis(),
390 390
         ];
@@ -399,9 +399,9 @@  discard block
 block discarded – undo
399 399
      */
400 400
     private function getAccess(\ReflectionProperty $p): string
401 401
     {
402
-        if ($p->isPrivate()) {
402
+        if ($p->isPrivate()){
403 403
             return 'private';
404
-        } elseif ($p->isProtected()) {
404
+        } elseif ($p->isProtected()){
405 405
             return 'protected';
406 406
         }
407 407
 
Please login to merge, or discard this patch.