Skip to content

Commit

Permalink
Address PHP MD issues that were introduced
Browse files Browse the repository at this point in the history
During fixing of PHPStan issues, some additional mess was created. Two
of which I ignored for now. But left with some explanation on how to fix
them at a later point.
  • Loading branch information
MKodde committed Apr 2, 2024
1 parent 78e1e6a commit 0ae92d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\Validator\Violation\ConstraintViolationBuilder;

/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) Coupling to assertion classes is rather high, might be a good candidate for refactoring
*/
final class ReconfigureInstitutionRequestValidator extends ConstraintValidator
{
/**
Expand Down Expand Up @@ -74,7 +77,6 @@ public function validate(mixed $value, Constraint $constraint): void

public function validateRoot(array $configuration): void
{
Assertion::isArray($configuration, 'Invalid body structure, must be an object', '(root)');
$this->validateInstitutionsExist(array_keys($configuration));

foreach ($configuration as $institution => $options) {
Expand All @@ -98,7 +100,6 @@ public function validateInstitutionsExist(array $institutions): void
public function validateInstitutionConfigurationOptions(array $options, string $institution): void
{
$propertyPath = sprintf('Institution(%s)', $institution);
Assertion::isArray($options, 'Invalid institution configuration, must be an object', $propertyPath);
$requiredOptions = [
'use_ra_locations',
'show_raa_contact_information',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ protected function configure(): void
->addArgument('actor-id', InputArgument::REQUIRED, 'The id of the vetting actor');
}

/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) Method length could be reduced by deconstructing the bootstrapping of the required data and the vetting of the GSSP
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$registrationStatus = $input->getArgument('registration-status');
Expand Down

0 comments on commit 0ae92d9

Please sign in to comment.