Maybe instead of calling 3 times `$order->setPaymentState()` & `return`, set value in variable and call this method once at the end?

Like:
```php
$paymentState = PaymentInterface::STATE_NEW;

// Payment is completed if we have received full amount
if ($completedPaymentTotal === $order->getTotal()) {
    $paymentState = PaymentInterface::STATE_COMPLETED;
}

$order->setPaymentState($paymentState);