Skip to content

Commit

Permalink
Address PHP CS issues that were introduced
Browse files Browse the repository at this point in the history
  • Loading branch information
MKodde committed Apr 2, 2024
1 parent 0ae92d9 commit 85b9e33
Show file tree
Hide file tree
Showing 69 changed files with 176 additions and 160 deletions.
5 changes: 5 additions & 0 deletions ci/qa/docheader
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

cd $(dirname $0)/../../

./vendor/bin/docheader --no-ansi check src/ tests/
6 changes: 6 additions & 0 deletions ci/qa/phpcbf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

cd $(dirname $0)/../../

# https://github.com/squizlabs/PHP_CodeSniffer/wiki/Fixing-Errors-Automatically
./vendor/bin/phpcbf --standard=ci/qa/phpcs.xml --extensions=php src $1
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,15 @@
"@phpcs",
"@phpstan",
"@phpcpd",
"@license-headers",
"@phpunit"
],
"phplint": "./ci/qa/phplint",
"phpmd": "./ci/qa/phpmd",
"license-headers": "./ci/qa/docheader",
"phpstan": "./ci/qa/phpstan",
"phpcs": "./ci/qa/phpcs",
"phpcbf": "./ci/qa/phpcbf",
"phpcpd": "./ci/qa/phpcpd",
"phpunit": "./ci/qa/phpunit --",

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,17 @@
*/
class NewInstitutionConfigurationCreatedEvent implements SerializableInterface
{
public function __construct(public InstitutionConfigurationId $institutionConfigurationId, public Institution $institution, public UseRaLocationsOption $useRaLocationsOption, public ShowRaaContactInformationOption $showRaaContactInformationOption, public VerifyEmailOption $verifyEmailOption, public NumberOfTokensPerIdentityOption $numberOfTokensPerIdentityOption, public SsoOn2faOption $ssoOn2faOption, public SelfVetOption $selfVetOption, public SelfAssertedTokensOption $selfAssertedTokensOption)
{
public function __construct(
public InstitutionConfigurationId $institutionConfigurationId,
public Institution $institution,
public UseRaLocationsOption $useRaLocationsOption,
public ShowRaaContactInformationOption $showRaaContactInformationOption,
public VerifyEmailOption $verifyEmailOption,
public NumberOfTokensPerIdentityOption $numberOfTokensPerIdentityOption,
public SsoOn2faOption $ssoOn2faOption,
public SelfVetOption $selfVetOption,
public SelfAssertedTokensOption $selfAssertedTokensOption
) {
}

public static function deserialize(array $data): self
Expand Down Expand Up @@ -80,8 +89,7 @@ public function serialize(): array
'use_ra_locations_option' => $this->useRaLocationsOption->isEnabled(),
'show_raa_contact_information_option' => $this->showRaaContactInformationOption->isEnabled(),
'verify_email_option' => $this->verifyEmailOption->isEnabled(),
'number_of_tokens_per_identity_option' => $this->numberOfTokensPerIdentityOption->getNumberOfTokensPerIdentity(
),
'number_of_tokens_per_identity_option' => $this->numberOfTokensPerIdentityOption->getNumberOfTokensPerIdentity(),
'sso_on_2fa_option' => $this->ssoOn2faOption->isEnabled(),
'self_vet_option' => $this->selfVetOption->isEnabled(),
'self_asserted_tokens_option' => $this->selfAssertedTokensOption->isEnabled(),
Expand Down
10 changes: 8 additions & 2 deletions src/Surfnet/Stepup/Configuration/Event/RaLocationAddedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,14 @@

class RaLocationAddedEvent implements SerializableInterface
{
public function __construct(public InstitutionConfigurationId $institutionConfigurationId, public Institution $institution, public RaLocationId $raLocationId, public RaLocationName $raLocationName, public Location $location, public ContactInformation $contactInformation)
{
public function __construct(
public InstitutionConfigurationId $institutionConfigurationId,
public Institution $institution,
public RaLocationId $raLocationId,
public RaLocationName $raLocationName,
public Location $location,
public ContactInformation $contactInformation
) {
}

public static function deserialize(array $data): self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@

class RaLocationContactInformationChangedEvent implements SerializableInterface
{
public function __construct(public InstitutionConfigurationId $institutionConfigurationId, public RaLocationId $raLocationId, public ContactInformation $contactInformation)
{
public function __construct(
public InstitutionConfigurationId $institutionConfigurationId,
public RaLocationId $raLocationId,
public ContactInformation $contactInformation
) {
}

public static function deserialize(array $data): self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@

class RaLocationRelocatedEvent implements SerializableInterface
{
public function __construct(public InstitutionConfigurationId $institutionConfigurationId, public RaLocationId $raLocationId, public Location $location)
{
public function __construct(
public InstitutionConfigurationId $institutionConfigurationId,
public RaLocationId $raLocationId,
public Location $location
) {
}

public static function deserialize(array $data): self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@

class RaLocationRenamedEvent implements SerializableInterface
{
public function __construct(public InstitutionConfigurationId $institutionConfigurationId, public RaLocationId $raLocationId, public RaLocationName $raLocationName)
{
public function __construct(
public InstitutionConfigurationId $institutionConfigurationId,
public RaLocationId $raLocationId,
public RaLocationName $raLocationName
) {
}

public static function deserialize(array $data): self
Expand Down
18 changes: 6 additions & 12 deletions src/Surfnet/Stepup/Configuration/InstitutionConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -564,43 +564,37 @@ protected function applyUseRaLocationsOptionChangedEvent(UseRaLocationsOptionCha

protected function applyShowRaaContactInformationOptionChangedEvent(
ShowRaaContactInformationOptionChangedEvent $event,
): void
{
): void {
$this->showRaaContactInformationOption = $event->showRaaContactInformationOption;
}

protected function applyVerifyEmailOptionChangedEvent(
VerifyEmailOptionChangedEvent $event,
): void
{
): void {
$this->verifyEmailOption = $event->verifyEmailOption;
}

protected function applySelfVetOptionChangedEvent(
SelfVetOptionChangedEvent $event,
): void
{
): void {
$this->selfVetOption = $event->selfVetOption;
}

protected function applySelfAssertedTokensOptionChangedEvent(
SelfAssertedTokensOptionChangedEvent $event,
): void
{
): void {
$this->selfAssertedTokensOption = $event->selfAssertedTokensOption;
}

protected function applySsoOn2faOptionChangedEvent(
SsoOn2faOptionChangedEvent $event,
): void
{
): void {
$this->ssoOn2faOption = $event->ssoOn2faOption;
}

protected function applyNumberOfTokensPerIdentityOptionChangedEvent(
NumberOfTokensPerIdentityOptionChangedEvent $event,
): void
{
): void {
$this->numberOfTokensPerIdentityOption = $event->numberOfTokensPerIdentityOption;
}

Expand Down
9 changes: 6 additions & 3 deletions src/Surfnet/Stepup/Identity/Entity/RegistrationAuthority.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ final class RegistrationAuthority extends SimpleEventSourcedEntity
{
private ?RegistrationAuthorityRole $role = null;

private ?Location $location = null; // @phpstan-ignore-line PHPStan can not see that this field is written when serialized to the database
// @phpstan-ignore-next-line PHPStan can not see that this field is written when serialized to the database
private ?Location $location = null;

private ?ContactInformation $contactInformation = null; // @phpstan-ignore-line PHPStan can not see that this field is written when serialized to the database
// @phpstan-ignore-next-line PHPStan can not see that this field is written when serialized to the database
private ?ContactInformation $contactInformation = null;

private ?Institution $institution = null; // @phpstan-ignore-line PHPStan can not see that this field is written when serialized to the database
// @phpstan-ignore-next-line PHPStan can not see that this field is written when serialized to the database
private ?Institution $institution = null;

public static function accreditWith(
RegistrationAuthorityRole $role,
Expand Down
2 changes: 1 addition & 1 deletion src/Surfnet/Stepup/Identity/Event/AppointedAsRaEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class AppointedAsRaEvent extends IdentityEvent implements RightToObtainDataInterface
{
/**
* @var string[]
* @var string[]
*/
private array $allowlist = [
'identity_id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
class AppointedAsRaForInstitutionEvent extends IdentityEvent implements RightToObtainDataInterface
{
/**
* @var string[]
* @var string[]
*/
private array $allowlist = [
'identity_id',
Expand Down Expand Up @@ -67,7 +67,7 @@ public static function deserialize(array $data): self

/**
* The data ending up in the event_stream, be careful not to include sensitive data here!
*
*
* @return array<string, mixed>
*/
public function serialize(): array
Expand Down
2 changes: 1 addition & 1 deletion src/Surfnet/Stepup/Identity/Event/AppointedAsRaaEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class AppointedAsRaaEvent extends IdentityEvent implements RightToObtainDataInterface
{
/**
* @var string[]
* @var string[]
*/
private array $allowlist = [
'identity_id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
class AppointedAsRaaForInstitutionEvent extends IdentityEvent implements RightToObtainDataInterface
{
/**
* @var string[]
* @var string[]
*/
private array $allowlist = [
'identity_id',
Expand Down Expand Up @@ -67,7 +67,7 @@ public static function deserialize(array $data): self

/**
* The data ending up in the event_stream, be careful not to include sensitive data here!
*
*
* @return array<string, mixed>
*/
public function serialize(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
class CompliedWithRecoveryCodeRevocationEvent extends IdentityEvent implements RightToObtainDataInterface
{
/**
* @var string[]
* @var string[]
*/
private array $allowlist = [
'identity_id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
abstract class CompliedWithRevocationEvent extends IdentityEvent implements Forgettable, RightToObtainDataInterface
{
/**
* @var string[]
* @var string[]
*/
private array $allowlist = [
'identity_id',
Expand Down
2 changes: 1 addition & 1 deletion src/Surfnet/Stepup/Identity/Event/EmailVerifiedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class EmailVerifiedEvent extends IdentityEvent implements
RightToObtainDataInterface
{
/**
* @var string[]
* @var string[]
*/
private array $allowlist = [
'identity_id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class GssfPossessionProvenAndVerifiedEvent extends IdentityEvent implements
RightToObtainDataInterface
{
/**
* @var string[]
* @var string[]
*/
private array $allowlist = [
'identity_id',
Expand Down Expand Up @@ -117,7 +117,7 @@ public static function deserialize(array $data): self

/**
* The data ending up in the event_stream, be careful not to include sensitive data here!
*
*
* @return array<string, mixed>
*/
public function serialize(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
class GssfPossessionProvenEvent extends IdentityEvent implements Forgettable, RightToObtainDataInterface
{
/**
* @var string[]
* @var string[]
*/
private array $allowlist = [
'identity_id',
Expand Down Expand Up @@ -106,7 +106,7 @@ public static function deserialize(array $data): self

/**
* The data ending up in the event_stream, be careful not to include sensitive data here!
*
*
* @return array<string, mixed>
*/
public function serialize(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
class IdentityAccreditedAsRaEvent extends IdentityEvent implements RightToObtainDataInterface
{
/**
* @var string[]
* @var string[]
*/
private array $allowlist = [
'identity_id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class IdentityAccreditedAsRaForInstitutionEvent extends IdentityEvent implements RightToObtainDataInterface
{
/**
* @var string[]
* @var string[]
*/
private array $allowlist = [
'identity_id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class IdentityAccreditedAsRaaEvent extends IdentityEvent implements RightToObtai
{
/** @var string[] */
/**
* @var string[]
* @var string[]
*/
private array $allowlist = [
'identity_id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class IdentityAccreditedAsRaaForInstitutionEvent extends IdentityEvent implement
{
/** @var string[] */
/**
* @var string[]
* @var string[]
*/
private array $allowlist = [
'identity_id',
Expand Down
4 changes: 2 additions & 2 deletions src/Surfnet/Stepup/Identity/Event/IdentityCreatedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
class IdentityCreatedEvent extends IdentityEvent implements Forgettable, RightToObtainDataInterface
{
/**
* @var string[]
* @var string[]
*/
private array $allowlist = [
'id',
Expand Down Expand Up @@ -77,7 +77,7 @@ public static function deserialize(array $data): self

/**
* The data ending up in the event_stream, be careful not to include sensitive data here!
*
*
* @return array<string, mixed>
*/
public function serialize(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class IdentityEmailChangedEvent extends IdentityEvent implements Forgettable, RightToObtainDataInterface
{
/**
* @var string[]
* @var string[]
*/
private array $allowlist = [
'id',
Expand Down Expand Up @@ -66,7 +66,7 @@ public static function deserialize(array $data): self

/**
* The data ending up in the event_stream, be careful not to include sensitive data here!
*
*
* @return array<string, mixed>
*/
public function serialize(): array
Expand Down
4 changes: 2 additions & 2 deletions src/Surfnet/Stepup/Identity/Event/IdentityForgottenEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class IdentityForgottenEvent extends IdentityEvent implements RightToObtainDataInterface
{
/**
* @var string[]
* @var string[]
*/
private array $allowlist = [
'identity_id',
Expand All @@ -52,7 +52,7 @@ public static function deserialize(array $data): self

/**
* The data ending up in the event_stream, be careful not to include sensitive data here!
*
*
* @return array<string, mixed>
*/
public function serialize(): array
Expand Down
Loading

0 comments on commit 85b9e33

Please sign in to comment.