refactor(social): TokenRedactor::redact accepts nullable

Lets the call sites drop the explicit null check ternary. The redactor
itself owns the null handling — one less conditional at every caller.
This commit is contained in:
Paulo Castellano 2026-05-19 09:25:01 -03:00
parent cf80e1fcae
commit 123996bbc0
2 changed files with 6 additions and 2 deletions

View file

@ -28,7 +28,7 @@ public function context(): array
'category' => $this->category->value,
'platform_error_code' => $this->platformErrorCode,
'user_message' => $this->userMessage,
'raw_response' => $this->rawResponse !== null ? TokenRedactor::redact($this->rawResponse) : null,
'raw_response' => TokenRedactor::redact($this->rawResponse),
];
}

View file

@ -12,8 +12,12 @@
*/
class TokenRedactor
{
public static function redact(string $body): string
public static function redact(?string $body): ?string
{
if ($body === null) {
return null;
}
return preg_replace(
[
'/access_token=([^&"\s]+)/',