bug42802.phpt 667 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --TEST--
  2. Bug #42802 (Namespace not supported in typehints)
  3. --FILE--
  4. <?php
  5. namespace foo;
  6. class bar {
  7. }
  8. function test1(bar $bar) {
  9. echo "ok\n";
  10. }
  11. function test2(\foo\bar $bar) {
  12. echo "ok\n";
  13. }
  14. function test3(\foo\bar $bar) {
  15. echo "ok\n";
  16. }
  17. function test4(\Exception $e) {
  18. echo "ok\n";
  19. }
  20. function test5(\bar $bar) {
  21. echo "bug\n";
  22. }
  23. $x = new bar();
  24. $y = new \Exception();
  25. test1($x);
  26. test2($x);
  27. test3($x);
  28. test4($y);
  29. test5($x);
  30. --EXPECTF--
  31. ok
  32. ok
  33. ok
  34. ok
  35. Catchable fatal error: Argument 1 passed to foo\test5() must be an instance of bar, instance of foo\bar given, called in %sbug42802.php on line %d and defined in %sbug42802.php on line %d