Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fluent methods #1601

Merged
merged 11 commits into from
Oct 30, 2023
Merged

Fluent methods #1601

merged 11 commits into from
Oct 30, 2023

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 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
31 checks passed
@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