@@ -225,30 +225,31 @@ public function toSpanData(): SpanDataInterface
225225 $ this ->updateSpanLinks ();
226226 $ this ->updateSpanEvents ();
227227
228- if (in_array ( ' addLink ' , get_class_methods (SpanInterface::class)) ) {
228+ if (PHP_VERSION_ID < 80100 ) {
229229 return new ImmutableSpan (
230230 $ this ,
231231 $ this ->getName (),
232232 $ this ->links ,
233233 $ this ->events ,
234234 Attributes::create (array_merge ($ this ->span ->meta , $ this ->span ->metrics )),
235235 $ this ->totalRecordedEvents ,
236- $ this ->totalRecordedLinks ,
237236 StatusData::create ($ this ->status ->getCode (), $ this ->status ->getDescription ()),
238237 $ hasEnded ? $ this ->span ->getStartTime () + $ this ->span ->getDuration () : 0 ,
239238 $ this ->hasEnded (),
240239 );
241240 } else {
241+ // v1.1 backward compatibility: totalRecordedLinks parameter added
242242 return new ImmutableSpan (
243- $ this ,
244- $ this ->getName (),
245- $ this ->links ,
246- $ this ->events ,
247- Attributes::create (array_merge ($ this ->span ->meta , $ this ->span ->metrics )),
248- $ this ->totalRecordedEvents ,
249- StatusData::create ($ this ->status ->getCode (), $ this ->status ->getDescription ()),
250- $ hasEnded ? $ this ->span ->getStartTime () + $ this ->span ->getDuration () : 0 ,
251- $ this ->hasEnded (),
243+ span: $ this ,
244+ name: $ this ->getName (),
245+ links: $ this ->links ,
246+ events: $ this ->events ,
247+ attributes: Attributes::create (array_merge ($ this ->span ->meta , $ this ->span ->metrics )),
248+ totalRecordedEvents: $ this ->totalRecordedEvents ,
249+ totalRecordedLinks: $ this ->totalRecordedLinks ,
250+ status: StatusData::create ($ this ->status ->getCode (), $ this ->status ->getDescription ()),
251+ endEpochNanos: $ hasEnded ? $ this ->span ->getStartTime () + $ this ->span ->getDuration () : 0 ,
252+ hasEnded: $ this ->hasEnded (),
252253 );
253254 }
254255 }
0 commit comments