Skip to content

Commit ffbe4fc

Browse files
committed
Upgrade PHPStan and PHP-CS-Fixer
1 parent 0d349fd commit ffbe4fc

4 files changed

Lines changed: 46 additions & 24 deletions

File tree

.cs.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
'@PSR1' => true,
99
'@PSR2' => true,
1010
'@Symfony' => true,
11-
'psr4' => true,
11+
'psr_autoloading' => true,
1212
// custom rules
1313
'align_multiline_comment' => ['comment_type' => 'phpdocs_only'], // psr-5
1414
'phpdoc_to_comment' => false,
@@ -21,7 +21,7 @@
2121
'declare_equal_normalize' => ['space' => 'single'],
2222
'increment_style' => ['style' => 'post'],
2323
'list_syntax' => ['syntax' => 'short'],
24-
'no_short_echo_tag' => true,
24+
'echo_tag_syntax' => ['format' => 'long'],
2525
'phpdoc_add_missing_param_annotation' => ['only_untyped' => false],
2626
'phpdoc_align' => false,
2727
'phpdoc_no_empty_return' => false,

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
"cakephp/chronos": "^1.2 || ^2.0"
1818
},
1919
"require-dev": {
20-
"friendsofphp/php-cs-fixer": "^2.16",
20+
"friendsofphp/php-cs-fixer": "^3",
2121
"overtrue/phplint": "^2.3",
22-
"phpstan/phpstan": "0.*",
22+
"phpstan/phpstan": "^1",
2323
"phpunit/phpunit": "^7 || ^8 || ^9",
2424
"squizlabs/php_codesniffer": "^3.5"
2525
},
@@ -41,7 +41,7 @@
4141
"@phpstan",
4242
"@test:coverage"
4343
],
44-
"cs:check": "php-cs-fixer fix --dry-run --format=txt --verbose --diff --diff-format=udiff --config=.cs.php",
44+
"cs:check": "php-cs-fixer fix --dry-run --format=txt --verbose --diff --config=.cs.php",
4545
"cs:fix": "php-cs-fixer fix --config=.cs.php",
4646
"lint": "phplint ./ --exclude=vendor --no-interaction --no-cache",
4747
"phpstan": "phpstan analyse src tests --level=max -c phpstan.neon --no-progress --ansi",

phpstan.neon

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
parameters:
2+
reportUnmatchedIgnoredErrors: false
3+
ignoreErrors:
4+
- '#Cannot cast mixed to int.#'
5+
- '#Cannot cast mixed to string.#'
6+
- '#Cannot cast mixed to float.#'
7+
- '#Cannot access offset string on mixed.#'
8+
- '#Parameter \#1 \$time of class Cake\\Chronos\\Chronos constructor expects DateTimeInterface\|int\|string\|null, mixed given.#'
9+
- '#Parameter \#1 \$data of class Selective\\Config\\Configuration constructor expects DateTimeInterface\|int\|string\|null, mixed given.#'
10+
- '#Parameter \#1 \$data of class Selective\\Config\\Configuration constructor expects array, mixed given.#'
11+
- '#Parameter \#2 \$default of method Selective\\Config\\Configuration::findString\(\) expects string\|null, mixed given.#'
12+
- '#Parameter \#2 \$default of method Selective\\Config\\Configuration::getString\(\) expects string\|null, mixed given.#'
13+
- '#Parameter \#2 \$default of method Selective\\Config\\Configuration::findInt\(\) expects int\|null, mixed given.#'
14+
- '#Parameter \#2 \$default of method Selective\\Config\\Configuration::getInt\(\) expects int\|null, mixed given.#'
15+
- '#Parameter \#2 \$default of method Selective\\Config\\Configuration::findBool\(\) expects bool\|null, mixed given.#'
16+
- '#Parameter \#2 \$default of method Selective\\Config\\Configuration::getBool\(\) expects bool\|null, mixed given.#'
17+
- '#Parameter \#2 \$default of method Selective\\Config\\Configuration::findFloat\(\) expects float\|null, mixed given.#'
18+
- '#Parameter \#2 \$default of method Selective\\Config\\Configuration::getFloat\(\) expects float\|null, mixed given.#'
19+
- '#Parameter \#2 \$default of method Selective\\Config\\Configuration::findArray\(\) expects array\|null, mixed given.#'
20+
- '#Parameter \#2 \$default of method Selective\\Config\\Configuration::getArray\(\) expects array\|null, mixed given.#'
21+
- '#Parameter \#2 \$default of method Selective\\Config\\Configuration::findChronos\(\) expects Cake\\Chronos\\Chronos\|null, mixed given.#'
22+
- '#Parameter \#2 \$default of method Selective\\Config\\Configuration::getChronos\(\) expects Cake\\Chronos\\Chronos\|null, mixed given.#'

tests/ConfigurationTest.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function testGetString($data, string $key, $default, $expected): void
3434
/**
3535
* Provider.
3636
*
37-
* @return array[] The test data
37+
* @return array<array<mixed>> The test data
3838
*/
3939
public function providerGetString(): array
4040
{
@@ -70,7 +70,7 @@ public function testGetStringError($data, string $key): void
7070
/**
7171
* Provider.
7272
*
73-
* @return array[] The test data
73+
* @return array<array<mixed>> The test data
7474
*/
7575
public function providerGetStringError(): array
7676
{
@@ -103,7 +103,7 @@ public function testFindString($data, string $key, $default, $expected): void
103103
/**
104104
* Provider.
105105
*
106-
* @return array[] The test data
106+
* @return array<array<mixed>> The test data
107107
*/
108108
public function providerFindString(): array
109109
{
@@ -139,7 +139,7 @@ public function testGetInt($data, string $key, $default, $expected): void
139139
/**
140140
* Provider.
141141
*
142-
* @return array[] The test data
142+
* @return array<array<mixed>> The test data
143143
*/
144144
public function providerGetInt(): array
145145
{
@@ -175,7 +175,7 @@ public function testGetIntError($data, string $key): void
175175
/**
176176
* Provider.
177177
*
178-
* @return array[] The test data
178+
* @return array<array<mixed>> The test data
179179
*/
180180
public function providerGetIntError(): array
181181
{
@@ -208,7 +208,7 @@ public function testFindInt($data, string $key, $default, $expected): void
208208
/**
209209
* Provider.
210210
*
211-
* @return array[] The test data
211+
* @return array<array<mixed>> The test data
212212
*/
213213
public function providerFindInt(): array
214214
{
@@ -244,7 +244,7 @@ public function testGetBool($data, string $key, $default, $expected): void
244244
/**
245245
* Provider.
246246
*
247-
* @return array[] The test data
247+
* @return array<array<mixed>> The test data
248248
*/
249249
public function providerGetBool(): array
250250
{
@@ -280,7 +280,7 @@ public function testGetBoolError($data, string $key): void
280280
/**
281281
* Provider.
282282
*
283-
* @return array[] The test data
283+
* @return array<array<mixed>> The test data
284284
*/
285285
public function providerGetBoolError(): array
286286
{
@@ -313,7 +313,7 @@ public function testFindBool($data, string $key, $default, $expected): void
313313
/**
314314
* Provider.
315315
*
316-
* @return array[] The test data
316+
* @return array<array<mixed>> The test data
317317
*/
318318
public function providerFindBool(): array
319319
{
@@ -349,7 +349,7 @@ public function testGetFloat($data, string $key, $default, $expected): void
349349
/**
350350
* Provider.
351351
*
352-
* @return array[] The test data
352+
* @return array<array<mixed>> The test data
353353
*/
354354
public function providerGetFloat(): array
355355
{
@@ -385,7 +385,7 @@ public function testGetFloatError($data, string $key): void
385385
/**
386386
* Provider.
387387
*
388-
* @return array[] The test data
388+
* @return array<array<mixed>> The test data
389389
*/
390390
public function providerGetFloatError(): array
391391
{
@@ -418,7 +418,7 @@ public function testFindFloat($data, string $key, $default, $expected): void
418418
/**
419419
* Provider.
420420
*
421-
* @return array[] The test data
421+
* @return array<array<mixed>> The test data
422422
*/
423423
public function providerFindFloat(): array
424424
{
@@ -454,7 +454,7 @@ public function testGetArray($data, string $key, $default, $expected): void
454454
/**
455455
* Provider.
456456
*
457-
* @return array[] The test data
457+
* @return array<array<mixed>> The test data
458458
*/
459459
public function providerGetArray(): array
460460
{
@@ -490,7 +490,7 @@ public function testGetArrayError($data, string $key): void
490490
/**
491491
* Provider.
492492
*
493-
* @return array[] The test data
493+
* @return array<array<mixed>> The test data
494494
*/
495495
public function providerGetArrayError(): array
496496
{
@@ -523,7 +523,7 @@ public function testFindArray($data, string $key, $default, $expected): void
523523
/**
524524
* Provider.
525525
*
526-
* @return array[] The test data
526+
* @return array<array<mixed>> The test data
527527
*/
528528
public function providerFindArray(): array
529529
{
@@ -559,7 +559,7 @@ public function testGetChronos($data, string $key, $default, $expected): void
559559
/**
560560
* Provider.
561561
*
562-
* @return array[] The test data
562+
* @return array<array<mixed>> The test data
563563
*/
564564
public function providerGetChronos(): array
565565
{
@@ -596,7 +596,7 @@ public function testGetChronosError($data, string $key): void
596596
/**
597597
* Provider.
598598
*
599-
* @return array[] The test data
599+
* @return array<array<mixed>> The test data
600600
*/
601601
public function providerGetChronosError(): array
602602
{
@@ -629,7 +629,7 @@ public function testFindChronos($data, string $key, $default, $expected): void
629629
/**
630630
* Provider.
631631
*
632-
* @return array[] The test data
632+
* @return array<array<mixed>> The test data
633633
*/
634634
public function providerFindChronos(): array
635635
{
@@ -647,7 +647,7 @@ public function providerFindChronos(): array
647647
/**
648648
* Provider.
649649
*
650-
* @return array[] The test data
650+
* @return array<array<mixed>> The test data
651651
*/
652652
public function providerAll(): array
653653
{

0 commit comments

Comments
 (0)