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

feat: php 8 language level mitigations, add typehints for tests #569

Merged
merged 3 commits into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
use Rollbar\TransformerInterface;
use Rollbar\UtilitiesTrait;
use Throwable;
use Rollbar\ResponseHandlerInterface;
use Rollbar\Senders\FluentSender;
use Rollbar\FilterInterface;

class Config
{
Expand Down Expand Up @@ -425,7 +428,7 @@ private function setMinimumLevel(array $config): void
{
$this->minimumLevel = \Rollbar\Defaults::get()->minimumLevel();

$override = array_key_exists('minimum_level', $config) ? $config['minimum_level'] : null;
$override = $config['minimum_level'] ?? null;
$override = array_key_exists('minimumLevel', $config) ? $config['minimumLevel'] : $override;

if ($override instanceof Level) {
Expand Down Expand Up @@ -454,7 +457,7 @@ private function setReportSuppressed(array $config): void

private function setFilters(array $config): void
{
$this->setupWithOptions($config, "filter", "Rollbar\FilterInterface");
$this->setupWithOptions($config, "filter", FilterInterface::class);
}

private function setSender(array $config): void
Expand Down Expand Up @@ -606,7 +609,7 @@ private function setFluentSenderOptions(array &$config, mixed $default): mixed
if (!isset($config['handler']) || $config['handler'] != 'fluent') {
return $default;
}
$default = "Rollbar\Senders\FluentSender";
$default = FluentSender::class;

if (isset($config['fluent_host'])) {
$config['senderOptions']['fluentHost'] = $config['fluent_host'];
Expand All @@ -625,7 +628,7 @@ private function setFluentSenderOptions(array &$config, mixed $default): mixed

private function setResponseHandler(array $config): void
{
$this->setupWithOptions($config, "responseHandler", "Rollbar\ResponseHandlerInterface");
$this->setupWithOptions($config, "responseHandler", ResponseHandlerInterface::class);
}

private function setCheckIgnoreFunction(array $config): void
Expand Down Expand Up @@ -694,9 +697,7 @@ protected function setupWithOptions(
if ($passWholeConfig) {
$options = $config;
} else {
$options = isset($config[$keyName . "Options"]) ?
$config[$keyName . "Options"] :
array();
$options = $config[$keyName . "Options"] ?? array();
}
$this->$keyName = new $class($options);
} else {
Expand Down
Loading