ns_056.phpt 528 B

1234567891011121314151617181920212223242526272829303132
  1. --TEST--
  2. 056: type-hint compatibility in namespaces
  3. --SKIPIF--
  4. <?php if (!extension_loaded("spl")) die("skip SPL is no available"); ?>
  5. --FILE--
  6. <?php
  7. namespace test\ns1;
  8. use \SplObserver;
  9. class Foo implements SplObserver {
  10. function update(\SplSubject $x) {
  11. echo "ok\n";
  12. }
  13. }
  14. class Bar implements \SplSubject {
  15. function attach(SplObserver $x) {
  16. echo "ok\n";
  17. }
  18. function notify() {
  19. }
  20. function detach(SplObserver $x) {
  21. }
  22. }
  23. $foo = new Foo();
  24. $bar = new Bar();
  25. $bar->attach($foo);
  26. $foo->update($bar);
  27. ?>
  28. --EXPECT--
  29. ok
  30. ok