@@ -156,7 +156,8 @@ public function add_namespace( $namespace_obj, $logid, $unique = false ) {
156156 if ( ! empty ( $ namespace_obj ->name ) ) {
157157 $ line_text = 'namespace ' . $ namespace_obj ->name ->toCodeString ();
158158
159- $ this ->add ( $ namespace_obj ->getStartLine (), $ line_text , $ logid , $ unique );
159+ $ line_number = method_exists ( $ namespace_obj , 'getStartLine ' ) ? $ namespace_obj ->getStartLine () : 0 ;
160+ $ this ->add ( $ line_number , $ line_text , $ logid , $ unique );
160161
161162 $ log_key = array_key_last ( $ this ->log [ $ logid ] );
162163
@@ -180,7 +181,8 @@ public function add_namespace( $namespace_obj, $logid, $unique = false ) {
180181 public function add_call_expr ( $ func_call , $ argposition , $ logid , $ unique = false , $ accurate = true ) {
181182 $ func_call ->setAttribute ( 'comments ' , null );
182183
183- $ this ->add ( $ func_call ->getStartLine (), $ this ->parser_object ->pretty_printer ->prettyPrint ( array ( $ func_call ) ) . '; ' , $ logid , $ unique );
184+ $ line_number = method_exists ( $ func_call , 'getStartLine ' ) ? $ func_call ->getStartLine () : 0 ;
185+ $ this ->add ( $ line_number , $ this ->parser_object ->pretty_printer ->prettyPrint ( array ( $ func_call ) ) . '; ' , $ logid , $ unique );
184186
185187 $ log_key = array_key_last ( $ this ->log [ $ logid ] );
186188 $ func_name = $ this ->parser_object ->get_call_name ( $ func_call );
@@ -210,7 +212,8 @@ public function add_call_expr( $func_call, $argposition, $logid, $unique = false
210212 public function add_var_expr ( $ var_call , $ logid , $ unique = false , $ accurate = true ) {
211213 $ var_call ->setAttribute ( 'comments ' , null );
212214
213- $ this ->add ( $ var_call ->getStartLine (), $ this ->parser_object ->pretty_printer ->prettyPrint ( array ( $ var_call ) ) . '; ' , $ logid , $ unique );
215+ $ line_number = method_exists ( $ var_call , 'getStartLine ' ) ? $ var_call ->getStartLine () : 0 ;
216+ $ this ->add ( $ line_number , $ this ->parser_object ->pretty_printer ->prettyPrint ( array ( $ var_call ) ) . '; ' , $ logid , $ unique );
214217
215218 $ log_key = array_key_last ( $ this ->log [ $ logid ] );
216219 $ var_name = '' ;
@@ -273,7 +276,8 @@ public function add_abstraction_declarations( $abstractions, $logid, $unique = f
273276 if ( $ continue ) { // Ignore anonymous declarations.
274277 $ line_text = $ type . ' ' . $ abstract ->name ->toString ();
275278
276- $ this ->add ( $ abstract ->getStartLine (), $ line_text , $ logid , $ unique );
279+ $ line_number = method_exists ( $ abstract , 'getStartLine ' ) ? $ abstract ->getStartLine () : 0 ;
280+ $ this ->add ( $ line_number , $ line_text , $ logid , $ unique );
277281
278282 $ log_key = array_key_last ( $ this ->log [ $ logid ] );
279283
0 commit comments