File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 "php-java/java-net-package" : " *" ,
2323 "php-java/java-nio-package" : " *" ,
2424 "gabrielelana/byte-units" : " dev-master" ,
25- "symfony/console" : " 4.2"
25+ "symfony/console" : " 4.2" ,
26+ "phpdocumentor/reflection-docblock" : " 4.3"
2627 },
2728 "autoload" : {
2829 "psr-4" : {
Original file line number Diff line number Diff line change @@ -48,11 +48,28 @@ public function execute(): void
4848 ...$ arguments
4949 );
5050 } else {
51+ $ reflectionClass = new \ReflectionClass (
52+ $ realInvokerClass = TypeResolver::convertPHPTypeToJavaType ($ invokerClass )
53+ );
54+ $ methodAccessor = $ reflectionClass ->getMethod ($ methodName );
55+
56+ if ($ document = $ methodAccessor ->getDocComment ()) {
57+ // parse PHPDoc
58+ $ documentBlock = \phpDocumentor \Reflection \DocBlockFactory::createInstance ()
59+ ->create ($ document );
60+
61+ // Native annotation will dependency inject.
62+ if (!empty ($ documentBlock ->getTagsByName ('native ' ))) {
63+ array_unshift (
64+ $ arguments ,
65+ $ this ->getConstantPool (),
66+ $ this ->javaClass
67+ );
68+ }
69+ }
70+
5171 $ result = call_user_func_array (
52- [
53- TypeResolver::convertPHPTypeToJavaType ($ invokerClass ),
54- $ methodName
55- ],
72+ [$ realInvokerClass , $ methodName ],
5673 $ arguments
5774 );
5875 }
You can’t perform that action at this time.
0 commit comments