Skip to content
Open
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
5 changes: 4 additions & 1 deletion src/Controller/Webhooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ public function handle_requests()
$this->config->log()->info('Webhook Received: empty body!');
return;
}
if (!$this->orderByWoocommerce($body->data->code, $body->data->order->metadata, $body->id) ) {
$code = $body->data->code ?? null;
$metadata = $body->data->order->metadata ?? null;
Comment on lines +64 to +65
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The null coalescing operator only protects against the final property being null, not intermediate properties. If $body->data is null, this will still produce a "Attempt to read property on null" warning. Consider using the nullsafe operator ?-> instead, or check if $body->data exists first. For example: $code = $body->data?->code ?? null; and $metadata = $body->data?->order?->metadata ?? null;

Copilot uses AI. Check for mistakes.

if (!$this->orderByWoocommerce($code, $metadata, $body->id) ) {
return;
}

Expand Down
Loading