xref: /PHP-7.3/Zend/tests/ns_071.phpt (revision 1dab96c1)
1--TEST--
2Testing parameter type-hinted (array) with default value inside namespace
3--FILE--
4<?php
5
6namespace foo;
7
8class bar {
9	public function __construct(array $x = NULL) {
10		var_dump($x);
11	}
12}
13
14new bar(null);
15new bar(new \stdclass);
16
17?>
18--EXPECTF--
19NULL
20
21Fatal error: Uncaught TypeError: Argument 1 passed to foo\bar::__construct() must be of the type array or null, object given, called in %s on line %d and defined in %s:%d
22Stack trace:
23#0 %s(%d): foo\bar->__construct(Object(stdClass))
24#1 {main}
25  thrown in %s on line %d
26