Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply coding standards #136

Merged
merged 3 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ before starting to add changes. Use example [placed in the end of the page](#exa
## [Unreleased]

- [OS-119] Keeping value of CPR clean, not adding address protection text
- Applied coding standards

## [3.16.0] 2024-08-27
## [3.16.0-beta1] 2024-08-27

[#110](https://github.com/OS2Forms/os2forms/pull/110)

Expand Down Expand Up @@ -280,7 +281,8 @@ before starting to add changes. Use example [placed in the end of the page](#exa
- Security in case of vulnerabilities.
```

[Unreleased]: https://github.com/OS2Forms/os2forms/compare/3.15.8...HEAD
[Unreleased]: https://github.com/OS2Forms/os2forms/compare/3.16.0-beta1...HEAD
[3.16.0-beta1]: https://github.com/OS2Forms/os2forms/compare/3.15.8...3.16.0-beta1
[3.15.8]: https://github.com/OS2Forms/os2forms/compare/3.15.7...3.15.8
[3.15.7]: https://github.com/OS2Forms/os2forms/compare/3.15.6...3.15.7
[3.15.6]: https://github.com/OS2Forms/os2forms/compare/3.15.5...3.15.6
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@
"phpstan/extension-installer": true,
"simplesamlphp/composer-module-installer": true,
"vaimo/composer-patches": true,
"zaporylie/composer-drupal-optimizations": true
"zaporylie/composer-drupal-optimizations": true,
"mglaman/composer-drupal-lenient": true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected function defineDefaultProperties() {
/**
* {@inheritdoc}
*/
public function prepare(array &$element, WebformSubmissionInterface $webform_submission = NULL) {
public function prepare(array &$element, ?WebformSubmissionInterface $webform_submission = NULL) {
parent::prepare($element, $webform_submission);

if (isset($element['#webform_key'])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function getDefaultProperties() {
/**
* {@inheritdoc}
*/
public function prepare(array &$element, WebformSubmissionInterface $webform_submission = NULL) {
public function prepare(array &$element, ?WebformSubmissionInterface $webform_submission = NULL) {
parent::prepare($element, $webform_submission);

$element['#autocomplete_route_parameters']['remove_place_name'] = $element['#remove_place_name'] ?? FALSE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function getDefaultProperties() {
/**
* {@inheritdoc}
*/
public function prepare(array &$element, WebformSubmissionInterface $webform_submission = NULL) {
public function prepare(array &$element, ?WebformSubmissionInterface $webform_submission = NULL) {
parent::prepare($element, $webform_submission);

$element['#webform_composite_elements']['address']['#remove_place_name'] = TRUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function getDefaultProperties() {
/**
* {@inheritdoc}
*/
public function prepare(array &$element, WebformSubmissionInterface $webform_submission = NULL) {
public function prepare(array &$element, ?WebformSubmissionInterface $webform_submission = NULL) {
parent::prepare($element, $webform_submission);

$element['#autocomplete_route_name'] = 'os2forms_dawa.element.autocomplete';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function getDefaultProperties() {
/**
* {@inheritdoc}
*/
public function prepare(array &$element, WebformSubmissionInterface $webform_submission = NULL) {
public function prepare(array &$element, ?WebformSubmissionInterface $webform_submission = NULL) {
parent::prepare($element, $webform_submission);

$element['#autocomplete_route_parameters']['remove_code'] = $element['#remove_code'] ?? FALSE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function getDefaultProperties() {
/**
* {@inheritdoc}
*/
public function prepare(array &$element, WebformSubmissionInterface $webform_submission = NULL) {
public function prepare(array &$element, ?WebformSubmissionInterface $webform_submission = NULL) {
parent::prepare($element, $webform_submission);

$element['#autocomplete_route_parameters']['remove_code'] = $element['#remove_code'] ?? FALSE;
Expand Down
13 changes: 11 additions & 2 deletions modules/os2forms_digital_post/src/Helper/DigitalPostHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
use Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupInterfaceCompany;
use Drupal\os2web_datalookup\Plugin\os2web\DataLookup\DataLookupInterfaceCpr;
use Drupal\webform\WebformSubmissionInterface;
use ItkDev\Serviceplatformen\Service\SF1601\Serializer;
use ItkDev\Serviceplatformen\Service\SF1601\SF1601;
use ItkDev\Serviceplatformen\Service\SF1601\Serializer;
use Oio\Fjernprint\ForsendelseI;
use Psr\Log\LoggerInterface;
use Psr\Log\LoggerTrait;
Expand Down Expand Up @@ -55,7 +55,7 @@ public function __construct(
*
* @phpstan-return array<int, mixed>
*/
public function sendDigitalPost(string $type, Message $message, ?ForsendelseI $forsendelse, WebformSubmissionInterface $submission = NULL): array {
public function sendDigitalPost(string $type, Message $message, ?ForsendelseI $forsendelse, ?WebformSubmissionInterface $submission = NULL): array {
$senderSettings = $this->settings->getSender();
$options = [
'test_mode' => (bool) $this->settings->getTestMode(),
Expand All @@ -76,6 +76,15 @@ public function sendDigitalPost(string $type, Message $message, ?ForsendelseI $f

/**
* {@inheritdoc}
*
* @param mixed $level
* The level.
* @param string $message
* The message.
* @param array $context
* The context.
*
* @phpstan-param array<string, mixed> $context
*/
public function log($level, $message, array $context = []): void {
$this->logger->log($level, $message, $context);
Expand Down
2 changes: 1 addition & 1 deletion modules/os2forms_digital_post/src/Helper/MeMoHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
use Drupal\os2web_datalookup\LookupResult\CompanyLookupResult;
use Drupal\os2web_datalookup\LookupResult\CprLookupResult;
use Drupal\webform\WebformSubmissionInterface;
use ItkDev\Serviceplatformen\Service\SF1601\Serializer;
use ItkDev\Serviceplatformen\Service\SF1601\SF1601;
use ItkDev\Serviceplatformen\Service\SF1601\Serializer;

/**
* MeMo helper.
Expand Down
2 changes: 1 addition & 1 deletion modules/os2forms_digital_post/src/Helper/SF1461Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class SF1461Helper {
* See "BeskedFåTilsendt" on
* https://digitaliseringskataloget.dk/integration/sf1461.
*/
public function buildResponseDocument(int $statusCode, string $errorMessage = NULL): \DOMDocument {
public function buildResponseDocument(int $statusCode, ?string $errorMessage = NULL): \DOMDocument {
$xml = <<<'XML'
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:ModtagBeskedOutputType xmlns="urn:oio:sag-dok:3.0.0" xmlns:ns2="urn:oio:sts:1.0.0">
Expand Down
15 changes: 12 additions & 3 deletions modules/os2forms_digital_post/src/Helper/WebformHelperSF1601.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace Drupal\os2forms_digital_post\Helper;

use Drupal\advancedqueue\Entity\QueueInterface;
use Drupal\advancedqueue\Job;
use Drupal\advancedqueue\JobResult;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Logger\LoggerChannelInterface;
use Drupal\advancedqueue\Entity\QueueInterface;
use Drupal\advancedqueue\Job;
use Drupal\advancedqueue\JobResult;
use Drupal\os2forms_digital_post\Exception\InvalidRecipientIdentifierElementException;
use Drupal\os2forms_digital_post\Exception\RuntimeException;
use Drupal\os2forms_digital_post\Exception\SubmissionNotFoundException;
Expand Down Expand Up @@ -199,6 +199,15 @@ private function loadQueue(): QueueInterface {

/**
* {@inheritdoc}
*
* @param mixed $level
* The level.
* @param string $message
* The message.
* @param array $context
* The context.
*
* @phpstan-param array<string, mixed> $context
*/
public function log($level, $message, array $context = []): void {
$this->logger->log($level, $message, $context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Drupal\os2forms_digital_post\Plugin\AdvancedQueue\JobType;

use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\advancedqueue\Job;
use Drupal\advancedqueue\JobResult;
use Drupal\advancedqueue\Plugin\AdvancedQueue\JobType\JobTypeBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\os2forms_digital_post\Helper\WebformHelperSF1601;
use Symfony\Component\DependencyInjection\ContainerInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class WebformOs2FormsEncryptSubmissionStorage extends WebformEncryptSubmissionSt
*
* @see Drupal\webform\WebformSubmissionStorage::getColumns
*/
public function getColumns(WebformInterface $webform = NULL, EntityInterface $source_entity = NULL, AccountInterface $account = NULL, $include_elements = TRUE) {
public function getColumns(?WebformInterface $webform = NULL, ?EntityInterface $source_entity = NULL, ?AccountInterface $account = NULL, $include_elements = TRUE) {
if (!\Drupal::moduleHandler()->moduleExists('webform_revisions')) {
return parent::getColumns($webform, $source_entity, $account, $include_elements);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace Drupal\os2forms_fbs_handler\Plugin\AdvancedQueue\JobType;

use Drupal\advancedqueue\Job;
use Drupal\advancedqueue\JobResult;
use Drupal\advancedqueue\Plugin\AdvancedQueue\JobType\JobTypeBase;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\Core\Logger\LoggerChannelInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\advancedqueue\Job;
use Drupal\advancedqueue\JobResult;
use Drupal\advancedqueue\Plugin\AdvancedQueue\JobType\JobTypeBase;
use Drupal\os2forms_fbs_handler\Client\FBS;
use Drupal\os2forms_fbs_handler\Client\Model\Guardian;
use Drupal\os2forms_fbs_handler\Client\Model\Patron;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace Drupal\os2forms_fbs_handler\Plugin\WebformHandler;

use Drupal\advancedqueue\Entity\Queue;
use Drupal\advancedqueue\Job;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\Core\Logger\LoggerChannelInterface;
use Drupal\Core\Render\RendererInterface;
use Drupal\advancedqueue\Entity\Queue;
use Drupal\advancedqueue\Job;
use Drupal\os2forms_fbs_handler\Plugin\AdvancedQueue\JobType\FbsCreateUser;
use Drupal\webform\Plugin\WebformHandlerBase;
use Drupal\webform\WebformSubmissionConditionsValidatorInterface;
Expand Down
8 changes: 4 additions & 4 deletions modules/os2forms_forloeb/src/MaestroHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

use DigitalPost\MeMo\Action;
use DigitalPost\MeMo\EntryPoint;
use Drupal\advancedqueue\Entity\QueueInterface;
use Drupal\advancedqueue\Job;
use Drupal\advancedqueue\JobResult;
use Drupal\Component\Render\MarkupInterface;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Config\ConfigFactoryInterface;
Expand All @@ -19,6 +16,9 @@
use Drupal\Core\Render\Markup;
use Drupal\Core\Site\Settings;
use Drupal\Core\Url;
use Drupal\advancedqueue\Entity\QueueInterface;
use Drupal\advancedqueue\Job;
use Drupal\advancedqueue\JobResult;
use Drupal\entity_print\Plugin\EntityPrintPluginManagerInterface;
use Drupal\maestro\Engine\MaestroEngine;
use Drupal\maestro\Utility\TaskHandler;
Expand Down Expand Up @@ -456,7 +456,7 @@ private function sendNotificationDigitalPost(
*
* @see self::renderHtml()
*/
public function renderNotification(WebformSubmissionInterface $submission, string $handlerId, string $notificationType, array $templateTask, int $maestroQueueID, string $contentType = NULL): array {
public function renderNotification(WebformSubmissionInterface $submission, string $handlerId, string $notificationType, array $templateTask, int $maestroQueueID, ?string $contentType = NULL): array {
$handler = $submission->getWebform()->getHandler($handlerId);
$settings = $handler->getSettings();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Drupal\os2forms_forloeb\Plugin\AdvancedQueue\JobType;

use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\advancedqueue\Job;
use Drupal\advancedqueue\JobResult;
use Drupal\advancedqueue\Plugin\AdvancedQueue\JobType\JobTypeBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\os2forms_forloeb\MaestroHelper;
use Symfony\Component\DependencyInjection\ContainerInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MaestroWebformInheritTask extends MaestroWebformTask {
* [1] - is the queue ID
* The processID and queueID properties are defined in the MaestroTaskTrait.
*/
public function __construct(array $configuration = NULL) {
public function __construct(?array $configuration = NULL) {
if (is_array($configuration)) {
$this->processID = $configuration[0];
$this->queueID = $configuration[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class MaestroWebformMultipleTask extends MaestroWebformTask {
* [1] - is the queue ID
* The processID and queueID properties are defined in the MaestroTaskTrait.
*/
public function __construct(array $configuration = NULL) {
public function __construct(?array $configuration = NULL) {
if (is_array($configuration)) {
$this->processID = $configuration[0];
$this->queueID = $configuration[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function getElementSelectorSourceValues(array $element) {
/**
* {@inheritdoc}
*/
public function prepare(array &$element, WebformSubmissionInterface $webform_submission = NULL) {
public function prepare(array &$element, ?WebformSubmissionInterface $webform_submission = NULL) {
// Setting empty options to avoid errors during load.
$element['#options'] = [];
parent::prepare($element, $webform_submission);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function getElementSelectorSourceValues(array $element) {
/**
* {@inheritdoc}
*/
public function prepare(array &$element, WebformSubmissionInterface $webform_submission = NULL) {
public function prepare(array &$element, ?WebformSubmissionInterface $webform_submission = NULL) {
// Setting empty options to avoid errors during load.
$element['#options'] = [];
parent::prepare($element, $webform_submission);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function getTranslatableProperties() {
/**
* {@inheritdoc}
*/
public function prepare(array &$element, WebformSubmissionInterface $webform_submission = NULL) {
public function prepare(array &$element, ?WebformSubmissionInterface $webform_submission = NULL) {
parent::prepare($element, $webform_submission);

$element['#attributes']['class'][] = 'nemlogin-button-link';
Expand Down
2 changes: 1 addition & 1 deletion modules/os2forms_permissions_by_term/src/Helper/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public function fieldWidgetWebformEntityReferenceFormAlter(array &$elements) {
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
*/
private function filterWebformSelectOptions(array $options, array &$result = [], string $parent = NULL) {
private function filterWebformSelectOptions(array $options, array &$result = [], ?string $parent = NULL) {
foreach ($options as $key => $option) {
if ($option instanceof FieldFilteredMarkup) {
$webform = $this->entityTypeManager->getStorage('webform')->load($key);
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/WebformElement/Os2formsPersonLookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected function defineDefaultProperties() {
/**
* {@inheritdoc}
*/
protected function prepareElementValidateCallbacks(array &$element, WebformSubmissionInterface $webform_submission = NULL) {
protected function prepareElementValidateCallbacks(array &$element, ?WebformSubmissionInterface $webform_submission = NULL) {
parent::prepareElementValidateCallbacks($element, $webform_submission);

$element['#element_validate'][] = [get_class($this), 'validatePerson'];
Expand Down
Loading