Skip to content

Commit 85a1193

Browse files
committed
Upgrade php-cs-fixer to version 2
1 parent a30e81d commit 85a1193

39 files changed

+266
-234
lines changed

.php_cs

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,45 @@
11
<?php
22

3-
return Symfony\CS\Config\Config::create()
4-
->setUsingCache(true)
5-
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
6-
// use default SYMFONY_LEVEL and extra fixers:
7-
->fixers(array(
8-
'concat_with_spaces',
9-
'ordered_use',
10-
'phpdoc_order',
11-
'strict',
12-
'strict_param',
13-
'short_array_syntax',
14-
))
15-
->finder(
16-
Symfony\CS\Finder::create()
3+
return PhpCsFixer\Config::create()
4+
->setRiskyAllowed(true)
5+
->setRules([
6+
'@Symfony' => true,
7+
'@Symfony:risky' => true,
8+
'array_syntax' => [
9+
'syntax' => 'short'
10+
],
11+
'combine_consecutive_unsets' => true,
12+
'heredoc_to_nowdoc' => true,
13+
'no_extra_consecutive_blank_lines' => [
14+
'break',
15+
'continue',
16+
'extra',
17+
'return',
18+
'throw',
19+
'use',
20+
'parenthesis_brace_block',
21+
'square_brace_block',
22+
'curly_brace_block'
23+
],
24+
'no_unreachable_default_argument_value' => true,
25+
'no_useless_else' => true,
26+
'no_useless_return' => true,
27+
'ordered_class_elements' => true,
28+
'ordered_imports' => true,
29+
'php_unit_strict' => true,
30+
'phpdoc_order' => true,
31+
// 'psr4' => true,
32+
'strict_comparison' => true,
33+
'strict_param' => true,
34+
'concat_space' => [
35+
'spacing' => 'one'
36+
],
37+
])
38+
->setFinder(
39+
PhpCsFixer\Finder::create()
40+
->exclude([
41+
'vendor',
42+
])
1743
->in(__DIR__)
18-
->exclude(array('vendor'))
1944
)
2045
;

.travis.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,19 @@ php:
55
- 5.6
66
- 7.0
77
- 7.1
8+
- 7.2
9+
- 7.3
810
- nightly
911
- hhvm
1012

1113
# run build against nightly but allow them to fail
1214
matrix:
1315
fast_finish: true
1416
include:
15-
- php: 7.0
17+
- php: 7.2
1618
env: CS_FIXER=run
1719
allow_failures:
20+
- php: 7.3
1821
- php: hhvm
1922
- php: nightly
2023

@@ -34,7 +37,7 @@ before_script:
3437
- composer install --prefer-dist --no-interaction
3538

3639
script:
37-
- phpunit --coverage-clover=coverage.clover
40+
- ./vendor/bin*simple-phpunit -v --coverage-clover=coverage.clover
3841
- if [ "$CS_FIXER" = "run" ]; then php vendor/bin/php-cs-fixer fix --verbose --dry-run ; fi;
3942

4043
after_script:

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
"guzzlehttp/guzzle": "^5.3.1"
4040
},
4141
"require-dev": {
42-
"friendsofphp/php-cs-fixer": "~1.9"
42+
"friendsofphp/php-cs-fixer": "~2.11",
43+
"symfony/phpunit-bridge": "^4.0"
4344
},
4445
"extra": {
4546
"branch-alias": {

lib/Imgur/Api/AbstractApi.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,6 @@ public function delete($url, $parameters = [])
9898
return $httpClient->parseResponse($response);
9999
}
100100

101-
/**
102-
* Global method to validate an argument.
103-
*
104-
* @param string $type The required parameter (used for the error message)
105-
* @param string $input Input value
106-
* @param array $possibleValues Possible values for this argument
107-
*/
108-
private function validateArgument($type, $input, $possibleValues)
109-
{
110-
if (!in_array($input, $possibleValues, true)) {
111-
throw new InvalidArgumentException($type . ' parameter "' . $input . '" is wrong. Possible values are: ' . implode(', ', $possibleValues));
112-
}
113-
}
114-
115101
/**
116102
* Validate "sort" parameter and throw an exception if it's a bad value.
117103
*
@@ -144,4 +130,18 @@ protected function validateVoteArgument($vote, $possibleValues)
144130
{
145131
$this->validateArgument('Vote', $vote, $possibleValues);
146132
}
133+
134+
/**
135+
* Global method to validate an argument.
136+
*
137+
* @param string $type The required parameter (used for the error message)
138+
* @param string $input Input value
139+
* @param array $possibleValues Possible values for this argument
140+
*/
141+
private function validateArgument($type, $input, $possibleValues)
142+
{
143+
if (!\in_array($input, $possibleValues, true)) {
144+
throw new InvalidArgumentException($type . ' parameter "' . $input . '" is wrong. Possible values are: ' . implode(', ', $possibleValues));
145+
}
146+
}
147147
}

lib/Imgur/Api/Account.php

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/**
66
* CRUD for Accounts.
77
*
8-
* @link https://api.imgur.com/endpoints/account
8+
* @see https://api.imgur.com/endpoints/account
99
*
1010
* @author Adrian Ghiuta <[email protected]>
1111
*/
@@ -16,7 +16,7 @@ class Account extends AbstractApi
1616
*
1717
* @param string $username
1818
*
19-
* @link https://api.imgur.com/endpoints/account#account
19+
* @see https://api.imgur.com/endpoints/account#account
2020
*
2121
* @return array Account (@see https://api.imgur.com/models/account)
2222
*/
@@ -45,7 +45,7 @@ public function deleteAccount($username)
4545
* @param int $page
4646
* @param string $sort 'oldest', or 'newest'. Defaults to 'newest'
4747
*
48-
* @link https://api.imgur.com/endpoints/account#account-gallery-favorites
48+
* @see https://api.imgur.com/endpoints/account#account-gallery-favorites
4949
*
5050
* @return array Gallery Image (@see https://api.imgur.com/models/gallery_image) OR Gallery Album (@see https://api.imgur.com/models/gallery_album)
5151
*/
@@ -61,7 +61,7 @@ public function galleryFavorites($username = 'me', $page = 0, $sort = 'newest')
6161
*
6262
* @param string $username
6363
*
64-
* @link https://api.imgur.com/endpoints/account#account-favorites
64+
* @see https://api.imgur.com/endpoints/account#account-favorites
6565
*
6666
* @return array Gallery Image (@see https://api.imgur.com/models/gallery_image) OR Gallery Album (@see https://api.imgur.com/models/gallery_album)
6767
*/
@@ -76,7 +76,7 @@ public function favorites($username = 'me')
7676
* @param string $username
7777
* @param int $page
7878
*
79-
* @link https://api.imgur.com/endpoints/account#account-submissions
79+
* @see https://api.imgur.com/endpoints/account#account-submissions
8080
*
8181
* @return array Gallery Image (@see https://api.imgur.com/models/gallery_image) OR Gallery Album (@see https://api.imgur.com/models/gallery_album)
8282
*/
@@ -90,7 +90,7 @@ public function submissions($username = 'me', $page = 0)
9090
*
9191
* @param string $username
9292
*
93-
* @link https://api.imgur.com/endpoints/account#account-settings
93+
* @see https://api.imgur.com/endpoints/account#account-settings
9494
*
9595
* @return array Account Settings (@see https://api.imgur.com/models/account_settings)
9696
*/
@@ -104,7 +104,7 @@ public function settings($username = 'me')
104104
*
105105
* @param array $parameters
106106
*
107-
* @link https://api.imgur.com/endpoints/account#update-settings
107+
* @see https://api.imgur.com/endpoints/account#update-settings
108108
*
109109
* @return bool
110110
*/
@@ -131,7 +131,7 @@ public function accountStats($username = 'me')
131131
*
132132
* @param string $username
133133
*
134-
* @link https://api.imgur.com/endpoints/account#account-profile
134+
* @see https://api.imgur.com/endpoints/account#account-profile
135135
*
136136
* @return array Gallery Profile (@see https://api.imgur.com/models/gallery_profile)
137137
*/
@@ -145,7 +145,7 @@ public function accountGalleryProfile($username = 'me')
145145
*
146146
* @param string $username
147147
*
148-
* @link https://api.imgur.com/endpoints/account#verify-email
148+
* @see https://api.imgur.com/endpoints/account#verify-email
149149
*
150150
* @return bool
151151
*/
@@ -159,7 +159,7 @@ public function verifyUsersEmail($username = 'me')
159159
*
160160
* @param string $username
161161
*
162-
* @link https://api.imgur.com/endpoints/account#send-verify-email
162+
* @see https://api.imgur.com/endpoints/account#send-verify-email
163163
*
164164
* @return bool
165165
*/
@@ -174,7 +174,7 @@ public function sendVerificationEmail($username = 'me')
174174
* @param string $username
175175
* @param int $page
176176
*
177-
* @link https://api.imgur.com/endpoints/account#albums
177+
* @see https://api.imgur.com/endpoints/account#albums
178178
*
179179
* @return array Array of Album (@see https://api.imgur.com/models/album)
180180
*/
@@ -190,7 +190,7 @@ public function albums($username = 'me', $page = 0)
190190
* @param string $username
191191
* @param string $albumId
192192
*
193-
* @link https://api.imgur.com/endpoints/account#album
193+
* @see https://api.imgur.com/endpoints/account#album
194194
*
195195
* @return array Album (@see https://api.imgur.com/models/album)
196196
*/
@@ -205,7 +205,7 @@ public function album($albumId, $username = 'me')
205205
* @param string $username
206206
* @param int $page
207207
*
208-
* @link https://api.imgur.com/endpoints/account#album-ids
208+
* @see https://api.imgur.com/endpoints/account#album-ids
209209
*
210210
* @return array<int>
211211
*/
@@ -219,7 +219,7 @@ public function albumIds($username = 'me', $page = 0)
219219
*
220220
* @param string $username
221221
*
222-
* @link https://api.imgur.com/endpoints/account#album-count
222+
* @see https://api.imgur.com/endpoints/account#album-count
223223
*
224224
* @return int
225225
*/
@@ -234,7 +234,7 @@ public function albumCount($username = 'me')
234234
* @param string $username
235235
* @param string $albumId
236236
*
237-
* @link https://api.imgur.com/endpoints/account#album-delete
237+
* @see https://api.imgur.com/endpoints/account#album-delete
238238
*
239239
* @return bool
240240
*/
@@ -250,7 +250,7 @@ public function albumDelete($albumId, $username = 'me')
250250
* @param int $page
251251
* @param string $sort 'best', 'worst', 'oldest', or 'newest'. Defaults to 'newest'
252252
*
253-
* @link https://api.imgur.com/endpoints/account#comments
253+
* @see https://api.imgur.com/endpoints/account#comments
254254
*
255255
* @return array Array of Comment (@see https://api.imgur.com/models/comment)
256256
*/
@@ -268,7 +268,7 @@ public function comments($username = 'me', $page = 0, $sort = 'newest')
268268
* @param string $commentId
269269
* @param string $username
270270
*
271-
* @link https://api.imgur.com/endpoints/account#comment
271+
* @see https://api.imgur.com/endpoints/account#comment
272272
*
273273
* @return array Comment (@see https://api.imgur.com/models/comment)
274274
*/
@@ -284,7 +284,7 @@ public function comment($commentId, $username = 'me')
284284
* @param int $page
285285
* @param string $sort 'best', 'worst', 'oldest', or 'newest'. Defaults to 'newest'
286286
*
287-
* @link https://api.imgur.com/endpoints/account#comment-ids
287+
* @see https://api.imgur.com/endpoints/account#comment-ids
288288
*
289289
* @return array<int>
290290
*/
@@ -300,7 +300,7 @@ public function commentIds($username = 'me', $page = 0, $sort = 'newest')
300300
*
301301
* @param string $username
302302
*
303-
* @link https://api.imgur.com/endpoints/account#comment-count
303+
* @see https://api.imgur.com/endpoints/account#comment-count
304304
*
305305
* @return int
306306
*/
@@ -315,7 +315,7 @@ public function commentCount($username = 'me')
315315
* @param string $commentId
316316
* @param string $username
317317
*
318-
* @link https://api.imgur.com/endpoints/account#comment-delete
318+
* @see https://api.imgur.com/endpoints/account#comment-delete
319319
*
320320
* @return bool
321321
*/
@@ -331,7 +331,7 @@ public function commentDelete($commentId, $username = 'me')
331331
* @param string $username
332332
* @param int $page
333333
*
334-
* @link https://api.imgur.com/endpoints/account#images
334+
* @see https://api.imgur.com/endpoints/account#images
335335
*
336336
* @return array Array of Image (@see https://api.imgur.com/models/image)
337337
*/
@@ -347,7 +347,7 @@ public function images($username = 'me', $page = 0)
347347
* @param string $imageId
348348
* @param string $username
349349
*
350-
* @link https://api.imgur.com/endpoints/account#image
350+
* @see https://api.imgur.com/endpoints/account#image
351351
*
352352
* @return array Image (@see https://api.imgur.com/models/image)
353353
*/
@@ -362,7 +362,7 @@ public function image($imageId, $username = 'me')
362362
* @param string $username
363363
* @param int $page
364364
*
365-
* @link https://api.imgur.com/endpoints/account#image-ids
365+
* @see https://api.imgur.com/endpoints/account#image-ids
366366
*
367367
* @return array<int>
368368
*/
@@ -376,7 +376,7 @@ public function imageIds($username = 'me', $page = 0)
376376
*
377377
* @param string $username
378378
*
379-
* @link https://api.imgur.com/endpoints/account#image-count
379+
* @see https://api.imgur.com/endpoints/account#image-count
380380
*
381381
* @return int
382382
*/
@@ -391,7 +391,7 @@ public function imageCount($username = 'me')
391391
* @param string $deleteHash
392392
* @param string $username
393393
*
394-
* @link https://api.imgur.com/endpoints/account#image-delete
394+
* @see https://api.imgur.com/endpoints/account#image-delete
395395
*
396396
* @return bool
397397
*/
@@ -406,7 +406,7 @@ public function imageDelete($deleteHash, $username = 'me')
406406
* @param string $username
407407
* @param bool $onlyNew
408408
*
409-
* @link https://api.imgur.com/endpoints/account#replies
409+
* @see https://api.imgur.com/endpoints/account#replies
410410
*
411411
* @return array Array of Notification (@see https://api.imgur.com/models/notification)
412412
*/

0 commit comments

Comments
 (0)