Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace ZendTest\Code\Reflection;
- require_once(__DIR__ . '/zend-loader/src/StandardAutoloader.php');
- use Zend\Loader\StandardAutoloader;
- $zend_loader = new StandardAutoloader();
- $zend_loader->registerNamespace('Zend\\Loader', __DIR__ . '/zend-loader/src/');
- $zend_loader->registerNamespace('Zend\\Code', __DIR__ . '/zend-code/src/');
- $zend_loader->register();
- use Zend\Code\Annotation\AnnotationManager;
- use Zend\Code\Reflection\DocBlock;
- use Zend\Code\Reflection\DocBlock\TagManager;
- use Zend\Code\Reflection\DocBlock\Tag;
- use Zend\Code\Reflection\ClassReflection;
- use Zend\Code\Reflection\MethodReflection;
- use Zend\Code\Reflection\ParameterReflection;
- use Zend\Code\Scanner\CachingFileScanner;
- class MockTest
- {
- /**
- * Short Desc 1
- *
- * Long Desc 1
- *
- * @param string $param1
- * @return string
- */
- public function myMethod1(string $param1)
- {
- return 'No problem';
- }
- /**
- * Short Desc 2
- *
- * Long Desc 2
- *
- * @param string $param1
- */
- public function myMethod2(string $param1)
- {
- }
- }
- $method1 = new MethodReflection('ZendTest\Code\Reflection\MockTest', 'myMethod1');
- $prototype1 = $method1->getPrototype();
- $ret_type1 = $method1->getReturnType();
- var_dump([$method1, $prototype1, $ret_type1]);
- //-------------------------------------------------
- $method2 = new MethodReflection('ZendTest\Code\Reflection\MockTest', 'myMethod2');
- // Crashes here
- echo 'Crashing now!<br>';
- $prototype2 = $method2->getPrototype();
- $ret_type2 = $method2->getReturnType();
- var_dump([$method2, $prototype2, $ret_type2]);
Add Comment
Please, Sign In to add comment