File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
tests/PHPStan/Analyser/data Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -91,3 +91,23 @@ function nonEmptyArrayTest(array $a): void
9191 assertType ('1.0 ' , floatval ($ a ));
9292 assertType ('true ' , boolval ($ a ));
9393}
94+
95+ /**
96+ * @param array{} $a
97+ * @param array{foo: mixed, bar?: mixed} $b
98+ * @param array{foo?: mixed, bar?: mixed} $c
99+ */
100+ function constantArrayTest (array $ a , array $ b , array $ c ): void
101+ {
102+ assertType ('0 ' , intval ($ a ));
103+ assertType ('0.0 ' , floatval ($ a ));
104+ assertType ('false ' , boolval ($ a ));
105+
106+ assertType ('1 ' , intval ($ b ));
107+ assertType ('1.0 ' , floatval ($ b ));
108+ assertType ('true ' , boolval ($ b ));
109+
110+ assertType ('0|1 ' , intval ($ c ));
111+ assertType ('0.0|1.0 ' , floatval ($ c ));
112+ assertType ('bool ' , boolval ($ c ));
113+ }
You can’t perform that action at this time.
0 commit comments