Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

stayallive
Copy link
Collaborator

@stayallive stayallive commented Oct 24, 2023

Implement fluent methods on Options and tracing related classes.

I've also updated a few tests just to give some examples.

// From:
$spanContext1 = new SpanContext();
$spanContext1->setSampled(false);
$spanContext1->setSpanId(SpanId::generate());
$spanContext1->setTraceId(TraceId::generate());

// To:
$spanContext1 = (new SpanContext())
    ->setSampled(false)
    ->setSpanId(SpanId::generate())
    ->setTraceId(TraceId::generate());

It's not less code but it does write nicer and as far as I can tell there is no downside to doing this so shouldn't be much against doing this by default.

@stayallive stayallive requested a review from cleptric October 24, 2023 12:55
@stayallive stayallive self-assigned this Oct 24, 2023
@cleptric cleptric added this to the 4.0 milestone Oct 24, 2023
@stayallive stayallive marked this pull request as ready for review October 24, 2023 14:26
@stayallive stayallive changed the title Fluent methods [4.x] Fluent methods Oct 24, 2023
@cleptric cleptric changed the title [4.x] Fluent methods Fluent methods Oct 25, 2023
@cleptric cleptric merged commit 5cc49b3 into 4.x Oct 30, 2023
@cleptric cleptric deleted the fluent branch October 30, 2023 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants