@@ -28,6 +28,10 @@ function trueCheck(mixed $input, bool $allow_null = false): void
28
28
trueCheck ($ a , allow_null: false );
29
29
assertType ('string ' , $ a ); // correct (string)
30
30
31
+ $ a = x ();
32
+ trueCheck (allow_null: false , input: $ a );
33
+ assertType ('string ' , $ a ); // correct (string)
34
+
31
35
$ a = x ();
32
36
trueCheck ($ a , true );
33
37
assertType ('string|null ' , $ a ); // correct (string|null)
@@ -36,6 +40,10 @@ function trueCheck(mixed $input, bool $allow_null = false): void
36
40
trueCheck ($ a , allow_null: true );
37
41
assertType ('string|null ' , $ a ); // correct (string|null)
38
42
43
+ $ a = x ();
44
+ trueCheck (allow_null: true , input: $ a );
45
+ assertType ('string|null ' , $ a ); // correct (string|null)
46
+
39
47
/** @phpstan-assert ($allow_null is false ? string : string|null) $input */
40
48
function falseCheck (mixed $ input , bool $ allow_null = false ): void
41
49
{
@@ -53,6 +61,10 @@ function falseCheck(mixed $input, bool $allow_null = false): void
53
61
falseCheck ($ a , allow_null: false );
54
62
assertType ('string ' , $ a ); // correct (string)
55
63
64
+ $ a = x ();
65
+ falseCheck (allow_null: false , input: $ a );
66
+ assertType ('string ' , $ a ); // correct (string|null)
67
+
56
68
$ a = x ();
57
69
falseCheck ($ a , true );
58
70
assertType ('string|null ' , $ a ); // correct (string|null)
@@ -61,6 +73,10 @@ function falseCheck(mixed $input, bool $allow_null = false): void
61
73
falseCheck ($ a , allow_null: true );
62
74
assertType ('string|null ' , $ a ); // correct (string|null)
63
75
76
+ $ a = x ();
77
+ falseCheck (allow_null: true , input: $ a );
78
+ assertType ('string|null ' , $ a ); // correct (string|null)
79
+
64
80
/** @phpstan-assert ($allow_null is not true ? string : string|null) $input */
65
81
function notTrueCheck (mixed $ input , bool $ allow_null = false ): void
66
82
{
@@ -78,6 +94,10 @@ function notTrueCheck(mixed $input, bool $allow_null = false): void
78
94
notTrueCheck ($ a , allow_null: false );
79
95
assertType ('string ' , $ a ); // correct (string)
80
96
97
+ $ a = x ();
98
+ notTrueCheck (allow_null: false , input: $ a );
99
+ assertType ('string ' , $ a ); // correct (string|null)
100
+
81
101
$ a = x ();
82
102
notTrueCheck ($ a , true );
83
103
assertType ('string|null ' , $ a ); // correct (string|null)
@@ -86,6 +106,10 @@ function notTrueCheck(mixed $input, bool $allow_null = false): void
86
106
notTrueCheck ($ a , allow_null: true );
87
107
assertType ('string|null ' , $ a ); // correct (string|null)
88
108
109
+ $ a = x ();
110
+ notTrueCheck (allow_null: true , input: $ a );
111
+ assertType ('string|null ' , $ a ); // correct (string|null)
112
+
89
113
/** @phpstan-assert ($allow_null is not false ? string|null : string) $input */
90
114
function notFalseCheck (mixed $ input , bool $ allow_null = false ): void
91
115
{
@@ -103,10 +127,18 @@ function notFalseCheck(mixed $input, bool $allow_null = false): void
103
127
notFalseCheck ($ a , allow_null: false );
104
128
assertType ('string ' , $ a ); // correct (string)
105
129
130
+ $ a = x ();
131
+ notFalseCheck (allow_null: false , input: $ a );
132
+ assertType ('string ' , $ a ); // correct (string|null)
133
+
106
134
$ a = x ();
107
135
notFalseCheck ($ a , true );
108
136
assertType ('string|null ' , $ a ); // correct (string|null)
109
137
110
138
$ a = x ();
111
139
notFalseCheck ($ a , allow_null: true );
112
140
assertType ('string|null ' , $ a ); // correct (string|null)
141
+
142
+ $ a = x ();
143
+ notFalseCheck (allow_null: true , input: $ a );
144
+ assertType ('string|null ' , $ a ); // correct (string|null)
0 commit comments