This can be simplified to:
/**
* @param \Magento\Checkout\Api\PaymentInformationManagementInterface $subject
* @param int $cartId
* @param \Magento\Quote\Api\Data\PaymentInterface $paymentMethod
* @return void
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function beforeSavePaymentInformation(
\Magento\Checkout\Api\PaymentInformationManagementInterface $subject,
$cartId,
\Magento\Quote\Api\Data\PaymentInterface $paymentMethod
) {
if ($this->isAgreementEnabled()) {
$this->validateAgreements($paymentMethod->getExtensionAttributes()->getAgreementIds());
}
}
A trick: a «before» plugin can avoid declaration of unused last arguments if it needs not modify any argument