interfaces_003.phpt 600 B

1234567891011121314151617181920212223242526272829
  1. --TEST--
  2. ZE2 interface and __construct
  3. --FILE--
  4. <?php
  5. class MyObject {}
  6. interface MyInterface
  7. {
  8. public function __construct(MyObject $o);
  9. }
  10. class MyTestClass implements MyInterface
  11. {
  12. public function __construct(MyObject $o)
  13. {
  14. }
  15. }
  16. $obj = new MyTestClass;
  17. ?>
  18. ===DONE===
  19. --EXPECTF--
  20. Fatal 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
  21. Stack trace:
  22. #0 %s(%d): MyTestClass->__construct()
  23. #1 {main}
  24. thrown in %sinterfaces_003.php on line %d