Skip to content

Commit ca192cf

Browse files
spawniaStyleCIBot
authored andcommitted
Apply fixes from StyleCI
1 parent 8671c57 commit ca192cf

File tree

2 files changed

+36
-34
lines changed

2 files changed

+36
-34
lines changed

src/Mixed.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
class Mixed extends ScalarType
1616
{
1717
/** @var string */
18-
public $description = <<<EOT
18+
public $description = <<<'EOT'
1919
Loose type that allows any value. Be careful when passing in large Int or Float literals,
2020
as they may not be parsed correctly on the server side. Use String literals if you are
2121
dealing with really large numbers to be on the safe side.
2222
EOT;
23-
23+
2424
/**
2525
* Serializes an internal value to include in a response.
2626
*
@@ -32,9 +32,9 @@ public function serialize($value)
3232
{
3333
return $value;
3434
}
35-
35+
3636
/**
37-
* Parses an externally provided value (query variable) to use as an input
37+
* Parses an externally provided value (query variable) to use as an input.
3838
*
3939
* In the case of an invalid value this method must throw an Exception
4040
*
@@ -46,7 +46,7 @@ public function parseValue($value)
4646
{
4747
return $value;
4848
}
49-
49+
5050
/**
5151
* Parses an externally provided literal value (hardcoded in GraphQL query) to use as an input.
5252
*
@@ -62,30 +62,30 @@ public function parseLiteral($valueNode, array $variables = null)
6262
if ($valueNode instanceof IntValueNode) {
6363
// This is a potentially lossy conversion as GraphQL Int literals
6464
// may be arbitrarily large, whereas PHP ints are limited in size
65-
$value = (int)$valueNode->value;
65+
$value = (int) $valueNode->value;
6666
}
67-
67+
6868
if ($valueNode instanceof FloatValueNode) {
6969
// This is a potentially lossy conversion as GraphQL Float literals
7070
// may be arbitrarily large, whereas PHP floats are limited in size
71-
$value = (float)$valueNode->value;
71+
$value = (float) $valueNode->value;
7272
}
73-
73+
7474
if ($valueNode instanceof ListValueNode) {
7575
$value = [];
7676
foreach ($valueNode->values as $singleValue) {
77-
$value [] = $this->parseLiteral($singleValue);
77+
$value[] = $this->parseLiteral($singleValue);
7878
}
7979
}
80-
80+
8181
if ($valueNode instanceof ObjectValueNode) {
8282
$value = [];
8383
/** @var ObjectFieldNode $singleValue */
8484
foreach ($valueNode->fields as $singleValue) {
8585
$value[$singleValue->name->value] = $this->parseLiteral($singleValue->value);
8686
}
8787
}
88-
88+
8989
return $value ?? $valueNode->value;
9090
}
9191
}

tests/MixedTest.php

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ class MixedTest extends \PHPUnit\Framework\TestCase
1616
{
1717
/** @var Schema */
1818
protected $schema;
19-
19+
2020
public function setUp()
2121
{
2222
parent::setUp();
23-
24-
$mixed = new Mixed;
25-
26-
$schemaConfig = new SchemaConfig;
23+
24+
$mixed = new Mixed();
25+
26+
$schemaConfig = new SchemaConfig();
2727
$schemaConfig->setQuery(
2828
new ObjectType([
2929
'name' => 'Query',
@@ -40,10 +40,10 @@ public function setUp()
4040
],
4141
])
4242
);
43-
43+
4444
$this->schema = new Schema($schemaConfig);
4545
}
46-
46+
4747
/**
4848
* @dataProvider singleValues
4949
*
@@ -58,7 +58,7 @@ public function testSerializePassesThroughAnything($value)
5858
)
5959
);
6060
}
61-
61+
6262
/**
6363
* @dataProvider singleValues
6464
*
@@ -73,18 +73,20 @@ public function testParseValuePassesThroughAnything($value)
7373
)
7474
);
7575
}
76-
76+
7777
public function singleValues()
7878
{
7979
return [
8080
[null],
81-
[new class {}],
81+
[new class() {
82+
}],
8283
[[]],
83-
[function(){}],
84-
[[$this, 'singleValues']]
84+
[function () {
85+
}],
86+
[[$this, 'singleValues']],
8587
];
8688
}
87-
89+
8890
/**
8991
* @dataProvider literalToPhpMap
9092
*
@@ -96,19 +98,19 @@ public function testCastsValuesIntoAppropriatePhpValue(string $graphQLLiteral, s
9698
{
9799
$graphqlResult = $this->executeQueryWithLiteral($graphQLLiteral);
98100
$jsonResult = $this->executeQueryWithJsonVariable($jsonLiteral);
99-
101+
100102
$this->assertSame(
101103
$expected,
102104
$graphqlResult->data['foo']
103105
);
104-
106+
105107
// Ensure that values provided as JSON have the same result as GraphQL literals
106108
$this->assertSame(
107109
$graphqlResult->data,
108110
$jsonResult->data
109111
);
110112
}
111-
113+
112114
/**
113115
* Provides a GraphQL literal, a Json literal and the expected PHP value.
114116
*
@@ -119,7 +121,7 @@ public function literalToPhpMap()
119121
return [
120122
['1', '1', 1],
121123
['"asdf"', '"asdf"', 'asdf'],
122-
['true','true', true],
124+
['true', 'true', true],
123125
['123.321', '123.321', 123.321],
124126
['null', 'null', null],
125127
['[1, 2]', '[1, 2]', [1, 2]],
@@ -155,7 +157,7 @@ public function literalToPhpMap()
155157
],
156158
];
157159
}
158-
160+
159161
/**
160162
* @param string $literal
161163
*
@@ -170,13 +172,13 @@ protected function executeQueryWithLiteral(string $literal): ExecutionResult
170172
";
171173
var_dump(
172174
SchemaPrinter::doPrint($this->schema));
173-
175+
174176
return GraphQL::executeQuery(
175177
$this->schema,
176178
$query
177179
);
178180
}
179-
181+
180182
/**
181183
* @param string $jsonLiteral
182184
*
@@ -189,15 +191,15 @@ protected function executeQueryWithJsonVariable(string $jsonLiteral): ExecutionR
189191
foo(bar: $var)
190192
}
191193
';
192-
194+
193195
$json = json_decode("
194196
{
195197
\"var\": $jsonLiteral
196198
}
197199
",
198200
true
199201
);
200-
202+
201203
return GraphQL::executeQuery(
202204
$this->schema,
203205
$query,

0 commit comments

Comments
 (0)