Skip to content

Commit fc0bced

Browse files
committed
3782: Clean up
1 parent 06ce6ee commit fc0bced

File tree

3 files changed

+36
-14
lines changed

3 files changed

+36
-14
lines changed

src/Element/NetsEasyPaymentElement.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
namespace Drupal\os2forms_payment\Element;
44

5-
use Drupal\Core\Render\Element\FormElement;
5+
use Drupal\Core\Render\Element\FormElementBase;
66

77
/**
88
* Provides an OS2forms payment element'.
99
*
1010
* @FormElement("os2forms_payment_nets_easy_payment")
1111
*/
12-
class NetsEasyPaymentElement extends FormElement {
12+
class NetsEasyPaymentElement extends FormElementBase {
1313

1414
/**
1515
* {@inheritdoc}

src/Helper/PaymentHelper.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function webformSubmissionPresave(WebFormSubmissionInterface $submission)
106106
* The key of the payment object to update.
107107
* @param mixed|null $value
108108
* The value to set for the payment object key.
109-
* @param array|null $paymentObject
109+
* @param array<mixed>|null $paymentObject
110110
* The payment object to replace the existing with.
111111
*/
112112
public function updateWebformSubmissionPaymentObject(WebformSubmissionInterface $webformSubmission, ?string $key = NULL, mixed $value = NULL, ?array $paymentObject = NULL): WebformSubmissionInterface {
@@ -153,7 +153,7 @@ private function findPaymentElementKey(WebformSubmissionInterface $submission):
153153
* @param \Drupal\webform\WebformSubmissionInterface $submission
154154
* The webform submission.
155155
*
156-
* @return array
156+
* @return array<string, mixed>
157157
* An array containing the payment element and its machine name.
158158
*/
159159
private function getWebformElementNames(WebformSubmissionInterface $submission): array {
@@ -208,9 +208,9 @@ public function webformSubmissionInsert(WebFormSubmissionInterface $submission):
208208
$request = $this->requestStack->getCurrentRequest();
209209
$paymentId = $request->request->get('os2forms_payment_reference_field');
210210

211-
/** @var \Drupal\advancedqueue\Entity\Queue $queue */
211+
/** @var \Drupal\advancedqueue\Entity\Queue|NULL $queue */
212212
$queue = $this->getQueue();
213-
if (!$queue) {
213+
if (is_null($queue)) {
214214
throw new Exception(sprintf('Queue with ID %s does not exist.', $this->queueId));
215215
}
216216
$job = Job::create(NetsEasyPaymentHandler::class, [
@@ -450,7 +450,7 @@ public function getAmountToPayTemp(): float {
450450
* The HTTP method for the request.
451451
* @param string $endpoint
452452
* The endpoint URL.
453-
* @param array $params
453+
* @param array<mixed> $params
454454
* Optional. An associative array of parameters
455455
* to be sent in the request body.
456456
*

src/Plugin/AdvancedQueue/JobType/NetsEasyPaymentHandler.php

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ final class NetsEasyPaymentHandler extends JobTypeBase implements ContainerFacto
2727

2828
/**
2929
* {@inheritdoc}
30+
*
31+
* @param array<mixed> $configuration
32+
* A configuration array containing information about the plugin instance.
33+
* @param string $plugin_id
34+
* The plugin ID for the plugin instance.
35+
* @param mixed $plugin_definition
36+
* The plugin implementation definition.
37+
* @param \Drupal\Core\Logger\LoggerChannel $logger
38+
* The logger.
39+
* @param \GuzzleHttp\Client $httpClient
40+
* The client.
41+
* @param \Drupal\os2forms_payment\Helper\PaymentHelper $paymentHelper
42+
* The payment helper.
3043
*/
3144
public function __construct(
3245
array $configuration,
@@ -41,6 +54,15 @@ public function __construct(
4154

4255
/**
4356
* {@inheritdoc}
57+
*
58+
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
59+
* The container to pull out services used in the plugin.
60+
* @param array<mixed> $configuration
61+
* A configuration array containing information about the plugin instance.
62+
* @param string $plugin_id
63+
* The plugin ID for the plugin instance.
64+
* @param mixed $plugin_definition
65+
* The plugin implementation definition.
4466
*/
4567
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
4668
return new NetsEasyPaymentHandler(
@@ -67,7 +89,7 @@ public function process(Job $job): JobResult {
6789
$payload = $job->getPayload();
6890
$stage = $payload['processing_stage'] ?? 0;
6991

70-
/** @var \Drupal\webform\Entity\WebformSubmissionInterface $webformSubmission */
92+
/** @var \Drupal\webform\WebformSubmissionInterface $webformSubmission */
7193
$webformSubmission = WebformSubmission::load($payload['submissionId']);
7294

7395
$logger_context = [
@@ -107,9 +129,9 @@ public function process(Job $job): JobResult {
107129
*
108130
* @param \Drupal\advancedqueue\Job $job
109131
* The job object containing payload information.
110-
* @param \Drupal\webform\Entity\WebformSubmissionInterface $webformSubmission
132+
* @param \Drupal\webform\WebformSubmissionInterface $webformSubmission
111133
* The webform submission related to the payment.
112-
* @param array $logger_context
134+
* @param array<mixed> $logger_context
113135
* Context for logging.
114136
*
115137
* @throws \Drupal\os2forms_payment\Exception\RuntimeException
@@ -161,9 +183,9 @@ private function getPaymentAndSetRelevantValues(Job $job, WebformSubmissionInter
161183
*
162184
* @param \Drupal\advancedqueue\Job $job
163185
* The job object containing payload information.
164-
* @param \Drupal\webform\Entity\WebformSubmissionInterface $webformSubmission
186+
* @param \Drupal\webform\WebformSubmissionInterface $webformSubmission
165187
* The webform submission related to the payment.
166-
* @param array $logger_context
188+
* @param array<mixed> $logger_context
167189
* Context for logging.
168190
*
169191
* @throws \Drupal\os2forms_payment\Exception\RuntimeException
@@ -199,9 +221,9 @@ private function updatePaymentReference(Job $job, WebformSubmissionInterface $we
199221
*
200222
* @param \Drupal\advancedqueue\Job $job
201223
* The job object containing payload information.
202-
* @param \Drupal\webform\Entity\WebformSubmissionInterface $webformSubmission
224+
* @param \Drupal\webform\WebformSubmissionInterface $webformSubmission
203225
* The webform submission related to the payment.
204-
* @param array $logger_context
226+
* @param array<mixed> $logger_context
205227
* Context for logging.
206228
*
207229
* @throws \Exception

0 commit comments

Comments
 (0)