@@ -756,23 +756,41 @@ public static function handlerGetClassInfo($server, $msg)
756
756
public static function handlerGetFunctionInfo ($ server , $ msg )
757
757
{
758
758
$ json = json_decode ($ msg , true );
759
- if (!$ json || empty ($ json ['function_name ' ])) {
759
+
760
+ $ class_name = $ json ['class_name ' ] ?? '' ;
761
+ $ function_name = $ json ['function_name ' ] ?? '' ;
762
+
763
+ if (!$ json || empty ($ function_name )) {
760
764
return self ::json ('require function_name ' , 4004 );
761
765
}
762
- if (!function_exists ($ json ['function_name ' ])) {
763
- return self ::json ("{$ json ['function_name ' ]} not exists " , 4004 );
766
+
767
+ $ is_static = false ;
768
+ if (!empty ($ class_name )) {
769
+ if (!class_exists ($ class_name )) {
770
+ return self ::json ("{$ class_name } not exists " , 4004 );
771
+ }
772
+ if (!method_exists ($ class_name , $ function_name )) {
773
+ return self ::json ("{$ class_name }\\{$ function_name } not exists " , 4004 );
774
+ }
775
+ $ ref = new \ReflectionMethod ($ class_name , $ function_name );
776
+ $ is_static = $ ref ->isStatic ();
777
+ } else {
778
+ if (!function_exists ($ function_name )) {
779
+ return self ::json ("{$ function_name } not exists " , 4004 );
780
+ }
781
+ $ ref = new \ReflectionFunction ($ function_name );
764
782
}
765
- $ function = new \ReflectionFunction ($ json ['function_name ' ]);
766
783
767
784
$ result = [
768
- 'filename ' => $ function ->getFileName (),
769
- 'line ' => $ function ->getStartLine () ?? '' ,
770
- 'num ' => $ function ->getNumberOfParameters (),
771
- 'user_defined ' => $ function ->isUserDefined (),
772
- 'extension ' => $ function ->getExtensionName (),
785
+ 'filename ' => $ ref ->getFileName (),
786
+ 'line ' => $ ref ->getStartLine () ?? '' ,
787
+ 'num ' => $ ref ->getNumberOfParameters (),
788
+ 'user_defined ' => $ ref ->isUserDefined (),
789
+ 'extension ' => $ ref ->getExtensionName (),
790
+ 'is_static ' => $ is_static ,
773
791
];
774
792
775
- $ params = $ function ->getParameters ();
793
+ $ params = $ ref ->getParameters ();
776
794
777
795
$ list = [];
778
796
foreach ($ params as $ param ) {
0 commit comments