summaryrefslogtreecommitdiff
path: root/Zend/tests/type_declarations/scalar_constant_defaults_error.phpt
blob: dcbb3e87f4fa084950b7342d1ebfacbc1f5ef328 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--TEST--
Scalar type - 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: Uncaught TypeError: Argument 1 passed to int_val() must be of the type integer, string given, called in %s on line %d and defined in %s:%d
Stack trace:
#0 %s(%d): int_val()
#1 {main}
  thrown in %s on line %d