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
7 changes: 4 additions & 3 deletions UPGRADE-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
- The `IgnoreErrorsIntegration` integration was removed. Use the `ignore_errors` option instead.
- `Sentry\Exception\InvalidArgumentException` was removed. Use `\InvalidArgumentException` instead.
- `Sentry\Exception/ExceptionInterface` was removed.
- Removed `ClientBuilderInterface::setSerializer()`
- Removed `ClientBuilder::setSerializer()`
- Removed `ClientBuilderInterface::setSerializer()`.
- Removed `ClientBuilder::setSerializer()`.
- Removed `Client::__construct()` param SerializerInterface $serializer.
- Change return type of `Dsn:: getProjectId()` to string
- Change return type of `Dsn:: getProjectId()` to string.
- Most setters now return `$this` instead of `void`.
24 changes: 18 additions & 6 deletions src/CheckIn.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,39 +80,47 @@ public function getMonitorSlug(): string
return $this->monitorSlug;
}

public function setMonitorSlug(string $monitorSlug): void
public function setMonitorSlug(string $monitorSlug): self
{
$this->monitorSlug = $monitorSlug;

return $this;
}

public function getStatus(): CheckInStatus
{
return $this->status;
}

public function setStatus(CheckInStatus $status): void
public function setStatus(CheckInStatus $status): self
{
$this->status = $status;

return $this;
}

public function getRelease(): ?string
{
return $this->release;
}

public function setRelease(string $release): void
public function setRelease(string $release): self
{
$this->release = $release;

return $this;
}

public function getEnvironment(): ?string
{
return $this->environment;
}

public function setEnvironment(string $environment): void
public function setEnvironment(string $environment): self
{
$this->environment = $environment;

return $this;
}

/**
Expand All @@ -126,18 +134,22 @@ public function getDuration()
/**
* @param int|float|null $duration The duration of the check-in in seconds
*/
public function setDuration($duration): void
public function setDuration($duration): self
{
$this->duration = $duration;

return $this;
}

public function getMonitorConfig(): ?MonitorConfig
{
return $this->monitorConfig;
}

public function setMonitorConfig(?MonitorConfig $monitorConfig): void
public function setMonitorConfig(?MonitorConfig $monitorConfig): self
{
$this->monitorConfig = $monitorConfig;

return $this;
}
}
14 changes: 7 additions & 7 deletions src/ClientBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function __construct(?Options $options = null)
/**
* @param array<string, mixed> $options The client options, in naked array form
*/
public static function create(array $options = []): ClientBuilder
public static function create(array $options = []): self
{
return new self(new Options($options));
}
Expand All @@ -85,28 +85,28 @@ public function getOptions(): Options
return $this->options;
}

public function setRepresentationSerializer(RepresentationSerializerInterface $representationSerializer): ClientBuilder
public function setRepresentationSerializer(RepresentationSerializerInterface $representationSerializer): self
{
$this->representationSerializer = $representationSerializer;

return $this;
}

public function setLogger(LoggerInterface $logger): ClientBuilder
public function setLogger(LoggerInterface $logger): self
{
$this->logger = $logger;

return $this;
}

public function setSdkIdentifier(string $sdkIdentifier): ClientBuilder
public function setSdkIdentifier(string $sdkIdentifier): self
{
$this->sdkIdentifier = $sdkIdentifier;

return $this;
}

public function setSdkVersion(string $sdkVersion): ClientBuilder
public function setSdkVersion(string $sdkVersion): self
{
$this->sdkVersion = $sdkVersion;

Expand All @@ -118,7 +118,7 @@ public function getTransport(): TransportInterface
return $this->transport;
}

public function setTransport(TransportInterface $transport): ClientBuilder
public function setTransport(TransportInterface $transport): self
{
$this->transport = $transport;

Expand All @@ -130,7 +130,7 @@ public function getHttpClient(): HttpClientInterface
return $this->httpClient;
}

public function setHttpClient(HttpClientInterface $httpClient): ClientBuilder
public function setHttpClient(HttpClientInterface $httpClient): self
{
$this->httpClient = $httpClient;

Expand Down
Loading