Skip to content

Commit

Permalink
Rector updates and typed properties
Browse files Browse the repository at this point in the history
  • Loading branch information
parijke committed Jan 17, 2024
1 parent 728380a commit 2baf13e
Show file tree
Hide file tree
Showing 67 changed files with 288 additions and 480 deletions.
1 change: 1 addition & 0 deletions ci/qa/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
colors="true"
bootstrap="../../tests/bootstrap.php"
beStrictAboutTestsThatDoNotTestAnything="true"
stopOnFailure="true"
failOnRisky="true">

<coverage>
Expand Down
2 changes: 1 addition & 1 deletion config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@

$_SERVER += $_ENV;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] ??= $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] ||
filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function __construct(
/**
* @return ServiceStatusDto
*/
public function getDto()
public function getDto(): \Surfnet\ServiceProviderDashboard\Application\Dto\ServiceStatusDto
{
return $this->serviceStatusDto;
}
Expand Down Expand Up @@ -177,10 +177,9 @@ private function getStates(Service $service, ServiceStatusService $serviceStatus
}

/**
* @param array $states
* @return array
*/
private function mapStates($states): array
private function mapStates(array $states): array
{
$result = [];
foreach ($states as $name => $value) {
Expand Down Expand Up @@ -222,7 +221,7 @@ private function getLabels(): array
/**
* @return mixed[]
*/
private function getTooltips($mappedStates): array
private function getTooltips(array $mappedStates): array
{
$tooltips = [];
foreach ($mappedStates as $state => $status) {
Expand All @@ -231,7 +230,7 @@ private function getTooltips($mappedStates): array
return $tooltips;
}

private function getPercentage($mappedStates): float
private function getPercentage(array $mappedStates): float
{
$total = 0;
$done = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
class DeleteCommandFactory
{
public function from(EntityDto $entity)
public function from(EntityDto $entity): \Surfnet\ServiceProviderDashboard\Application\Command\Entity\DeletePublishedTestEntityCommand|\Surfnet\ServiceProviderDashboard\Application\Command\Entity\DeletePublishedProductionEntityCommand|\Surfnet\ServiceProviderDashboard\Application\Command\Entity\RequestDeletePublishedEntityCommand
{
$isPublishedToTest = $entity->getEnvironment() === 'test' && $entity->getState() === 'published';
$isPublishedProduction = $entity->getEnvironment() === 'production' && $entity->getState() === 'requested';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class EntityChangeRequestCommand implements PublishProductionCommandInterface, Command
{
public function __construct(
#[Assert\Type(\Surfnet\ServiceProviderDashboard\Domain\Entity\ManageEntity::class)]
#[Assert\Type(ManageEntity::class)]
private readonly ManageEntity $manageEntity,
private readonly Contact $applicant
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,12 @@ public function __construct(
) {
}

/**
* @return SaveSamlEntityCommand
*/
public function getSaveEntityCommand(): \Surfnet\ServiceProviderDashboard\Application\Command\Entity\SaveSamlEntityCommand
public function getSaveEntityCommand(): SaveSamlEntityCommand
{
return $this->saveEntityCommand;
}

public function getDashboardId()
public function getDashboardId(): string
{
return $this->saveEntityCommand->getId();
}
Expand All @@ -61,7 +58,7 @@ public function getPastedMetadata()
return $this->requestData['metadata']['pastedMetadata'];
}

public function setNameIdFormat($nameIdFormat): void
public function setNameIdFormat(?string $nameIdFormat): void
{
$this->saveEntityCommand->setNameIdFormat($nameIdFormat);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class PublishEntityTestCommand implements Command
{
public function __construct(
#[Assert\Type(\Surfnet\ServiceProviderDashboard\Domain\Entity\ManageEntity::class)]
#[Assert\Type(ManageEntity::class)]
private readonly ManageEntity $manageEntity
) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

namespace Surfnet\ServiceProviderDashboard\Application\Command\Entity;

use Surfnet\ServiceProviderDashboard\Application\Command\Command;
use Surfnet\ServiceProviderDashboard\Domain\Entity\Contact;
use Surfnet\ServiceProviderDashboard\Domain\Entity\ManageEntity;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public function getService(): Service
/**
* @return bool
*/
public function isCopy()
public function isCopy(): ?bool
{
return $this->isCopy;
}
Expand All @@ -230,15 +230,12 @@ public function setIsCopy(bool $isCopy): void
/**
* @return bool
*/
public function isArchived()
public function isArchived(): bool
{
return $this->archived;
}

/**
* @param bool $archived
*/
public function setArchived($archived): void
public function setArchived(bool $archived): void
{
$this->archived = $archived;
}
Expand Down Expand Up @@ -527,23 +524,23 @@ public function setAccessTokenValidity(int $accessTokenValidity): void
/**
* @return OidcGrantType
*/
public function getGrants()
public function getGrants(): array
{
return $this->grants;
}

/**
* @param OidcGrantType $grants
*/
public function setGrants($grants): void
public function setGrants(array $grants): void
{
$this->grants = $grants;
}

/**
* @return string
*/
public function getSubjectType()
public function getSubjectType(): string
{
return $this->subjectType;
}
Expand All @@ -564,15 +561,15 @@ public function setSubjectType($subjectType): void
/**
* @return string[]
*/
public function getOidcngResourceServers()
public function getOidcngResourceServers(): array
{
return $this->resourceServers;
}

/**
* @param string[] $resourceServers
*/
public function setOidcngResourceServers($resourceServers): void
public function setOidcngResourceServers(array $resourceServers): void
{
$this->resourceServers = $resourceServers;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public function getService(): Service
/**
* @return bool
*/
public function isCopy()
public function isCopy(): ?bool
{
return $this->isCopy;
}
Expand All @@ -281,15 +281,12 @@ public function setIsCopy(bool $isCopy): void
/**
* @return bool
*/
public function isArchived()
public function isArchived(): bool
{
return $this->archived;
}

/**
* @param bool $archived
*/
public function setArchived($archived): void
public function setArchived(bool $archived): void
{
$this->archived = $archived;
}
Expand Down Expand Up @@ -335,7 +332,7 @@ public function setEntityId($entityId): void
/**
* @return string
*/
public function getClientId()
public function getClientId(): ?string
{
return $this->entityId;
}
Expand All @@ -359,7 +356,7 @@ public function setSecret($secret): void
/**
* @return string[]
*/
public function getRedirectUrls()
public function getRedirectUrls(): ?array
{
return $this->redirectUrls;
}
Expand Down Expand Up @@ -591,7 +588,7 @@ public function setIsPublicClient($isPublicClient): void
/**
* @return int
*/
public function getAccessTokenValidity()
public function getAccessTokenValidity(): int
{
return $this->accessTokenValidity;
}
Expand Down Expand Up @@ -623,23 +620,23 @@ public function setEnablePlayground($enablePlayground): void
/**
* @return OidcGrantType
*/
public function getGrants()
public function getGrants(): array
{
return $this->grants;
}

/**
* @param OidcGrantType $grants
*/
public function setGrants($grants): void
public function setGrants(array $grants): void
{
$this->grants = $grants;
}

/**
* @return string
*/
public function getSubjectType()
public function getSubjectType(): string
{
return $this->subjectType;
}
Expand All @@ -660,15 +657,15 @@ public function setSubjectType($subjectType): void
/**
* @return string[]
*/
public function getOidcngResourceServers()
public function getOidcngResourceServers(): array
{
return $this->resourceServers;
}

/**
* @param string[] $resourceServers
*/
public function setOidcngResourceServers($resourceServers): void
public function setOidcngResourceServers(array $resourceServers): void
{
$this->resourceServers = $resourceServers;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function getService(): Service
/**
* @return bool
*/
public function isCopy()
public function isCopy(): ?bool
{
return $this->isCopy;
}
Expand All @@ -179,15 +179,12 @@ public function setIsCopy(bool $isCopy): void
/**
* @return bool
*/
public function isArchived()
public function isArchived(): bool
{
return $this->archived;
}

/**
* @param bool $archived
*/
public function setArchived($archived): void
public function setArchived(bool $archived): void
{
$this->archived = $archived;
}
Expand Down Expand Up @@ -233,7 +230,7 @@ public function setEntityId($entityId): void
/**
* @return string
*/
public function getClientId()
public function getClientId(): ?string
{
return $this->entityId;
}
Expand Down Expand Up @@ -417,7 +414,7 @@ public function getProtocol(): string
/**
* @return array
*/
public function getScopes()
public function getScopes(): array
{
return $this->scopes;
}
Expand Down
Loading

0 comments on commit 2baf13e

Please sign in to comment.