Skip to content

Commit

Permalink
Address level 4 PHPStan issues
Browse files Browse the repository at this point in the history
- Doctrine extention was added to the Stan setup. Preventing unused
  field warnings.
  • Loading branch information
MKodde committed Mar 20, 2024
1 parent 402a02a commit a79214f
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 27 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"overtrue/phplint": "*",
"phpmd/phpmd": "^2.15",
"phpstan/phpstan": "^1.11.x-dev",
"phpstan/phpstan-doctrine": "^1.3",
"phpstan/phpstan-mockery": "^1.1",
"phpstan/phpstan-symfony": "^1.3",
"phpunit/phpunit": "^9.5",
Expand Down
74 changes: 73 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ public function __construct(ManagerRegistry $registry)
}

/**
* @return InstitutionConfigurationOptions
* @throws NonUniqueResultException
*/
public function findConfigurationOptionsFor(Institution $institution)
public function findConfigurationOptionsFor(Institution $institution): ?InstitutionConfigurationOptions
{
return $this->createQueryBuilder('ico')
->where('ico.institution = :institution')
Expand Down
25 changes: 8 additions & 17 deletions src/Surfnet/StepupMiddleware/GatewayBundle/Entity/SecondFactor.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,34 +37,25 @@ class SecondFactor
#[ORM\Column(length: 36)]
private string $id;

/**
* @param string $identityId
* @param string $nameId
* @param string $institution
* @param string $displayLocale
* @param string $secondFactorId
* @param string $secondFactorType
* @param string $secondFactorIdentifier
*/
public function __construct(
#[ORM\Id]
#[ORM\Column(length: 36)]
private $identityId,
private string $identityId,
#[ORM\Column(length: 200)]
private $nameId,
private string $nameId,
#[ORM\Column(length: 200)]
private $institution,
private string $institution,
/**
* In which language to display any second factor verification screens.
*/
#[ORM\Column]
public $displayLocale,
public string $displayLocale,
#[ORM\Column(length: 36)]
private $secondFactorId,
private string $secondFactorId,
#[ORM\Column(length: 255)]
private $secondFactorIdentifier,
private string $secondFactorIdentifier,
#[ORM\Column(length: 50)]
private $secondFactorType,
private string $secondFactorType,
/**
* This boolean indicates if the second factor token was vetted
* using one of the vetting types that are considered 'identity-vetted'.
Expand All @@ -74,7 +65,7 @@ public function __construct(
* was RA vetted.
*/
#[ORM\Column(type: 'boolean', options: ['default' => '1'])]
private $identityVetted,
private bool $identityVetted,
) {
$this->id = (string)Uuid::uuid4();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,11 @@ public function applySsoOn2faOptionChangedEvent(SsoOn2faOptionChangedEvent $even
}
// It can happen that the event changed for an institution that already exists, but is not yet projected to
// this projection. In that case we can create it.
if (!$institutionConfiguration) {
$institutionConfiguration = new InstitutionConfiguration(
(string)$event->institution,
$event->ssoOn2faOption->isEnabled(),
);
$this->repository->save($institutionConfiguration);
}
$institutionConfiguration = new InstitutionConfiguration(
(string)$event->institution,
$event->ssoOn2faOption->isEnabled(),
);
$this->repository->save($institutionConfiguration);
}

public function applyInstitutionConfigurationRemovedEvent(InstitutionConfigurationRemovedEvent $event): void
Expand Down

0 comments on commit a79214f

Please sign in to comment.