Skip to content

Commit c12eebd

Browse files
committed
Simplified and documented test types, re-generated baseline
1 parent 1309467 commit c12eebd

File tree

3 files changed

+86
-42
lines changed

3 files changed

+86
-42
lines changed

psalm-baseline.xml

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -437,18 +437,21 @@
437437
</PropertyNotSetInConstructor>
438438
</file>
439439
<file src="src/Check/Memcache.php">
440-
<DocblockTypeContradiction occurrences="1">
440+
<DocblockTypeContradiction occurrences="2">
441+
<code>$port &lt; 0</code>
441442
<code>is_string($host)</code>
442443
</DocblockTypeContradiction>
443-
<MixedAssignment occurrences="2">
444+
<MixedAssignment occurrences="1">
444445
<code>$memcache</code>
445-
<code>$stats</code>
446446
</MixedAssignment>
447447
<MixedMethodCall occurrences="3">
448448
<code>addServer</code>
449449
<code>connect</code>
450450
<code>getExtendedStats</code>
451451
</MixedMethodCall>
452+
<NoValue occurrences="1">
453+
<code>$port</code>
454+
</NoValue>
452455
<PropertyNotSetInConstructor occurrences="1">
453456
<code>Memcache</code>
454457
</PropertyNotSetInConstructor>
@@ -457,18 +460,21 @@
457460
</RedundantCastGivenDocblockType>
458461
</file>
459462
<file src="src/Check/Memcached.php">
460-
<DocblockTypeContradiction occurrences="1">
463+
<DocblockTypeContradiction occurrences="2">
464+
<code>$port &lt; 0</code>
461465
<code>is_string($host)</code>
462466
</DocblockTypeContradiction>
463-
<MixedAssignment occurrences="2">
467+
<MixedAssignment occurrences="1">
464468
<code>$memcached</code>
465-
<code>$stats</code>
466469
</MixedAssignment>
467470
<MixedMethodCall occurrences="3">
468471
<code>addServer</code>
469472
<code>getLastDisconnectedServer</code>
470473
<code>getStats</code>
471474
</MixedMethodCall>
475+
<NoValue occurrences="1">
476+
<code>$port</code>
477+
</NoValue>
472478
<PropertyNotSetInConstructor occurrences="1">
473479
<code>Memcached</code>
474480
</PropertyNotSetInConstructor>
@@ -602,9 +608,33 @@
602608
</UndefinedDocblockClass>
603609
</file>
604610
<file src="src/Check/Redis.php">
611+
<MixedAssignment occurrences="1">
612+
<code>$client</code>
613+
</MixedAssignment>
614+
<MixedInferredReturnType occurrences="1">
615+
<code>PredisClient|RedisExtensionClient</code>
616+
</MixedInferredReturnType>
617+
<MixedMethodCall occurrences="2">
618+
<code>auth</code>
619+
<code>connect</code>
620+
</MixedMethodCall>
621+
<MixedReturnStatement occurrences="1">
622+
<code>$client</code>
623+
</MixedReturnStatement>
605624
<PropertyNotSetInConstructor occurrences="1">
606625
<code>Redis</code>
607626
</PropertyNotSetInConstructor>
627+
<UndefinedClass occurrences="1">
628+
<code>RedisException</code>
629+
</UndefinedClass>
630+
<UndefinedDocblockClass occurrences="3">
631+
<code>$client</code>
632+
<code>PredisClient|RedisExtensionClient</code>
633+
<code>RedisException</code>
634+
</UndefinedDocblockClass>
635+
<UnnecessaryVarAnnotation occurrences="1">
636+
<code>array</code>
637+
</UnnecessaryVarAnnotation>
608638
</file>
609639
<file src="src/Check/SecurityAdvisory.php">
610640
<DocblockTypeContradiction occurrences="1">
@@ -1039,15 +1069,17 @@
10391069
</PossiblyNullArgument>
10401070
</file>
10411071
<file src="test/MemcacheTest.php">
1042-
<InvalidArgument occurrences="1">
1072+
<InvalidArgument occurrences="2">
1073+
<code>-11211</code>
10431074
<code>['127.0.0.1']</code>
10441075
</InvalidArgument>
10451076
<InvalidCast occurrences="1">
10461077
<code>['127.0.0.1']</code>
10471078
</InvalidCast>
10481079
</file>
10491080
<file src="test/MemcachedTest.php">
1050-
<InvalidArgument occurrences="1">
1081+
<InvalidArgument occurrences="2">
1082+
<code>-11211</code>
10511083
<code>['127.0.0.1']</code>
10521084
</InvalidArgument>
10531085
<InvalidCast occurrences="1">

test/MemcacheTest.php

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace LaminasTest\Diagnostics;
44

5-
use Generator;
65
use InvalidArgumentException;
76
use Laminas\Diagnostics\Check\Memcache;
87
use PHPUnit\Framework\TestCase;
@@ -26,6 +25,7 @@ public function testPortValidation(): void
2625

2726
/**
2827
* @dataProvider providerValidConstructorArguments
28+
* @param array<empty, empty>|array{string}|array{string, positive-int|0} $arguments
2929
*/
3030
public function testConstructor(array $arguments): void
3131
{
@@ -34,24 +34,30 @@ public function testConstructor(array $arguments): void
3434
$this->expectNotToPerformAssertions();
3535
}
3636

37-
public function providerValidConstructorArguments(): Generator
37+
/**
38+
* @return non-empty-array<
39+
* non-empty-string,
40+
* array{array<empty, empty>|array{string}|array{string, positive-int|0}}
41+
* >
42+
*/
43+
public static function providerValidConstructorArguments(): array
3844
{
39-
yield 'no arguments' => [
40-
[],
41-
];
42-
yield 'only host' => [
43-
['127.0.0.1'],
44-
];
45-
yield 'host and port' => [
46-
[
47-
'127.0.0.1',
48-
11211,
45+
return [
46+
'no arguments' => [[]],
47+
'only host' => [
48+
['127.0.0.1'],
4949
],
50-
];
51-
yield 'unix socket' => [
52-
[
53-
'unix:///run/memcached/memcached.sock',
54-
0,
50+
'host and port' => [
51+
[
52+
'127.0.0.1',
53+
11211,
54+
],
55+
],
56+
'unix socket' => [
57+
[
58+
'unix:///run/memcached/memcached.sock',
59+
0,
60+
],
5561
],
5662
];
5763
}

test/MemcachedTest.php

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace LaminasTest\Diagnostics;
44

5-
use Generator;
65
use InvalidArgumentException;
76
use Laminas\Diagnostics\Check\Memcached;
87
use PHPUnit\Framework\TestCase;
@@ -26,6 +25,7 @@ public function testPortValidation(): void
2625

2726
/**
2827
* @dataProvider providerValidConstructorArguments
28+
* @param array<empty, empty>|array{string}|array{string, positive-int|0} $arguments
2929
*/
3030
public function testConstructor(array $arguments): void
3131
{
@@ -34,24 +34,30 @@ public function testConstructor(array $arguments): void
3434
$this->expectNotToPerformAssertions();
3535
}
3636

37-
public function providerValidConstructorArguments(): Generator
37+
/**
38+
* @return non-empty-array<
39+
* non-empty-string,
40+
* array{array<empty, empty>|array{string}|array{string, positive-int|0}}
41+
* >
42+
*/
43+
public static function providerValidConstructorArguments(): array
3844
{
39-
yield 'no arguments' => [
40-
[],
41-
];
42-
yield 'only host' => [
43-
['127.0.0.1'],
44-
];
45-
yield 'host and port' => [
46-
[
47-
'127.0.0.1',
48-
11211,
45+
return [
46+
'no arguments' => [[]],
47+
'only host' => [
48+
['127.0.0.1'],
4949
],
50-
];
51-
yield 'unix socket' => [
52-
[
53-
'/run/memcached/memcached.sock',
54-
0,
50+
'host and port' => [
51+
[
52+
'127.0.0.1',
53+
11211,
54+
],
55+
],
56+
'unix socket' => [
57+
[
58+
'unix:///run/memcached/memcached.sock',
59+
0,
60+
],
5561
],
5662
];
5763
}

0 commit comments

Comments
 (0)