Skip to content

Commit 81aa968

Browse files
phpstan level 6
1 parent e0a8e8f commit 81aa968

File tree

13 files changed

+136
-18
lines changed

13 files changed

+136
-18
lines changed

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
},
2929
"require-dev": {
3030
"imbo/imbo-coding-standard": "^2.0",
31+
"phpstan/extension-installer": "^1.4",
3132
"phpstan/phpstan": "^2.1",
33+
"phpstan/phpstan-phpunit": "^2.0",
3234
"phpunit/phpunit": "^11.5",
3335
"slim/psr7": "^1.3",
3436
"slim/slim": "^4.7",
@@ -65,6 +67,9 @@
6567
"docs": "cd docs; make html"
6668
},
6769
"config": {
68-
"sort-packages": true
70+
"sort-packages": true,
71+
"allow-plugins": {
72+
"phpstan/extension-installer": true
73+
}
6974
}
7075
}

composer.lock

Lines changed: 100 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan.neon

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
parameters:
2-
level: 5
2+
level: 6
33
paths:
44
- src
5-
- tests
5+
- tests
6+
ignoreErrors:
7+
-
8+
message: '#Method [a-zA-Z0-9\\_]+::test#'
9+
identifier: missingType.iterableValue
10+
path: tests

src/ArrayContainsComparator.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function getMatcherFunction(string $name): callable
5353
* To clarify, the method (and other methods in the class) refers to "lists" and "objects". A
5454
* "list" is a numerically indexed array, and an "object" is an associative array.
5555
*
56-
* @param array<scalar|array> $needle
56+
* @param array<scalar|array<mixed>> $needle
5757
* @param array<mixed> $haystack
5858
*/
5959
public function compare(array $needle, array $haystack): bool
@@ -239,8 +239,8 @@ protected function compareValues(mixed $needleValue, mixed $haystackValue): bool
239239
/**
240240
* Make sure all values in the $needle array is present in the $haystack array
241241
*
242-
* @param array<array|scalar> $needle
243-
* @param array $haystack
242+
* @param array<array<mixed>|scalar> $needle
243+
* @param array<mixed> $haystack
244244
*/
245245
protected function inArray(array $needle, array $haystack): bool
246246
{
@@ -350,6 +350,8 @@ protected function inArray(array $needle, array $haystack): bool
350350

351351
/**
352352
* See if a PHP array is a JSON array
353+
*
354+
* @param array<mixed> $array
353355
*/
354356
protected function arrayIsList(array $array): bool
355357
{
@@ -360,6 +362,8 @@ protected function arrayIsList(array $array): bool
360362

361363
/**
362364
* See if a PHP array is a JSON object
365+
*
366+
* @param array<mixed> $array
363367
*/
364368
protected function arrayIsObject(array $array): bool
365369
{

src/ArrayContainsComparator/Matcher/ArrayLength.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ArrayLength
1111
/**
1212
* Match the exact length of an array
1313
*
14-
* @param array $array An array
14+
* @param array<mixed> $array An array
1515
* @param int|string $length The expected exact length of $array
1616
* @throws InvalidArgumentException
1717
*/

src/ArrayContainsComparator/Matcher/ArrayMaxLength.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ArrayMaxLength
1111
/**
1212
* Match the max length of an array
1313
*
14-
* @param array $array An array
14+
* @param array<mixed> $array An array
1515
* @param int|string $maxLength The expected maximum length of $array
1616
* @throws InvalidArgumentException
1717
*/

src/ArrayContainsComparator/Matcher/ArrayMinLength.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ArrayMinLength
1111
/**
1212
* Match the min length of an array
1313
*
14-
* @param array $array An array
14+
* @param array<mixed> $array An array
1515
* @param int|string $minLength The expected minimum length of $array
1616
* @throws InvalidArgumentException
1717
*/

src/ArrayContainsComparator/Matcher/JWT.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class JWT
1919
/**
2020
* JWT tokens present in the response body
2121
*
22-
* @var array<string,array{payload:array,secret:string}>
22+
* @var array<string,array{payload:array<mixed>,secret:string}>
2323
*/
2424
private array $jwtTokens = [];
2525

@@ -41,6 +41,8 @@ public function __construct(Comparator $comparator)
4141

4242
/**
4343
* Add a JWT token that can be matched
44+
*
45+
* @param array<mixed> $payload
4446
*/
4547
public function addToken(string $name, array $payload, string $secret): self
4648
{

src/Context/ApiClientAwareContext.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ interface ApiClientAwareContext extends Context
1010
{
1111
/**
1212
* Initialize the Guzzle client
13+
*
14+
* @param array<mixed> $config
1315
*/
1416
public function initializeClient(array $config): self;
1517
}

src/Context/ApiContext.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class ApiContext implements ApiClientAwareContext, ArrayContainsComparatorAwareC
8686
/**
8787
* Set the client instance
8888
*
89+
* @param array<mixed> $config
8990
* @throws InvalidArgumentException
9091
*/
9192
public function initializeClient(array $config): static
@@ -1409,7 +1410,7 @@ protected function getResponseBody(): array|stdClass
14091410
* Get the response body as an array
14101411
*
14111412
* @throws InvalidArgumentException
1412-
* @return array
1413+
* @return array<mixed>
14131414
*/
14141415
protected function getResponseBodyArray(): array
14151416
{

0 commit comments

Comments
 (0)