Skip to content

Commit

Permalink
Add type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
Universal-Omega authored Nov 13, 2024
1 parent 195b30c commit c9b2c7b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions maintenance/checkSwiftContainers.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct() {
$this->requireExtension( 'CreateWiki' );
}

public function execute() {
public function execute(): void {
// Get the list of swift containers
$containers = $this->getSwiftContainers();
if ( !$containers ) {
Expand Down Expand Up @@ -92,7 +92,7 @@ public function execute() {
}
}

private function estimateSize( array $containers ) {
private function estimateSize( array $containers ): int {
global $wmgSwiftPassword;

$totalSize = 0;
Expand All @@ -115,7 +115,7 @@ private function estimateSize( array $containers ) {
return $totalSize;
}

private function getSwiftContainers() {
private function getSwiftContainers(): array {
global $wmgSwiftPassword;

$limits = [ 'memory' => 0, 'filesize' => 0, 'time' => 0, 'walltime' => 0 ];
Expand All @@ -128,10 +128,13 @@ private function getSwiftContainers() {
->disableSandbox()
->execute()->getStdout();

return array_filter( explode( "\n", $swiftOutput ), fn ( $line ) => (bool)$line );
return array_filter(
explode( "\n", $swiftOutput ),
fn ( string $line ): bool => (bool)$line
);
}

private function findUnmatchedContainers( array $containers ) {
private function findUnmatchedContainers( array $containers ): array {
$dbr = $this->getServiceContainer()->getConnectionProvider()->getReplicaDatabase(
$this->getConfig()->get( 'CreateWikiDatabase' )
);
Expand Down Expand Up @@ -186,7 +189,7 @@ private function findUnmatchedContainers( array $containers ) {
];
}

private function deleteContainers( array $containers ) {
private function deleteContainers( array $containers ): void {
global $wmgSwiftPassword;

$limits = [ 'memory' => 0, 'filesize' => 0, 'time' => 0, 'walltime' => 0 ];
Expand Down

0 comments on commit c9b2c7b

Please sign in to comment.