xref: /PHP-8.4/tests/classes/interfaces_003.phpt (revision f8d79582)
1--TEST--
2ZE2 interface and __construct
3--FILE--
4<?php
5
6class MyObject {}
7
8interface MyInterface
9{
10    public function __construct(MyObject $o);
11}
12
13class MyTestClass implements MyInterface
14{
15    public function __construct(MyObject $o)
16    {
17    }
18}
19
20$obj = new MyTestClass;
21
22?>
23===DONE===
24--EXPECTF--
25Fatal error: Uncaught ArgumentCountError: Too few arguments to function MyTestClass::__construct(), 0 passed in %sinterfaces_003.php on line 17 and exactly 1 expected in %sinterfaces_003.php:12
26Stack trace:
27#0 %s(%d): MyTestClass->__construct()
28#1 {main}
29  thrown in %sinterfaces_003.php on line %d
30