xref: /PHP-8.1/tests/classes/interfaces_002.phpt (revision f8d79582)
1--TEST--
2ZE2 interface with an unimplemented method
3--FILE--
4<?php
5
6interface ThrowableInterface {
7    public function getMessage();
8    public function getErrno();
9}
10
11class Exception_foo implements ThrowableInterface {
12    public $foo = "foo";
13
14    public function getMessage() {
15        return $this->foo;
16    }
17}
18
19// this should die -- Exception class must be abstract...
20$foo = new Exception_foo;
21echo "Message: " . $foo->getMessage() . "\n";
22
23?>
24===DONE===
25--EXPECTF--
26Fatal error: Class Exception_foo contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (ThrowableInterface::getErrno) in %s on line %d
27