Skip to content

Commit

Permalink
Merge pull request #569 from Chris53897/feature/php-8-features
Browse files Browse the repository at this point in the history
feat: php 8 language level mitigations, add typehints for tests
  • Loading branch information
danielmorell authored Jul 29, 2022
2 parents d6ec7a3 + f2745b3 commit 82a5849
Show file tree
Hide file tree
Showing 69 changed files with 788 additions and 769 deletions.
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

0 comments on commit 82a5849

Please sign in to comment.