request38992.phpt 638 B

123456789101112131415161718192021222324252627
  1. --TEST--
  2. Request #38992 (invoke() and invokeArgs() static method calls should match)
  3. --FILE--
  4. <?php
  5. class MyClass
  6. {
  7. public static function doSomething()
  8. {
  9. echo "Did it!\n";
  10. }
  11. }
  12. $r = new ReflectionMethod('MyClass', 'doSomething');
  13. try {
  14. $r->invoke('WTF?');
  15. } catch (TypeError $e) {
  16. echo $e->getMessage(), "\n";
  17. }
  18. try {
  19. $r->invokeArgs('WTF?', array());
  20. } catch (TypeError $e) {
  21. echo $e->getMessage(), "\n";
  22. }
  23. ?>
  24. --EXPECT--
  25. ReflectionMethod::invoke(): Argument #1 ($object) must be of type ?object, string given
  26. ReflectionMethod::invokeArgs(): Argument #1 ($object) must be of type ?object, string given