@@ -28,6 +28,10 @@ function trueCheck(mixed $input, bool $allow_null = false): void
2828trueCheck ($ a , allow_null: false );
2929assertType ('string ' , $ a ); // correct (string)
3030
31+ $ a = x ();
32+ trueCheck (allow_null: false , input: $ a );
33+ assertType ('string ' , $ a ); // correct (string)
34+
3135$ a = x ();
3236trueCheck ($ a , true );
3337assertType ('string|null ' , $ a ); // correct (string|null)
@@ -36,6 +40,10 @@ function trueCheck(mixed $input, bool $allow_null = false): void
3640trueCheck ($ a , allow_null: true );
3741assertType ('string|null ' , $ a ); // correct (string|null)
3842
43+ $ a = x ();
44+ trueCheck (allow_null: true , input: $ a );
45+ assertType ('string|null ' , $ a ); // correct (string|null)
46+
3947/** @phpstan-assert ($allow_null is false ? string : string|null) $input */
4048function falseCheck (mixed $ input , bool $ allow_null = false ): void
4149{
@@ -53,6 +61,10 @@ function falseCheck(mixed $input, bool $allow_null = false): void
5361falseCheck ($ a , allow_null: false );
5462assertType ('string ' , $ a ); // correct (string)
5563
64+ $ a = x ();
65+ falseCheck (allow_null: false , input: $ a );
66+ assertType ('string ' , $ a ); // correct (string|null)
67+
5668$ a = x ();
5769falseCheck ($ a , true );
5870assertType ('string|null ' , $ a ); // correct (string|null)
@@ -61,6 +73,10 @@ function falseCheck(mixed $input, bool $allow_null = false): void
6173falseCheck ($ a , allow_null: true );
6274assertType ('string|null ' , $ a ); // correct (string|null)
6375
76+ $ a = x ();
77+ falseCheck (allow_null: true , input: $ a );
78+ assertType ('string|null ' , $ a ); // correct (string|null)
79+
6480/** @phpstan-assert ($allow_null is not true ? string : string|null) $input */
6581function notTrueCheck (mixed $ input , bool $ allow_null = false ): void
6682{
@@ -78,6 +94,10 @@ function notTrueCheck(mixed $input, bool $allow_null = false): void
7894notTrueCheck ($ a , allow_null: false );
7995assertType ('string ' , $ a ); // correct (string)
8096
97+ $ a = x ();
98+ notTrueCheck (allow_null: false , input: $ a );
99+ assertType ('string ' , $ a ); // correct (string|null)
100+
81101$ a = x ();
82102notTrueCheck ($ a , true );
83103assertType ('string|null ' , $ a ); // correct (string|null)
@@ -86,6 +106,10 @@ function notTrueCheck(mixed $input, bool $allow_null = false): void
86106notTrueCheck ($ a , allow_null: true );
87107assertType ('string|null ' , $ a ); // correct (string|null)
88108
109+ $ a = x ();
110+ notTrueCheck (allow_null: true , input: $ a );
111+ assertType ('string|null ' , $ a ); // correct (string|null)
112+
89113/** @phpstan-assert ($allow_null is not false ? string|null : string) $input */
90114function notFalseCheck (mixed $ input , bool $ allow_null = false ): void
91115{
@@ -103,10 +127,18 @@ function notFalseCheck(mixed $input, bool $allow_null = false): void
103127notFalseCheck ($ a , allow_null: false );
104128assertType ('string ' , $ a ); // correct (string)
105129
130+ $ a = x ();
131+ notFalseCheck (allow_null: false , input: $ a );
132+ assertType ('string ' , $ a ); // correct (string|null)
133+
106134$ a = x ();
107135notFalseCheck ($ a , true );
108136assertType ('string|null ' , $ a ); // correct (string|null)
109137
110138$ a = x ();
111139notFalseCheck ($ a , allow_null: true );
112140assertType ('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