Skip to content

Commit 2e2ab12

Browse files
committed
Update PHP-CS-Fixer config
1 parent 8ac2fa6 commit 2e2ab12

18 files changed

+172
-176
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ composer.phar
22
composer.lock
33
/vendor/
44
/.idea/
5+
/.php_cs
56
/.php_cs.cache
67
/.phpunit.result.cache

.php_cs renamed to .php_cs.dist

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,10 @@ $finder = PhpCsFixer\Finder::create()
1111
return PhpCsFixer\Config::create()
1212
->setRules([
1313
'@Symfony' => true,
14-
'binary_operator_spaces' => [
15-
'align_equals' => false,
16-
'align_double_arrow' => true,
17-
],
1814
'array_syntax' => ['syntax' => 'short'],
19-
'cast_spaces' => false,
2015
'linebreak_after_opening_tag' => true,
2116
'ordered_imports' => true,
22-
'phpdoc_add_missing_param_annotation' => ['only_untyped' => false],
17+
'phpdoc_add_missing_param_annotation' => true,
2318
'phpdoc_order' => true,
2419
'yoda_style' => null,
2520
])

src/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Client implements ClientInterface
3838
* @var array
3939
*/
4040
private $defaultHeaders = [
41-
'Accept' => 'application/vnd.api+json',
41+
'Accept' => 'application/vnd.api+json',
4242
'Content-Type' => 'application/vnd.api+json',
4343
];
4444

src/Concerns/HasType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ public function setType(string $type)
3434
*/
3535
public function hasType(): bool
3636
{
37-
return (bool)$this->type;
37+
return (bool) $this->type;
3838
}
3939
}

src/Item.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function getRelationships(): array
137137
$relationships[$name] = [
138138
'data' => [
139139
'type' => $relation->getIncluded()->getType(),
140-
'id' => $relation->getIncluded()->getId(),
140+
'id' => $relation->getIncluded()->getId(),
141141
],
142142
];
143143
}
@@ -148,7 +148,7 @@ public function getRelationships(): array
148148
$relationships[$name]['data'][] =
149149
[
150150
'type' => $item->getType(),
151-
'id' => $item->getId(),
151+
'id' => $item->getId(),
152152
];
153153
}
154154
}

src/Parsers/ItemParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function parse($data): ItemInterface
7979
}
8080

8181
if (property_exists($data, 'attributes')) {
82-
$item->fill((array)$data->attributes);
82+
$item->fill((array) $data->attributes);
8383
}
8484

8585
if (property_exists($data, 'relationships')) {

src/Parsers/LinksParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function parse($data, string $source): Links
5757
}
5858

5959
return new Links(
60-
Collection::wrap((array)$data)
60+
Collection::wrap((array) $data)
6161
->map(
6262
function ($link, $name) {
6363
return $this->buildLink($link, $name);

src/Parsers/MetaParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ public function parse($data): Meta
2121
throw new ValidationException(sprintf('Meta has to be an object, "%s" given.', gettype($data)));
2222
}
2323

24-
return new Meta((array)$data);
24+
return new Meta((array) $data);
2525
}
2626
}

src/Parsers/ResponseParser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function parse(ResponseInterface $response): DocumentInterface
3434
$document = new InvalidResponseDocument();
3535

3636
if ($this->responseHasBody($response)) {
37-
$document = $this->parser->parse((string)$response->getBody());
37+
$document = $this->parser->parse((string) $response->getBody());
3838
} elseif ($this->responseHasSuccessfulStatusCode($response)) {
3939
$document = new Document();
4040
}
@@ -51,7 +51,7 @@ public function parse(ResponseInterface $response): DocumentInterface
5151
*/
5252
private function responseHasBody(ResponseInterface $response): bool
5353
{
54-
return (bool)$response->getBody()->getSize();
54+
return (bool) $response->getBody()->getSize();
5555
}
5656

5757
/**

tests/ClientTest.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@ public function it_can_get_and_set_the_default_headers()
3030

3131
$this->assertEquals(
3232
[
33-
'Accept' => 'application/vnd.api+json',
33+
'Accept' => 'application/vnd.api+json',
3434
'Content-Type' => 'application/vnd.api+json',
3535
],
3636
$client->getDefaultHeaders()
3737
);
3838
$client->setDefaultHeaders(
3939
[
40-
'Accept' => 'application/vnd.api+json',
40+
'Accept' => 'application/vnd.api+json',
4141
'Content-Type' => 'application/vnd.api+json',
42-
'X-Foo' => 'bar',
42+
'X-Foo' => 'bar',
4343
]
4444
);
4545
$this->assertEquals(
4646
[
47-
'Accept' => 'application/vnd.api+json',
47+
'Accept' => 'application/vnd.api+json',
4848
'Content-Type' => 'application/vnd.api+json',
49-
'X-Foo' => 'bar',
49+
'X-Foo' => 'bar',
5050
],
5151
$client->getDefaultHeaders()
5252
);
@@ -68,9 +68,9 @@ public function it_builds_a_get_request()
6868
$this->assertEquals($endpoint, $httpClient->getLastRequest()->getUri());
6969
$this->assertEquals(
7070
[
71-
'Accept' => ['application/vnd.api+json'],
71+
'Accept' => ['application/vnd.api+json'],
7272
'Content-Type' => ['application/vnd.api+json'],
73-
'X-Foo' => ['bar'],
73+
'X-Foo' => ['bar'],
7474
],
7575
$httpClient->getLastRequest()->getHeaders()
7676
);
@@ -92,9 +92,9 @@ public function it_builds_a_delete_request()
9292
$this->assertEquals($endpoint, $httpClient->getLastRequest()->getUri());
9393
$this->assertEquals(
9494
[
95-
'Accept' => ['application/vnd.api+json'],
95+
'Accept' => ['application/vnd.api+json'],
9696
'Content-Type' => ['application/vnd.api+json'],
97-
'X-Foo' => ['bar'],
97+
'X-Foo' => ['bar'],
9898
],
9999
$httpClient->getLastRequest()->getHeaders()
100100
);
@@ -113,13 +113,13 @@ public function it_builds_a_patch_request()
113113
$response = $client->patch($endpoint, 'testvar=testvalue', ['Content-Type' => 'application/pdf', 'X-Foo' => 'bar']);
114114
$this->assertInstanceOf(ResponseInterface::class, $response);
115115
$this->assertEquals('PATCH', $httpClient->getLastRequest()->getMethod());
116-
$this->assertEquals('testvar=testvalue', (string)$httpClient->getLastRequest()->getBody());
116+
$this->assertEquals('testvar=testvalue', (string) $httpClient->getLastRequest()->getBody());
117117
$this->assertEquals($endpoint, $httpClient->getLastRequest()->getUri());
118118
$this->assertEquals(
119119
[
120-
'Accept' => ['application/vnd.api+json'],
120+
'Accept' => ['application/vnd.api+json'],
121121
'Content-Type' => ['application/pdf'],
122-
'X-Foo' => ['bar'],
122+
'X-Foo' => ['bar'],
123123
],
124124
$httpClient->getLastRequest()->getHeaders()
125125
);
@@ -138,13 +138,13 @@ public function it_builds_a_post_request()
138138
$response = $client->post($endpoint, 'testvar=testvalue', ['Content-Type' => 'application/pdf', 'X-Foo' => 'bar']);
139139
$this->assertInstanceOf(ResponseInterface::class, $response);
140140
$this->assertEquals('POST', $httpClient->getLastRequest()->getMethod());
141-
$this->assertEquals('testvar=testvalue', (string)$httpClient->getLastRequest()->getBody());
141+
$this->assertEquals('testvar=testvalue', (string) $httpClient->getLastRequest()->getBody());
142142
$this->assertEquals($endpoint, $httpClient->getLastRequest()->getUri());
143143
$this->assertEquals(
144144
[
145-
'Accept' => ['application/vnd.api+json'],
145+
'Accept' => ['application/vnd.api+json'],
146146
'Content-Type' => ['application/pdf'],
147-
'X-Foo' => ['bar'],
147+
'X-Foo' => ['bar'],
148148
],
149149
$httpClient->getLastRequest()->getHeaders()
150150
);
@@ -166,9 +166,9 @@ public function it_builds_other_requests()
166166
$this->assertEquals($endpoint, $httpClient->getLastRequest()->getUri());
167167
$this->assertEquals(
168168
[
169-
'Accept' => ['application/vnd.api+json'],
169+
'Accept' => ['application/vnd.api+json'],
170170
'Content-Type' => ['application/pdf'],
171-
'X-Foo' => ['bar'],
171+
'X-Foo' => ['bar'],
172172
],
173173
$httpClient->getLastRequest()->getHeaders()
174174
);
@@ -186,7 +186,7 @@ public function it_builds_requests_with_a_string_as_body()
186186

187187
$response = $client->request('POST', '/test/1', $body);
188188
$this->assertInstanceOf(ResponseInterface::class, $response);
189-
$this->assertEquals('testvar=testvalue', (string)$httpClient->getLastRequest()->getBody());
189+
$this->assertEquals('testvar=testvalue', (string) $httpClient->getLastRequest()->getBody());
190190
}
191191

192192
/**
@@ -202,7 +202,7 @@ public function it_builds_requests_with_a_resource_as_body()
202202

203203
$response = $client->request('POST', '/test/1', $body);
204204
$this->assertInstanceOf(ResponseInterface::class, $response);
205-
$this->assertEquals('testvar=testvalue', (string)$httpClient->getLastRequest()->getBody());
205+
$this->assertEquals('testvar=testvalue', (string) $httpClient->getLastRequest()->getBody());
206206
}
207207

208208
/**
@@ -217,7 +217,7 @@ public function it_builds_requests_with_a_stream_as_body()
217217

218218
$response = $client->request('POST', '/test/1', $body);
219219
$this->assertInstanceOf(ResponseInterface::class, $response);
220-
$this->assertEquals('testvar=testvalue', (string)$httpClient->getLastRequest()->getBody());
220+
$this->assertEquals('testvar=testvalue', (string) $httpClient->getLastRequest()->getBody());
221221
}
222222

223223
/**
@@ -232,6 +232,6 @@ public function it_builds_requests_without_a_body()
232232

233233
$response = $client->request('POST', '/test/1', $body);
234234
$this->assertInstanceOf(ResponseInterface::class, $response);
235-
$this->assertEquals('', (string)$httpClient->getLastRequest()->getBody());
235+
$this->assertEquals('', (string) $httpClient->getLastRequest()->getBody());
236236
}
237237
}

tests/DocumentTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ public function it_returns_only_filled_properties_in_toArray()
181181
[
182182
'links' => [
183183
'self' => [
184-
'href' => 'http://example.com/articles',
185-
'meta' => [
184+
'href' => 'http://example.com/articles',
185+
'meta' => [
186186
'copyright' => 'Copyright 2015 Example Corp.',
187187
],
188188
],
@@ -193,21 +193,21 @@ public function it_returns_only_filled_properties_in_toArray()
193193
'href' => 'http://example.com/articles?page[offset]=10',
194194
],
195195
],
196-
'data' => [
197-
'type' => 'articles',
198-
'id' => 1,
196+
'data' => [
197+
'type' => 'articles',
198+
'id' => 1,
199199
'attributes' => [
200200
'title' => 'JSON:API paints my bikeshed!',
201201
],
202202
],
203203
'included' => [
204204
[
205-
'type' => 'people',
206-
'id' => 9,
205+
'type' => 'people',
206+
'id' => 9,
207207
'attributes' => [
208208
'firstName' => 'Dan',
209-
'lastName' => 'Gebhardt',
210-
'twitter' => 'dgeb',
209+
'lastName' => 'Gebhardt',
210+
'twitter' => 'dgeb',
211211
],
212212
],
213213
],
@@ -221,7 +221,7 @@ public function it_returns_only_filled_properties_in_toArray()
221221
],
222222
'jsonapi' => [
223223
'version' => '1.0',
224-
'meta' => [
224+
'meta' => [
225225
'copyright' => 'Copyright 2015 Example Corp.',
226226
],
227227
],

0 commit comments

Comments
 (0)