Skip to content

Commit 59f35ca

Browse files
committed
Apply PHP-CS-Fixer PHP 7.4 migration
- `heredoc_indentation` – makes use of flexible heredocs. - `use_arrow_functions` – had to adjust the `function_declaration` config.
1 parent cb93ccf commit 59f35ca

File tree

3 files changed

+38
-56
lines changed

3 files changed

+38
-56
lines changed

.php-cs-fixer.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
$rules = [
77
'@Symfony' => true,
88
'@Symfony:risky' => true,
9-
'@PHP71Migration' => true,
10-
'@PHP71Migration:risky' => true,
9+
'@PHP74Migration' => true,
10+
'@PHP74Migration:risky' => true,
1111
// 'phpdoc_to_param_type' => true,
1212
// 'phpdoc_to_return_type' => true,
1313
'phpdoc_types_order' => false,
@@ -17,7 +17,10 @@
1717
'functions_opening_brace' => 'same_line',
1818
'classes_opening_brace' => 'same_line',
1919
],
20-
'function_declaration' => ['closure_function_spacing' => 'none'],
20+
'function_declaration' => [
21+
'closure_function_spacing' => 'none',
22+
'closure_fn_spacing' => 'none',
23+
],
2124
'concat_space' => ['spacing' => 'one'],
2225
'phpdoc_align' => false,
2326
'yoda_style' => false,

src/GuzzleTranscoder.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ public function __invoke(callable $handler): callable {
8383
return function(RequestInterface $request, array $options) use ($handler): PromiseInterface {
8484
$promise = $handler($request, $options);
8585

86-
return $promise->then(function(ResponseInterface $response): ResponseInterface {
87-
return $this->convert($response);
88-
});
86+
return $promise->then(fn(ResponseInterface $response): ResponseInterface => $this->convert($response));
8987
};
9088
}
9189

tests/ContentTypeExtractorTest.php

Lines changed: 31 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ public function contentTypes(): iterable {
2727
yield 'HTML5, double quotes' => [
2828
<<<HTML
2929
<meta charset="iso-8859-1">
30-
HTML
31-
,
30+
HTML,
3231
'iso-8859-1',
3332
[
3433
'<meta charset="iso-8859-1">' => '<meta charset="placeholder-encoding">',
@@ -38,8 +37,7 @@ public function contentTypes(): iterable {
3837
yield 'HTML5, single quotes' => [
3938
<<<HTML
4039
<meta charset='iso-8859-1'>
41-
HTML
42-
,
40+
HTML,
4341
'iso-8859-1',
4442
[
4543
"<meta charset='iso-8859-1'>" => "<meta charset='placeholder-encoding'>",
@@ -49,8 +47,7 @@ public function contentTypes(): iterable {
4947
yield 'HTML5, unquoted' => [
5048
<<<HTML
5149
<meta charset=iso-8859-1>
52-
HTML
53-
,
50+
HTML,
5451
'iso-8859-1',
5552
[
5653
'<meta charset=iso-8859-1>' => '<meta charset=placeholder-encoding>',
@@ -60,8 +57,7 @@ public function contentTypes(): iterable {
6057
yield 'HTML5, unquoted, spaces around' => [
6158
<<<HTML
6259
<meta charset = iso-8859-1>
63-
HTML
64-
,
60+
HTML,
6561
'iso-8859-1',
6662
[
6763
'<meta charset = iso-8859-1>' => '<meta charset=placeholder-encoding>',
@@ -71,8 +67,7 @@ public function contentTypes(): iterable {
7167
yield 'HTML5, unquoted, extra attributes' => [
7268
<<<HTML
7369
<meta foo charset=iso-8859-1 bar baz="2">
74-
HTML
75-
,
70+
HTML,
7671
'iso-8859-1',
7772
[
7873
'<meta foo charset=iso-8859-1 bar baz="2">' => '<meta foo charset=placeholder-encoding bar baz="2">',
@@ -82,8 +77,7 @@ public function contentTypes(): iterable {
8277
yield 'HTML5, random case' => [
8378
<<<HTML
8479
<MeTA chArSEt="ISo-8859-1">
85-
HTML
86-
,
80+
HTML,
8781
'ISo-8859-1',
8882
[
8983
'<MeTA chArSEt="ISo-8859-1">' => '<MeTA charset="placeholder-encoding">',
@@ -93,8 +87,7 @@ public function contentTypes(): iterable {
9387
yield '(X)HTML5, unquoted' => [
9488
<<<HTML
9589
<meta charset=iso-8859-1 />
96-
HTML
97-
,
90+
HTML,
9891
'iso-8859-1',
9992
[
10093
'<meta charset=iso-8859-1 />' => '<meta charset=placeholder-encoding />',
@@ -104,8 +97,7 @@ public function contentTypes(): iterable {
10497
yield '(X)HTML5, tight' => [
10598
<<<HTML
10699
<meta charset="iso-8859-1"/>
107-
HTML
108-
,
100+
HTML,
109101
'iso-8859-1',
110102
[
111103
'<meta charset="iso-8859-1"/>' => '<meta charset="placeholder-encoding"/>',
@@ -117,8 +109,7 @@ public function contentTypes(): iterable {
117109
yield '(X)HTML5, unquoted, misplaced solidus' => [
118110
<<<HTML
119111
<meta charset=iso-8859-1/>
120-
HTML
121-
,
112+
HTML,
122113
'iso-8859-1/',
123114
[
124115
'<meta charset=iso-8859-1/>' => '<meta charset=placeholder-encoding>',
@@ -127,9 +118,8 @@ public function contentTypes(): iterable {
127118

128119
yield 'HTML4, double quotes' => [
129120
<<<HTML
130-
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
131-
HTML
132-
,
121+
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
122+
HTML,
133123
'ISO-8859-1',
134124
[
135125
'<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">' => '<meta http-equiv="content-type" content="text/html; charset=placeholder-encoding">',
@@ -138,9 +128,8 @@ public function contentTypes(): iterable {
138128

139129
yield 'HTML4, double quotes, other way around' => [
140130
<<<HTML
141-
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
142-
HTML
143-
,
131+
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
132+
HTML,
144133
'ISO-8859-1',
145134
[
146135
'<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">' => '<meta content="text/html; charset=placeholder-encoding" http-equiv="content-type">',
@@ -149,9 +138,8 @@ public function contentTypes(): iterable {
149138

150139
yield 'HTML4, double quotes, extra attributes, other way around' => [
151140
<<<HTML
152-
<meta foo="bar" content="text/html; charset=ISO-8859-1" test middle http-equiv="content-type" after='something'>
153-
HTML
154-
,
141+
<meta foo="bar" content="text/html; charset=ISO-8859-1" test middle http-equiv="content-type" after='something'>
142+
HTML,
155143
'ISO-8859-1',
156144
[
157145
'<meta foo="bar" content="text/html; charset=ISO-8859-1" test middle http-equiv="content-type" after=\'something\'>' => '<meta foo="bar" content="text/html; charset=placeholder-encoding" test middle http-equiv="content-type" after=\'something\'>',
@@ -160,9 +148,8 @@ public function contentTypes(): iterable {
160148

161149
yield 'HTML4, single quotes' => [
162150
<<<HTML
163-
<meta http-equiv='content-type' content='text/html; charset=ISO-8859-1'>
164-
HTML
165-
,
151+
<meta http-equiv='content-type' content='text/html; charset=ISO-8859-1'>
152+
HTML,
166153
'ISO-8859-1',
167154
[
168155
"<meta http-equiv='content-type' content='text/html; charset=ISO-8859-1'>" => "<meta http-equiv='content-type' content='text/html; charset=placeholder-encoding'>",
@@ -171,9 +158,8 @@ public function contentTypes(): iterable {
171158

172159
yield 'HTML4, unquoted+single quotes' => [
173160
<<<HTML
174-
<meta http-equiv=content-type content='text/html; charset=ISO-8859-1'>
175-
HTML
176-
,
161+
<meta http-equiv=content-type content='text/html; charset=ISO-8859-1'>
162+
HTML,
177163
'ISO-8859-1',
178164
[
179165
"<meta http-equiv=content-type content='text/html; charset=ISO-8859-1'>" => "<meta http-equiv=content-type content='text/html; charset=placeholder-encoding'>",
@@ -183,9 +169,8 @@ public function contentTypes(): iterable {
183169
// https://httpwg.org/specs/rfc9110.html#field.content-type
184170
yield 'HTML4, internally quoted, extra parameters' => [
185171
<<<HTML
186-
<meta http-equiv=content-type content='text/html;foo;charset="ISO-8859-1";bar'>
187-
HTML
188-
,
172+
<meta http-equiv=content-type content='text/html;foo;charset="ISO-8859-1";bar'>
173+
HTML,
189174
'ISO-8859-1',
190175
[
191176
"<meta http-equiv=content-type content='text/html;foo;charset=\"ISO-8859-1\";bar'>" => "<meta http-equiv=content-type content='text/html; foo; charset=placeholder-encoding; bar'>",
@@ -194,9 +179,8 @@ public function contentTypes(): iterable {
194179

195180
yield 'HTML4, single quotes+double quotes+spaces around' => [
196181
<<<HTML
197-
<meta http-equiv = "content-type" content = "text/html; charset=ISO-8859-1">
198-
HTML
199-
,
182+
<meta http-equiv = "content-type" content = "text/html; charset=ISO-8859-1">
183+
HTML,
200184
'ISO-8859-1',
201185
[
202186
'<meta http-equiv = "content-type" content = "text/html; charset=ISO-8859-1">' => '<meta http-equiv = "content-type" content="text/html; charset=placeholder-encoding">',
@@ -205,9 +189,8 @@ public function contentTypes(): iterable {
205189

206190
yield 'HTML4, random case' => [
207191
<<<HTML
208-
<meTA HTTp-EQuIv="conTeNt-TYpe" CoNTeNt="text/Html; cHArSeT=ISO-8859-1">
209-
HTML
210-
,
192+
<meTA HTTp-EQuIv="conTeNt-TYpe" CoNTeNt="text/Html; cHArSeT=ISO-8859-1">
193+
HTML,
211194
'ISO-8859-1',
212195
[
213196
'<meTA HTTp-EQuIv="conTeNt-TYpe" CoNTeNt="text/Html; cHArSeT=ISO-8859-1">' => '<meTA HTTp-EQuIv="conTeNt-TYpe" content="text/Html; cHArSeT=placeholder-encoding">',
@@ -216,9 +199,8 @@ public function contentTypes(): iterable {
216199

217200
yield '(X)HTML4' => [
218201
<<<HTML
219-
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"/>
220-
HTML
221-
,
202+
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"/>
203+
HTML,
222204
'ISO-8859-1',
223205
[
224206
'<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"/>' => '<meta http-equiv="content-type" content="text/html; charset=placeholder-encoding"/>',
@@ -227,11 +209,10 @@ public function contentTypes(): iterable {
227209

228210
yield 'multiple declarations' => [
229211
<<<HTML
230-
<meta http-equiv="content-type" test content="text/html; charset=ISO-8859-1">
231-
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
232-
<meta charset=UTF-8>
233-
HTML
234-
,
212+
<meta http-equiv="content-type" test content="text/html; charset=ISO-8859-1">
213+
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
214+
<meta charset=UTF-8>
215+
HTML,
235216
'ISO-8859-1',
236217
[
237218
'<meta http-equiv="content-type" test content="text/html; charset=ISO-8859-1">' => '<meta http-equiv="content-type" test content="text/html; charset=placeholder-encoding">',

0 commit comments

Comments
 (0)