Passed
Pull Request — master (#450)
by Kirill
05:42
created
src/Models/src/Reflection/ReflectionEntity.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function getSecured()
94 94
     {
95
-        if ($this->getProperty('secured', true) === '*') {
95
+        if ($this->getProperty('secured', true) === '*'){
96 96
             return $this->getProperty('secured', true);
97 97
         }
98 98
 
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
     public function declaredMethods(): array
140 140
     {
141 141
         $methods = [];
142
-        foreach ($this->getMethods() as $method) {
143
-            if ($method->getDeclaringClass()->getName() != $this->getName()) {
142
+        foreach ($this->getMethods() as $method){
143
+            if ($method->getDeclaringClass()->getName() != $this->getName()){
144 144
                 continue;
145 145
             }
146 146
 
@@ -174,15 +174,15 @@  discard block
 block discarded – undo
174 174
             self::MUTATOR_ACCESSOR => [],
175 175
         ];
176 176
 
177
-        foreach ((array)$this->getProperty('getters', true) as $field => $filter) {
177
+        foreach ((array)$this->getProperty('getters', true) as $field => $filter){
178 178
             $mutators[self::MUTATOR_GETTER][$field] = $filter;
179 179
         }
180 180
 
181
-        foreach ((array)$this->getProperty('setters', true) as $field => $filter) {
181
+        foreach ((array)$this->getProperty('setters', true) as $field => $filter){
182 182
             $mutators[self::MUTATOR_SETTER][$field] = $filter;
183 183
         }
184 184
 
185
-        foreach ((array)$this->getProperty('accessors', true) as $field => $filter) {
185
+        foreach ((array)$this->getProperty('accessors', true) as $field => $filter){
186 186
             $mutators[self::MUTATOR_ACCESSOR][$field] = $filter;
187 187
         }
188 188
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      */
201 201
     public function getProperty(string $property, bool $merge = false)
202 202
     {
203
-        if (isset($this->propertyCache[$property])) {
203
+        if (isset($this->propertyCache[$property])){
204 204
             //Property merging and trait events are pretty slow
205 205
             return $this->propertyCache[$property];
206 206
         }
@@ -208,27 +208,27 @@  discard block
 block discarded – undo
208 208
         $properties = $this->reflection->getDefaultProperties();
209 209
         $constants = $this->reflection->getConstants();
210 210
 
211
-        if (isset($properties[$property])) {
211
+        if (isset($properties[$property])){
212 212
             //Read from default value
213 213
             $value = $properties[$property];
214
-        } elseif (isset($constants[strtoupper($property)])) {
214
+        } elseif (isset($constants[strtoupper($property)])){
215 215
             //Read from a constant
216 216
             $value = $constants[strtoupper($property)];
217
-        } else {
217
+        }else{
218 218
             return null;
219 219
         }
220 220
 
221 221
         //Merge with parent value requested
222
-        if ($merge && is_array($value) && !empty($parent = $this->parentReflection())) {
222
+        if ($merge && is_array($value) && !empty($parent = $this->parentReflection())){
223 223
             $parentValue = $parent->getProperty($property, $merge);
224 224
 
225
-            if (is_array($parentValue)) {
225
+            if (is_array($parentValue)){
226 226
                 //Class values prior to parent values
227 227
                 $value = array_merge($parentValue, $value);
228 228
             }
229 229
         }
230 230
 
231
-        if (!$this->reflection->isSubclassOf(SchematicEntity::class)) {
231
+        if (!$this->reflection->isSubclassOf(SchematicEntity::class)){
232 232
             return $value;
233 233
         }
234 234
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     {
246 246
         $parentClass = $this->reflection->getParentClass();
247 247
 
248
-        if (!empty($parentClass) && $parentClass->getName() != static::BASE_CLASS) {
248
+        if (!empty($parentClass) && $parentClass->getName() != static::BASE_CLASS){
249 249
             $parent = clone $this;
250 250
             $parent->reflection = $this->getParentClass();
251 251
 
Please login to merge, or discard this patch.
Braces   +30 added lines, -14 removed lines patch added patch discarded remove patch
@@ -92,7 +92,8 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function getSecured()
94 94
     {
95
-        if ($this->getProperty('secured', true) === '*') {
95
+        if ($this->getProperty('secured', true) === '*')
96
+        {
96 97
             return $this->getProperty('secured', true);
97 98
         }
98 99
 
@@ -139,8 +140,10 @@  discard block
 block discarded – undo
139 140
     public function declaredMethods(): array
140 141
     {
141 142
         $methods = [];
142
-        foreach ($this->getMethods() as $method) {
143
-            if ($method->getDeclaringClass()->getName() != $this->getName()) {
143
+        foreach ($this->getMethods() as $method)
144
+        {
145
+            if ($method->getDeclaringClass()->getName() != $this->getName())
146
+            {
144 147
                 continue;
145 148
             }
146 149
 
@@ -174,15 +177,18 @@  discard block
 block discarded – undo
174 177
             self::MUTATOR_ACCESSOR => [],
175 178
         ];
176 179
 
177
-        foreach ((array)$this->getProperty('getters', true) as $field => $filter) {
180
+        foreach ((array)$this->getProperty('getters', true) as $field => $filter)
181
+        {
178 182
             $mutators[self::MUTATOR_GETTER][$field] = $filter;
179 183
         }
180 184
 
181
-        foreach ((array)$this->getProperty('setters', true) as $field => $filter) {
185
+        foreach ((array)$this->getProperty('setters', true) as $field => $filter)
186
+        {
182 187
             $mutators[self::MUTATOR_SETTER][$field] = $filter;
183 188
         }
184 189
 
185
-        foreach ((array)$this->getProperty('accessors', true) as $field => $filter) {
190
+        foreach ((array)$this->getProperty('accessors', true) as $field => $filter)
191
+        {
186 192
             $mutators[self::MUTATOR_ACCESSOR][$field] = $filter;
187 193
         }
188 194
 
@@ -200,7 +206,8 @@  discard block
 block discarded – undo
200 206
      */
201 207
     public function getProperty(string $property, bool $merge = false)
202 208
     {
203
-        if (isset($this->propertyCache[$property])) {
209
+        if (isset($this->propertyCache[$property]))
210
+        {
204 211
             //Property merging and trait events are pretty slow
205 212
             return $this->propertyCache[$property];
206 213
         }
@@ -208,27 +215,35 @@  discard block
 block discarded – undo
208 215
         $properties = $this->reflection->getDefaultProperties();
209 216
         $constants = $this->reflection->getConstants();
210 217
 
211
-        if (isset($properties[$property])) {
218
+        if (isset($properties[$property]))
219
+        {
212 220
             //Read from default value
213 221
             $value = $properties[$property];
214
-        } elseif (isset($constants[strtoupper($property)])) {
222
+        }
223
+        elseif (isset($constants[strtoupper($property)]))
224
+        {
215 225
             //Read from a constant
216 226
             $value = $constants[strtoupper($property)];
217
-        } else {
227
+        }
228
+        else
229
+        {
218 230
             return null;
219 231
         }
220 232
 
221 233
         //Merge with parent value requested
222
-        if ($merge && is_array($value) && !empty($parent = $this->parentReflection())) {
234
+        if ($merge && is_array($value) && !empty($parent = $this->parentReflection()))
235
+        {
223 236
             $parentValue = $parent->getProperty($property, $merge);
224 237
 
225
-            if (is_array($parentValue)) {
238
+            if (is_array($parentValue))
239
+            {
226 240
                 //Class values prior to parent values
227 241
                 $value = array_merge($parentValue, $value);
228 242
             }
229 243
         }
230 244
 
231
-        if (!$this->reflection->isSubclassOf(SchematicEntity::class)) {
245
+        if (!$this->reflection->isSubclassOf(SchematicEntity::class))
246
+        {
232 247
             return $value;
233 248
         }
234 249
 
@@ -245,7 +260,8 @@  discard block
 block discarded – undo
245 260
     {
246 261
         $parentClass = $this->reflection->getParentClass();
247 262
 
248
-        if (!empty($parentClass) && $parentClass->getName() != static::BASE_CLASS) {
263
+        if (!empty($parentClass) && $parentClass->getName() != static::BASE_CLASS)
264
+        {
249 265
             $parent = clone $this;
250 266
             $parent->reflection = $this->getParentClass();
251 267
 
Please login to merge, or discard this patch.
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.