mirror of
https://github.com/php/php-src.git
synced 2024-11-27 11:53:33 +08:00
fbe30592d6
From now on, we always display the given object's type instead of just reporting "object". Additionally, make the format of return type errors match the format of argument errors. Closes GH-5625
26 lines
499 B
PHP
26 lines
499 B
PHP
--TEST--
|
|
Testing parameter type-hinted (array) with default value inside namespace
|
|
--FILE--
|
|
<?php
|
|
|
|
namespace foo;
|
|
|
|
class bar {
|
|
public function __construct(array $x = NULL) {
|
|
var_dump($x);
|
|
}
|
|
}
|
|
|
|
new bar(null);
|
|
new bar(new \stdclass);
|
|
|
|
?>
|
|
--EXPECTF--
|
|
NULL
|
|
|
|
Fatal error: Uncaught TypeError: foo\bar::__construct(): Argument #1 ($x) must be of type ?array, stdClass given, called in %s:%d
|
|
Stack trace:
|
|
#0 %s(%d): foo\bar->__construct(Object(stdClass))
|
|
#1 {main}
|
|
thrown in %s on line %d
|