]> granicus.if.org Git - php/commitdiff
Add error case with invalid type declaration default value
authorAnthony Ferrara <ircmaxell@gmail.com>
Wed, 18 Mar 2015 20:53:45 +0000 (16:53 -0400)
committerAnthony Ferrara <ircmaxell@gmail.com>
Wed, 18 Mar 2015 20:53:45 +0000 (16:53 -0400)
Zend/tests/typehints/scalar_constant_defaults_error.phpt [new file with mode: 0644]

diff --git a/Zend/tests/typehints/scalar_constant_defaults_error.phpt b/Zend/tests/typehints/scalar_constant_defaults_error.phpt
new file mode 100644 (file)
index 0000000..53938d7
--- /dev/null
@@ -0,0 +1,16 @@
+--TEST--
+Scalar type hint - default via constants - error condition
+--FILE--
+<?php
+
+const STRING_VAL = "test";
+
+function int_val(int $a = STRING_VAL): int {
+       return $a;
+}
+
+var_dump(int_val());
+
+?>
+--EXPECTF--
+Fatal error: Argument 1 passed to int_val() must be of the type integer, string given, called in %s on line %d and defined in %s on line %d
\ No newline at end of file