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

Add and use http-message-util #157

Merged
merged 4 commits into from
Jan 7, 2025
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
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ before starting to add changes. Use example [placed in the end of the page](#exa

## [Unreleased]

## [3.21.2] 2025-01-07

- Adds missing `http-message-util` requirement and use statement.
- Runs code-analysis on `os2forms_fbs_handler` module.

## [3.21.1] 2025-01-06

- Updated Maestro notification handler assignment message format.
Expand Down Expand Up @@ -328,7 +333,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.21.1...HEAD
[Unreleased]: https://github.com/OS2Forms/os2forms/compare/3.21.2...HEAD
[3.21.2]: https://github.com/OS2Forms/os2forms/compare/3.21.1...3.21.2
[3.21.1]: https://github.com/OS2Forms/os2forms/compare/3.21.0...3.21.1
[3.21.0]: https://github.com/OS2Forms/os2forms/compare/3.20.1...3.21.0
[3.20.1]: https://github.com/OS2Forms/os2forms/compare/3.20.0...3.20.1
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"drupal/webform_validation": "^2.0",
"drupal/webform_views": "^5.0@alpha",
"drupal/workflow_participants": "^3.0@RC",
"fig/http-message-util": "^1.1",
"http-interop/http-factory-guzzle": "^1.0.0",
"itk-dev/beskedfordeler-drupal": "^1.0",
"itk-dev/serviceplatformen": "^1.5",
Expand Down
3 changes: 3 additions & 0 deletions modules/os2forms_fbs_handler/src/Client/FBS.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Drupal\os2forms_fbs_handler\Client\Model\Guardian;
use Drupal\os2forms_fbs_handler\Client\Model\Patron;
use Fig\Http\Message\RequestMethodInterface;
use GuzzleHttp\Client;
use Symfony\Component\HttpFoundation\Request;

Expand Down Expand Up @@ -242,6 +243,8 @@ public function createGuardian(Patron $patron, Guardian $guardian): int {
*
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \JsonException
*
* @phpstan-param array<mixed>|string $data
*/
private function request(string $uri, array|string $data, string $method = Request::METHOD_POST): mixed {
$url = rtrim($this->endpoint, '/\\');
Expand Down
2 changes: 2 additions & 0 deletions modules/os2forms_fbs_handler/src/Client/Model/Guardian.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public function __construct(
*
* @return array
* Array with field required by FBS calls.
*
* @phpstan-return array<string, string>
*/
public function toArray(): array {
return [
Expand Down
6 changes: 6 additions & 0 deletions modules/os2forms_fbs_handler/src/Client/Model/Patron.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ final class Patron {

/**
* Default constructor.
*
* @phpstan-param array<mixed>|null $notificationProtocols
* @phpstan-param array<mixed>|null $onHold
* @phpstan-param array<mixed>|null $emailAddresses
*/
public function __construct(
public readonly ?string $patronId = NULL,
Expand All @@ -35,6 +39,8 @@ public function __construct(
*
* @return array
* Array with field required by FBS calls.
*
* @phpstan-return array<string, string>
*/
public function toArray(): array {
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ final class FbsCreateUser extends JobTypeBase implements ContainerFactoryPluginI

/**
* {@inheritdoc}
*
* @phpstan-param array<mixed> $configuration
*/
public function __construct(
array $configuration,
Expand All @@ -50,6 +52,8 @@ public function __construct(

/**
* {@inheritdoc}
*
* @phpstan-param array<mixed> $configuration
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ final class FbsWebformHandler extends WebformHandlerBase {

/**
* Constructs an FbsWebformHandler object.
*
* @phpstan-param array<mixed> $configuration
*/
public function __construct(
array $configuration,
Expand All @@ -70,6 +72,8 @@ public function __construct(

/**
* {@inheritdoc}
*
* @phpstan-param array<mixed> $configuration
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
Expand All @@ -87,6 +91,10 @@ public static function create(ContainerInterface $container, array $configuratio

/**
* {@inheritdoc}
*
* @phpstan-param array<mixed> $form
*
* @phpstan-return array<mixed>
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state): array {
if (is_null($this->getQueue())) {
Expand Down Expand Up @@ -143,6 +151,8 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta

/**
* {@inheritdoc}
*
* @phpstan-param array<mixed> $form
*/
public function submitConfigurationForm(array &$form, FormStateInterface $form_state): void {
parent::submitConfigurationForm($form, $form_state);
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ parameters:
level: 6
paths:
- modules/os2forms_digital_post/
- modules/os2forms_fbs_handler/
excludePaths:
# @see https://github.com/mglaman/drupal-check/issues/261#issuecomment-1030141772/
- vendor
Expand Down
Loading