Guest User

Untitled

a guest
Apr 26th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. <?php
  2. namespace ZendTest\Code\Reflection;
  3.  
  4. require_once(__DIR__ . '/zend-loader/src/StandardAutoloader.php');
  5.  
  6. use Zend\Loader\StandardAutoloader;
  7.  
  8. $zend_loader = new StandardAutoloader();
  9. $zend_loader->registerNamespace('Zend\\Loader', __DIR__ . '/zend-loader/src/');
  10. $zend_loader->registerNamespace('Zend\\Code', __DIR__ . '/zend-code/src/');
  11. $zend_loader->register();
  12.  
  13. use Zend\Code\Annotation\AnnotationManager;
  14. use Zend\Code\Reflection\DocBlock;
  15. use Zend\Code\Reflection\DocBlock\TagManager;
  16. use Zend\Code\Reflection\DocBlock\Tag;
  17. use Zend\Code\Reflection\ClassReflection;
  18. use Zend\Code\Reflection\MethodReflection;
  19. use Zend\Code\Reflection\ParameterReflection;
  20. use Zend\Code\Scanner\CachingFileScanner;
  21.  
  22. class MockTest
  23. {
  24.  
  25. /**
  26. * Short Desc 1
  27. *
  28. * Long Desc 1
  29. *
  30. * @param string $param1
  31. * @return string
  32. */
  33. public function myMethod1(string $param1)
  34. {
  35. return 'No problem';
  36. }
  37.  
  38. /**
  39. * Short Desc 2
  40. *
  41. * Long Desc 2
  42. *
  43. * @param string $param1
  44. */
  45. public function myMethod2(string $param1)
  46. {
  47.  
  48. }
  49. }
  50.  
  51. $method1 = new MethodReflection('ZendTest\Code\Reflection\MockTest', 'myMethod1');
  52. $prototype1 = $method1->getPrototype();
  53. $ret_type1 = $method1->getReturnType();
  54.  
  55. var_dump([$method1, $prototype1, $ret_type1]);
  56.  
  57. //-------------------------------------------------
  58.  
  59. $method2 = new MethodReflection('ZendTest\Code\Reflection\MockTest', 'myMethod2');
  60.  
  61. // Crashes here
  62. echo 'Crashing now!<br>';
  63. $prototype2 = $method2->getPrototype();
  64. $ret_type2 = $method2->getReturnType();
  65.  
  66. var_dump([$method2, $prototype2, $ret_type2]);
Add Comment
Please, Sign In to add comment