ReflectionMethod_006.phpt 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. --TEST--
  2. ReflectionMethod methods - wrong num args
  3. --CREDITS--
  4. Robin Fernandes <robinf@php.net>
  5. Steve Seear <stevseea@php.net>
  6. --FILE--
  7. <?php
  8. try {
  9. new ReflectionMethod();
  10. } catch (TypeError $re) {
  11. echo "Ok - ".$re->getMessage().PHP_EOL;
  12. }
  13. try {
  14. new ReflectionMethod('a', 'b', 'c');
  15. } catch (TypeError $re) {
  16. echo "Ok - ".$re->getMessage().PHP_EOL;
  17. }
  18. class C {
  19. public function f() {}
  20. }
  21. $rm = new ReflectionMethod('C', 'f');
  22. var_dump($rm->isFinal(1));
  23. var_dump($rm->isAbstract(1));
  24. var_dump($rm->isPrivate(1));
  25. var_dump($rm->isProtected(1));
  26. var_dump($rm->isPublic(1));
  27. var_dump($rm->isStatic(1));
  28. var_dump($rm->isConstructor(1));
  29. var_dump($rm->isDestructor(1));
  30. var_dump($rm->getModifiers(1));
  31. var_dump($rm->isInternal(1));
  32. var_dump($rm->isUserDefined(1));
  33. var_dump($rm->getFileName(1));
  34. var_dump($rm->getStartLine(1));
  35. var_dump($rm->getEndLine(1));
  36. var_dump($rm->getStaticVariables(1));
  37. var_dump($rm->getName(1));
  38. ?>
  39. --EXPECTF--
  40. Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 0 given
  41. Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 3 given
  42. Warning: ReflectionMethod::isFinal() expects exactly 0 parameters, 1 given in %s on line %d
  43. NULL
  44. Warning: ReflectionMethod::isAbstract() expects exactly 0 parameters, 1 given in %s on line %d
  45. NULL
  46. Warning: ReflectionMethod::isPrivate() expects exactly 0 parameters, 1 given in %s on line %d
  47. NULL
  48. Warning: ReflectionMethod::isProtected() expects exactly 0 parameters, 1 given in %s on line %d
  49. NULL
  50. Warning: ReflectionMethod::isPublic() expects exactly 0 parameters, 1 given in %s on line %d
  51. NULL
  52. Warning: ReflectionMethod::isStatic() expects exactly 0 parameters, 1 given in %s on line %d
  53. NULL
  54. Warning: ReflectionMethod::isConstructor() expects exactly 0 parameters, 1 given in %s on line %d
  55. NULL
  56. Warning: ReflectionMethod::isDestructor() expects exactly 0 parameters, 1 given in %s on line %d
  57. NULL
  58. Warning: ReflectionMethod::getModifiers() expects exactly 0 parameters, 1 given in %s on line %d
  59. NULL
  60. Warning: ReflectionFunctionAbstract::isInternal() expects exactly 0 parameters, 1 given in %s on line %d
  61. NULL
  62. Warning: ReflectionFunctionAbstract::isUserDefined() expects exactly 0 parameters, 1 given in %s on line %d
  63. NULL
  64. Warning: ReflectionFunctionAbstract::getFileName() expects exactly 0 parameters, 1 given in %s on line %d
  65. NULL
  66. Warning: ReflectionFunctionAbstract::getStartLine() expects exactly 0 parameters, 1 given in %s on line %d
  67. NULL
  68. Warning: ReflectionFunctionAbstract::getEndLine() expects exactly 0 parameters, 1 given in %s on line %d
  69. NULL
  70. Warning: ReflectionFunctionAbstract::getStaticVariables() expects exactly 0 parameters, 1 given in %s on line %d
  71. NULL
  72. Warning: ReflectionFunctionAbstract::getName() expects exactly 0 parameters, 1 given in %s on line %d
  73. NULL