Skip to content

Commit

Permalink
Address level 3 PHPStan issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MKodde committed Mar 20, 2024
1 parent 4d18df4 commit 402a02a
Show file tree
Hide file tree
Showing 301 changed files with 1,522 additions and 1,734 deletions.
9 changes: 4 additions & 5 deletions src/Surfnet/Migrations/Version20210610131957.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use function json_decode;
use function json_encode;

/**
* This migration removes sensitive data (vetting type) from the event stream
Expand Down Expand Up @@ -36,11 +34,12 @@ public function up(Schema $schema): void
// Do not show warning on migrations.
$this->addSql('# Updating entities.');

$affectedEventStreamRows = $this->connection->executeQuery(self::$select);
$result = $this->connection->executeQuery(self::$select);

$this->write("<info>Affected records: {$affectedEventStreamRows->rowCount()}</info>");
$affectedEventStreamRows = $result->fetchAllAssociative();
$this->write("<info>Affected records: {$result->rowCount()}</info>");

if ($affectedEventStreamRows->rowCount() === 0) {
if ($result->rowCount() === 0) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Surfnet/Stepup/Configuration/Api/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ interface Configuration extends AggregateRoot
/**
* @return Configuration
*/
public static function create();
public static function create(): Configuration;

/**
* @param string $newConfiguration
* @return void
*/
public function update($newConfiguration);
public function update(string $newConfiguration): void;
}
32 changes: 7 additions & 25 deletions src/Surfnet/Stepup/Configuration/Api/InstitutionConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,50 +30,32 @@

interface InstitutionConfiguration extends AggregateRoot
{
/**
* @return InstitutionConfiguration
*/
public static function create(InstitutionConfigurationId $institutionConfigurationId, Institution $institution);
public static function create(InstitutionConfigurationId $institutionConfigurationId, Institution $institution): InstitutionConfiguration;

/**
* @return void
*/
public function configureUseRaLocationsOption(UseRaLocationsOption $useRaLocationsOption);
public function configureUseRaLocationsOption(UseRaLocationsOption $useRaLocationsOption): void;

/**
* @return void
*/
public function configureShowRaaContactInformationOption(
ShowRaaContactInformationOption $showRaaContactInformationOption,
);
): void;

/**
* @return void
*/
public function addRaLocation(
RaLocationId $raLocationId,
RaLocationName $raLocationName,
Location $location,
ContactInformation $contactInformation,
);
): void;

/**
* @return void
*/
public function changeRaLocation(
RaLocationId $raLocationId,
RaLocationName $raLocationName,
Location $location,
ContactInformation $contactInformation,
);
): void;

/**
* @return void
*/
public function removeRaLocation(RaLocationId $raLocationId);
public function removeRaLocation(RaLocationId $raLocationId): void;

/**
* @return void
*/
public function destroy();
public function destroy(): void;
}
6 changes: 3 additions & 3 deletions src/Surfnet/Stepup/Configuration/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Configuration extends EventSourcedAggregateRoot implements ConfigurationIn
/**
* @var array
*/
private $configuration;
private array $configuration;

public static function create(): self
{
Expand All @@ -48,9 +48,9 @@ public static function create(): self
return $configuration;
}

public function update($configurationAsJson): void
public function update(string $newConfiguration): void
{
$decodedConfiguration = JsonHelper::decode($configurationAsJson);
$decodedConfiguration = JsonHelper::decode($newConfiguration);

$this->apply(
new ConfigurationUpdatedEvent(
Expand Down
16 changes: 5 additions & 11 deletions src/Surfnet/Stepup/Configuration/Entity/RaLocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@

class RaLocation
{
/**
* @return RaLocation
*/
public static function create(
RaLocationId $id,
RaLocationName $name,
Expand Down Expand Up @@ -60,42 +57,39 @@ public function changeContactInformation(ContactInformation $contactInformation)
$this->contactInformation = $contactInformation;
}

/**
* @return bool
*/
public function hasId(RaLocationId $otherId)
public function hasId(RaLocationId $otherId): bool
{
return $this->id->equals($otherId);
}

/**
* @return RaLocationId
*/
public function getId()
public function getId(): RaLocationId
{
return $this->id;
}

/**
* @return RaLocationName
*/
public function getName()
public function getName(): RaLocationName
{
return $this->name;
}

/**
* @return Location
*/
public function getLocation()
public function getLocation(): Location
{
return $this->location;
}

/**
* @return ContactInformation
*/
public function getContactInformation()
public function getContactInformation(): ContactInformation
{
return $this->contactInformation;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ abstract class ConfigurationEvent implements SerializableInterface
/**
* @var string
*/
public $id;
public string $id;

public function __construct($id)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ class ConfigurationUpdatedEvent extends ConfigurationEvent
/**
* @var array
*/
public $newConfiguration;
public array $newConfiguration;

/**
* @var array|null
*/
public $oldConfiguration;
public ?array $oldConfiguration;

/**
* @param string $id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class EmailTemplatesUpdatedEvent extends ConfigurationEvent
/**
* @var array
*/
public $emailTemplates;
public array $emailTemplates;

/**
* @param string $configurationId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class IdentityProvidersUpdatedEvent extends ConfigurationEvent
/**
* @var array
*/
public $identityProviders;
public array $identityProviders;

/**
* @param string $configurationId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ class InstitutionConfigurationRemovedEvent implements SerializableInterface
/**
* @var Institution
*/
public $institution;
public Institution $institution;

/**
* @var InstitutionConfigurationId
*/
public $institutionConfigurationId;
public InstitutionConfigurationId $institutionConfigurationId;

public function __construct(InstitutionConfigurationId $institutionConfigurationId, Institution $institution)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,46 +38,46 @@ class NewInstitutionConfigurationCreatedEvent implements SerializableInterface
/**
* @var InstitutionConfigurationId
*/
public $institutionConfigurationId;
public InstitutionConfigurationId $institutionConfigurationId;

/**
* @var Institution
*/
public $institution;
public Institution $institution;
/**
* @var UseRaLocationsOption
*/
public $useRaLocationsOption;
public UseRaLocationsOption $useRaLocationsOption;

/**
* @var ShowRaaContactInformationOption
*/
public $showRaaContactInformationOption;
public ShowRaaContactInformationOption $showRaaContactInformationOption;

/**
* @var VerifyEmailOption
*/
public $verifyEmailOption;
public VerifyEmailOption $verifyEmailOption;

/**
* @var NumberOfTokensPerIdentityOption
*/
public $numberOfTokensPerIdentityOption;
public NumberOfTokensPerIdentityOption $numberOfTokensPerIdentityOption;

/**
* @var SelfVetOption
*/
public $selfVetOption;
public SelfVetOption $selfVetOption;

/**
* @var SelfAssertedTokensOption
*/
public $selfAssertedTokensOption;
public SelfAssertedTokensOption $selfAssertedTokensOption;

/**
* @var SsoOn2faOption
*/
public $ssoOn2faOption;
public SsoOn2faOption $ssoOn2faOption;

public function __construct(
InstitutionConfigurationId $institutionConfigurationId,
Expand Down
12 changes: 6 additions & 6 deletions src/Surfnet/Stepup/Configuration/Event/RaLocationAddedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,31 @@ class RaLocationAddedEvent implements SerializableInterface
/**
* @var InstitutionConfigurationId
*/
public $institutionConfigurationId;
public InstitutionConfigurationId $institutionConfigurationId;

/**
* @var Institution
*/
public $institution;
public Institution $institution;

/**
* @var RaLocationId
*/
public $raLocationId;
public RaLocationId $raLocationId;

/**
* @var RaLocationName
*/
public $raLocationName;
public RaLocationName $raLocationName;

/**
* @var Location
*/
public $location;
public Location $location;
/**
* @var ContactInformation
*/
public $contactInformation;
public ContactInformation $contactInformation;

public function __construct(
InstitutionConfigurationId $institutionConfigurationId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ class RaLocationContactInformationChangedEvent implements SerializableInterface
/**
* @var InstitutionConfigurationId
*/
public $institutionConfigurationId;
public InstitutionConfigurationId $institutionConfigurationId;

/**
* @var RaLocationId
*/
public $raLocationId;
public RaLocationId $raLocationId;

/**
* @var ContactInformation
*/
public $contactInformation;
public ContactInformation $contactInformation;

public function __construct(
InstitutionConfigurationId $institutionConfigurationId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ class RaLocationRelocatedEvent implements SerializableInterface
/**
* @var InstitutionConfigurationId
*/
public $institutionConfigurationId;
public InstitutionConfigurationId $institutionConfigurationId;

/**
* @var RaLocationId
*/
public $raLocationId;
public RaLocationId $raLocationId;

/**
* @var Location
*/
public $location;
public Location $location;

public function __construct(
InstitutionConfigurationId $institutionConfigurationId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ class RaLocationRemovedEvent implements SerializableInterface
/**
* @var InstitutionConfigurationId
*/
public $institutionConfigurationId;
public InstitutionConfigurationId $institutionConfigurationId;

/**
* @var Institution
*/
public $institution;
public Institution $institution;

/**
* @var RaLocationId
*/
public $raLocationId;
public RaLocationId $raLocationId;

public function __construct(
InstitutionConfigurationId $institutionConfigurationId,
Expand Down
Loading

0 comments on commit 402a02a

Please sign in to comment.