Skip to content
Open
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
21 changes: 10 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
matrix:
# All the versions, OS, and dependency levels we want to support
os: [ubuntu] # TODO: windows, macos
php: [ '8.1', '8.2', '8.3', '8.4' ]
php: [ '8.1', '8.2', '8.3', '8.4', '8.5' ]
dependency: [ stable ]
# Our code has paths for with- and without- XDebug, and we want to test
# both of them.
Expand Down Expand Up @@ -73,22 +73,21 @@ jobs:
key: ${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.dependency }}-
restore-keys: ${{ matrix.os }}-composer-${{ matrix.dependency }}-

- name: Install dependencies PHP < 8.4
if: matrix.php != '8.4'
- name: Install dependencies PHP < 8.5
if: matrix.php != '8.5'
run: composer update --prefer-${{ matrix.dependency }} --prefer-dist --no-interaction

- name: Execute tests PHP < 8.4
if: matrix.php != '8.4'
- name: Execute tests PHP < 8.5
if: matrix.php != '8.5'
run: composer test

# This is a temporary workaround until vimeo/psalm is updated to support PHP 8.4.
# See https://github.com/vimeo/psalm/issues/11107
- name: Install dependencies PHP 8.4
if: matrix.php == '8.4'
# This is a temporary workaround until vimeo/psalm is updated to support PHP 8.5.
- name: Install dependencies PHP 8.5
if: matrix.php == '8.5'
run: composer update --prefer-${{ matrix.dependency }} --prefer-dist --no-interaction --ignore-platform-reqs

- name: Execute tests PHP 8.4
if: matrix.php == '8.4'
- name: Execute tests PHP 8.5
if: matrix.php == '8.5'
run: |
./vendor/bin/phpcs --standard=PSR2 ./src ./tests
./vendor/bin/phpunit --coverage-clover build/logs/clover.xml
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"mockery/mockery": "^1.5.1",
"squizlabs/php_codesniffer": "^3.7",
"phpmd/phpmd" : "^2.13",
"vimeo/psalm": "^5.9"
"vimeo/psalm": "^6.13"
},

"suggest": {
Expand Down
6 changes: 6 additions & 0 deletions src/DataBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ protected function setServerExtras($config)
*
* @return void
*/
#[\Override]
public function setCustom(array $config): void
{
$this->custom = $config['custom'] ?? \Rollbar\Defaults::get()->custom();
Expand Down Expand Up @@ -373,6 +374,7 @@ protected function setHost($config)
*
* @return Data
*/
#[\Override]
public function makeData(string $level, Throwable|string|Stringable $toLog, array $context): Data
{
$env = $this->getEnvironment();
Expand Down Expand Up @@ -1013,6 +1015,7 @@ protected function getServerExtras()
*
* @return array|null
*/
#[\Override]
public function getCustom(): ?array
{
return $this->custom;
Expand Down Expand Up @@ -1103,6 +1106,7 @@ protected function resolveCustomContent(mixed $custom): array
*
* @return void
*/
#[\Override]
public function addCustom(string $key, mixed $data): void
{
if (!is_array($this->custom)) {
Expand All @@ -1119,6 +1123,7 @@ public function addCustom(string $key, mixed $data): void
*
* @return void
*/
#[\Override]
public function removeCustom(string $key): void
{
unset($this->custom[$key]);
Expand Down Expand Up @@ -1186,6 +1191,7 @@ private function getSourceLines($filename)
*
* @return ErrorWrapper
*/
#[\Override]
public function generateErrorWrapper(int $errno, string $errstr, ?string $errfile, ?int $errline): ErrorWrapper
{
return new ErrorWrapper(
Expand Down
2 changes: 2 additions & 0 deletions src/Handlers/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@

class ErrorHandler extends AbstractHandler
{
#[\Override]
public function register()
{
$this->previousHandler = set_error_handler(array($this, 'handle'));

parent::register();
}

#[\Override]
public function handle(...$args)
{
parent::handle(...$args);
Expand Down
4 changes: 3 additions & 1 deletion src/Handlers/ExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@

class ExceptionHandler extends AbstractHandler
{
#[\Override]
public function register()
{
$this->previousHandler = set_exception_handler(array($this, 'handle'));

parent::register();
}


#[\Override]
public function handle(...$args)
{
parent::handle(...$args);
Expand Down
6 changes: 4 additions & 2 deletions src/Handlers/FatalHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ class FatalHandler extends AbstractHandler
{

private static $fatalErrors = array(E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR);


#[\Override]
public function register()
{
\register_shutdown_function(array($this, 'handle'));

parent::register();
}


#[\Override]
public function handle(...$args)
{
parent::handle(...$args);
Expand Down
1 change: 1 addition & 0 deletions src/Payload/Body.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public function setTelemetry(?array $telemetry): void
*
* @since 4.1.0 Includes the 'telemetry' key, if it is not empty.
*/
#[\Override]
public function serialize()
{
$result = array();
Expand Down
1 change: 1 addition & 0 deletions src/Payload/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function setPost(array $post): self
return $this;
}

#[\Override]
public function serialize()
{
$result = array(
Expand Down
1 change: 1 addition & 0 deletions src/Payload/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ public function setNotifier(Notifier $notifier): self
return $this;
}

#[\Override]
public function serialize()
{
$result = array(
Expand Down
1 change: 1 addition & 0 deletions src/Payload/ExceptionInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function setDescription(?string $description): self
return $this;
}

#[\Override]
public function serialize()
{
$result = array(
Expand Down
1 change: 1 addition & 0 deletions src/Payload/Frame.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public function setArgs(array $args): self
return $this;
}

#[\Override]
public function serialize()
{
$result = array(
Expand Down
1 change: 1 addition & 0 deletions src/Payload/Level.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public function toInt(): int
*
* @return string
*/
#[\Override]
public function serialize()
{
return $this->level;
Expand Down
2 changes: 2 additions & 0 deletions src/Payload/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public function __construct(
) {
}

#[\Override]
public function getKey(): string
{
return 'message';
Expand Down Expand Up @@ -41,6 +42,7 @@ public function setBacktrace(?array $backtrace): self
return $this;
}

#[\Override]
public function serialize()
{
$toSerialize = array(
Expand Down
1 change: 1 addition & 0 deletions src/Payload/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function setVersion(string $version): self
return $this;
}

#[\Override]
public function serialize()
{
$result = array(
Expand Down
1 change: 1 addition & 0 deletions src/Payload/Payload.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function setAccessToken(string $accessToken): self
return $this;
}

#[\Override]
public function serialize($maxDepth = -1): array
{
$objectHashes = array();
Expand Down
1 change: 1 addition & 0 deletions src/Payload/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public function __set($name, $val)
$this->extra[$name] = $val;
}

#[\Override]
public function serialize()
{
$result = array(
Expand Down
1 change: 1 addition & 0 deletions src/Payload/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public function setSession(array $session): self
return $this;
}

#[\Override]
public function serialize()
{
$result = array(
Expand Down
1 change: 1 addition & 0 deletions src/Payload/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public function setArgv(array $argv): self
return $this;
}

#[\Override]
public function serialize()
{
$result = array(
Expand Down
1 change: 1 addition & 0 deletions src/Payload/TelemetryBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public static function fromArray(array $data): self
*
* @return array
*/
#[\Override]
public function serialize(): array
{
// This filters out any null or empty values.
Expand Down
1 change: 1 addition & 0 deletions src/Payload/TelemetryEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function __construct(
$this->body = is_array($body) ? TelemetryBody::fromArray($body): $body;
}

#[\Override]
public function serialize(): array
{
$result = array_filter([
Expand Down
2 changes: 2 additions & 0 deletions src/Payload/Trace.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public function __construct(
) {
}

#[\Override]
public function getKey(): string
{
return 'trace';
Expand Down Expand Up @@ -41,6 +42,7 @@ public function setException(ExceptionInfo $exception): self
return $this;
}

#[\Override]
public function serialize()
{
$result = array(
Expand Down
2 changes: 2 additions & 0 deletions src/Payload/TraceChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public function __construct(private array $traces)
{
}

#[\Override]
public function getKey(): string
{
return 'trace_chain';
Expand All @@ -26,6 +27,7 @@ public function setTraces(array $traces): self
return $this;
}

#[\Override]
public function serialize()
{
$mapValue = function ($value) {
Expand Down
1 change: 1 addition & 0 deletions src/RollbarLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ public function getCustom(): mixed
* @throws InvalidArgumentException If $level is not a valid level.
* @throws Throwable Rethrown $message if it is {@see Throwable} and {@see Config::raiseOnError} is true.
*/
#[\Override]
public function log($level, $message, array $context = array()): void
{
$this->report($level, $message, $context);
Expand Down
1 change: 1 addition & 0 deletions src/Scrubber.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public function getSafelist()
*
* @return mixed
*/
#[\Override]
public function scrub(array &$data, string $replacement = '********', string $path = ''): array
{
$fields = $this->getScrubFields();
Expand Down
4 changes: 4 additions & 0 deletions src/Senders/AgentSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function __construct($opts)
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
#[\Override]
public function send(EncodedPayload $payload, string $accessToken): Response
{
if (empty($this->agentLog)) {
Expand All @@ -42,6 +43,7 @@ public function send(EncodedPayload $payload, string $accessToken): Response
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
#[\Override]
public function sendBatch(array $batch, string $accessToken): void
{
if (empty($this->agentLog)) {
Expand All @@ -55,6 +57,7 @@ public function sendBatch(array $batch, string $accessToken): void
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
#[\Override]
public function wait(string $accessToken, int $max): void
{
return;
Expand All @@ -69,6 +72,7 @@ public function wait(string $accessToken, int $max): void
*
* @return bool
*/
#[\Override]
public function requireAccessToken(): bool
{
return true;
Expand Down
7 changes: 4 additions & 3 deletions src/Senders/CurlSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public function getEndpoint()
return $this->endpoint;
}

#[\Override]
public function send(EncodedPayload $payload, string $accessToken): Response
{
$handle = curl_init();
Expand All @@ -77,15 +78,14 @@ public function send(EncodedPayload $payload, string $accessToken): Response
$result = $result === false ?
curl_error($handle) :
json_decode($result, true);

curl_close($handle);

$data = $payload->data();
$uuid = $data['data']['uuid'] ?? null;

return new Response($statusCode, $result, $uuid);
}

#[\Override]
public function sendBatch(array $batch, string $accessToken): void
{
if ($this->multiHandle === null) {
Expand All @@ -101,6 +101,7 @@ public function sendBatch(array $batch, string $accessToken): void
$this->checkForCompletedRequests($accessToken);
}

#[\Override]
public function wait(string $accessToken, int $max = 0): void
{
if (count($this->inflightRequests) <= $max) {
Expand All @@ -122,6 +123,7 @@ public function wait(string $accessToken, int $max = 0): void
* @return bool
* @since 4.0.0
*/
#[\Override]
public function requireAccessToken(): bool
{
return false;
Expand Down Expand Up @@ -200,7 +202,6 @@ private function removeFinishedRequests(string $accessToken)
unset($this->inflightRequests[$handleArrayKey]);
curl_multi_remove_handle($this->multiHandle, $handle);
}
curl_close($handle);
}
$this->maybeSendMoreBatchRequests($accessToken);
}
Expand Down
Loading