xref: /PHP-5.5/Zend/tests/ns_072.phpt (revision 1b4134c0)
1--TEST--
2Testing parameter type-hinted with interface
3--FILE--
4<?php
5
6namespace foo;
7
8interface foo {
9
10}
11
12class bar {
13	public function __construct(foo $x = NULL) {
14		var_dump($x);
15	}
16}
17
18class test implements foo {
19
20}
21
22
23new bar(new test);
24new bar(null);
25new bar(new \stdclass);
26
27?>
28--EXPECTF--
29object(foo\test)#%d (0) {
30}
31NULL
32
33Catchable fatal error: Argument 1 passed to foo\bar::__construct() must implement interface foo\foo, instance of stdClass given, called in %s on line %d and defined in %s on line %d
34