Skip to content

Commit 73ca4e8

Browse files
phpstan-botclaude
andcommitted
Remove verbose comments from test files per review feedback
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2b3112d commit 73ca4e8

File tree

2 files changed

+8
-44
lines changed

2 files changed

+8
-44
lines changed

tests/PHPStan/Analyser/nsrt/bug-11234.php

Lines changed: 8 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,84 +6,49 @@
66

77
class Payload {}
88

9-
/**
10-
* When the value at index 0 is a union of constants (0|1|2|3), int leaks
11-
* into the resolved type of the adjacent value during intersection.
12-
* The generalization of 0|1|2|3 to int causes getIterableValueType()
13-
* to include int in the value union, leaking it to position 1.
14-
*
15-
* @param array{0|1|2|3, int|Payload|string|null}&array{int, Payload} $x
16-
*/
9+
/** @param array{0|1|2|3, int|Payload|string|null}&array{int, Payload} $x */
1710
function testIntersectConstantUnionWithInt(mixed $x): void
1811
{
1912
assertType('array{0|1|2|3, Bug11234\Payload}', $x);
2013
}
2114

22-
/**
23-
* Reverse order.
24-
*
25-
* @param array{int, Payload}&array{0|1|2|3, int|Payload|string|null} $x
26-
*/
15+
/** @param array{int, Payload}&array{0|1|2|3, int|Payload|string|null} $x */
2716
function testIntersectConstantUnionWithIntReverse(mixed $x): void
2817
{
2918
assertType('array{0|1|2|3, Bug11234\Payload}', $x);
3019
}
3120

32-
/**
33-
* Both sides have constant unions.
34-
*
35-
* @param array{0|1|2|3, int|Payload|string|null}&array{0|1|2|3, Payload} $x
36-
*/
21+
/** @param array{0|1|2|3, int|Payload|string|null}&array{0|1|2|3, Payload} $x */
3722
function testIntersectBothConstantUnion(mixed $x): void
3823
{
3924
assertType('array{0|1|2|3, Bug11234\Payload}', $x);
4025
}
4126

42-
/**
43-
* Works fine when the first value is just int.
44-
*
45-
* @param array{int, int|Payload|string|null}&array{int, Payload} $y
46-
*/
27+
/** @param array{int, int|Payload|string|null}&array{int, Payload} $y */
4728
function testIntersectPlainInt(mixed $y): void
4829
{
4930
assertType('array{int, Bug11234\Payload}', $y);
5031
}
5132

52-
/**
53-
* Three-value array shape: leaks should not happen across multiple positions.
54-
*
55-
* @param array{0|1, string|int, Payload|null}&array{int, string, Payload} $z
56-
*/
33+
/** @param array{0|1, string|int, Payload|null}&array{int, string, Payload} $z */
5734
function testIntersectThreePositions(mixed $z): void
5835
{
5936
assertType('array{0|1, string, Bug11234\Payload}', $z);
6037
}
6138

62-
/**
63-
* String constant union at first position.
64-
*
65-
* @param array{'a'|'b', int|Payload|string|null}&array{string, Payload} $w
66-
*/
39+
/** @param array{'a'|'b', int|Payload|string|null}&array{string, Payload} $w */
6740
function testIntersectStringConstantUnion(mixed $w): void
6841
{
6942
assertType("array{'a'|'b', Bug11234\Payload}", $w);
7043
}
7144

72-
/**
73-
* Different key count — extra keys from one side are dropped.
74-
*
75-
* @param array{0|1, int|string}&array{int, int, extra?: bool} $v
76-
*/
45+
/** @param array{0|1, int|string}&array{int, int, extra?: bool} $v */
7746
function testIntersectOptionalKey(mixed $v): void
7847
{
7948
assertType('array{0|1, int}', $v);
8049
}
8150

82-
/**
83-
* Boolean constant union.
84-
*
85-
* @param array{true|false, int|string}&array{bool, string} $u
86-
*/
51+
/** @param array{true|false, int|string}&array{bool, string} $u */
8752
function testIntersectBoolConstantUnion(mixed $u): void
8853
{
8954
assertType('array{bool, string}', $u);

tests/PHPStan/Type/TypeCombinatorTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4934,7 +4934,6 @@ public static function dataIntersect(): iterable
49344934
'T of Countable&Iterator (function a(), parameter)',
49354935
];
49364936

4937-
// https://github.com/phpstan/phpstan/issues/11234
49384937
yield [
49394938
[
49404939
new ConstantArrayType(

0 commit comments

Comments
 (0)