Skip to content

Commit

Permalink
add types for missing ones
Browse files Browse the repository at this point in the history
Signed-off-by: Simon L <szaimen@e.mail.de>
  • Loading branch information
szaimen committed Jan 2, 2023
1 parent eaabc8e commit ad0cf67
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 60 deletions.
43 changes: 0 additions & 43 deletions php/psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,46 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.4.0@62db5d4f6a7ae0a20f7cc5a4952d730272fc0863">
<file src="public/index.php">
<MissingClosureParamType occurrences="10">
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$request</code>
<code>$request</code>
<code>$request</code>
<code>$response</code>
<code>$response</code>
<code>$response</code>
</MissingClosureParamType>
</file>
<file src="src/Controller/ConfigurationController.php">
<MissingParamType occurrences="1">
<code>$args</code>
</MissingParamType>
</file>
<file src="src/Controller/DockerController.php">
<MissingParamType occurrences="8">
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
<code>$args</code>
</MissingParamType>
</file>
<file src="src/Controller/LoginController.php">
<MissingParamType occurrences="3">
<code>$args</code>
<code>$args</code>
<code>$args</code>
</MissingParamType>
</file>
<file src="src/Twig/ClassExtension.php">
<MissingParamType occurrences="1">
<code>$object</code>
</MissingParamType>
</file>
</files>
10 changes: 6 additions & 4 deletions php/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use Slim\Factory\AppFactory;
use Slim\Views\Twig;
use Slim\Views\TwigMiddleware;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\RequestInterface as Request;

require __DIR__ . '/../vendor/autoload.php';

Expand Down Expand Up @@ -65,7 +67,7 @@
$app->post('/api/configuration', \AIO\Controller\ConfigurationController::class . ':SetConfig');

// Views
$app->get('/containers', function ($request, $response, $args) use ($container) {
$app->get('/containers', function (Request $request, Response $response, mixed $args) use ($container) {
$view = Twig::fromRequest($request);
/** @var \AIO\Data\ConfigurationManager $configurationManager */
$configurationManager = $container->get(\AIO\Data\ConfigurationManager::class);
Expand Down Expand Up @@ -110,15 +112,15 @@
'additional_backup_directories' => $configurationManager->GetAdditionalBackupDirectoriesString(),
]);
})->setName('profile');
$app->get('/login', function ($request, $response, $args) use ($container) {
$app->get('/login', function (Request $request, Response $response, mixed $args) use ($container) {
$view = Twig::fromRequest($request);
/** @var \AIO\Docker\DockerActionManager $dockerActionManger */
$dockerActionManger = $container->get(\AIO\Docker\DockerActionManager::class);
return $view->render($response, 'login.twig', [
'is_login_allowed' => $dockerActionManger->isLoginAllowed(),
]);
});
$app->get('/setup', function ($request, $response, $args) use ($container) {
$app->get('/setup', function (Request $request, Response $response, mixed $args) use ($container) {
$view = Twig::fromRequest($request);
/** @var \AIO\Data\Setup $setup */
$setup = $container->get(\AIO\Data\Setup::class);
Expand All @@ -140,7 +142,7 @@
});

// Auth Redirector
$app->get('/', function (\Psr\Http\Message\RequestInterface $request, \Psr\Http\Message\ResponseInterface $response, $args) use ($container) {
$app->get('/', function (Request $request, Response $response, mixed $args) use ($container) {
$authManager = $container->get(\AIO\Auth\AuthManager::class);

/** @var \AIO\Data\Setup $setup */
Expand Down
2 changes: 1 addition & 1 deletion php/src/Controller/ConfigurationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct(
$this->configurationManager = $configurationManager;
}

public function SetConfig(Request $request, Response $response, $args) : Response {
public function SetConfig(Request $request, Response $response, mixed $args) : Response {
try {
if (isset($request->getParsedBody()['domain'])) {
$domain = $request->getParsedBody()['domain'] ?? '';
Expand Down
16 changes: 8 additions & 8 deletions php/src/Controller/DockerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private function PerformRecursiveContainerStart(string $id, bool $pullContainer
$this->dockerActionManager->ConnectContainerToNetwork($container);
}

public function GetLogs(Request $request, Response $response, $args) : Response
public function GetLogs(Request $request, Response $response, mixed $args) : Response
{
$id = $request->getQueryParams()['id'];
if (str_starts_with($id, 'nextcloud-aio-')) {
Expand All @@ -67,7 +67,7 @@ public function GetLogs(Request $request, Response $response, $args) : Response
->withHeader('Content-Disposition', 'inline');
}

public function StartBackupContainerBackup(Request $request, Response $response, $args) : Response {
public function StartBackupContainerBackup(Request $request, Response $response, mixed $args) : Response {
$this->startBackup();
return $response->withStatus(201)->withHeader('Location', '/');
}
Expand All @@ -84,7 +84,7 @@ public function startBackup() : void {
$this->PerformRecursiveContainerStart($id);
}

public function StartBackupContainerCheck(Request $request, Response $response, $args) : Response {
public function StartBackupContainerCheck(Request $request, Response $response, mixed $args) : Response {
$this->checkBackup();
return $response->withStatus(201)->withHeader('Location', '/');
}
Expand All @@ -98,7 +98,7 @@ public function checkBackup() : void {
$this->PerformRecursiveContainerStart($id);
}

public function StartBackupContainerRestore(Request $request, Response $response, $args) : Response {
public function StartBackupContainerRestore(Request $request, Response $response, mixed $args) : Response {
$config = $this->configurationManager->GetConfig();
$config['backup-mode'] = 'restore';
$config['selected-restore-time'] = $request->getParsedBody()['selected_restore_time'] ?? '';
Expand All @@ -113,7 +113,7 @@ public function StartBackupContainerRestore(Request $request, Response $response
return $response->withStatus(201)->withHeader('Location', '/');
}

public function StartBackupContainerTest(Request $request, Response $response, $args) : Response {
public function StartBackupContainerTest(Request $request, Response $response, mixed $args) : Response {
$config = $this->configurationManager->GetConfig();
$config['backup-mode'] = 'test';
$config['instance_restore_attempt'] = 0;
Expand All @@ -128,7 +128,7 @@ public function StartBackupContainerTest(Request $request, Response $response, $
return $response->withStatus(201)->withHeader('Location', '/');
}

public function StartContainer(Request $request, Response $response, $args) : Response
public function StartContainer(Request $request, Response $response, mixed $args) : Response
{
$uri = $request->getUri();
$host = $uri->getHost();
Expand Down Expand Up @@ -165,7 +165,7 @@ public function startTopContainer(bool $pullContainer) : void {
$this->PerformRecursiveContainerStart($id, $pullContainer);
}

public function StartWatchtowerContainer(Request $request, Response $response, $args) : Response {
public function StartWatchtowerContainer(Request $request, Response $response, mixed $args) : Response {
$this->startWatchtower();
return $response->withStatus(201)->withHeader('Location', '/');
}
Expand All @@ -188,7 +188,7 @@ private function PerformRecursiveContainerStop(string $id) : void
$this->dockerActionManager->StopContainer($container);
}

public function StopContainer(Request $request, Response $response, $args) : Response
public function StopContainer(Request $request, Response $response, mixed $args) : Response
{
$id = self::TOP_CONTAINER;
$this->PerformRecursiveContainerStop($id);
Expand Down
6 changes: 3 additions & 3 deletions php/src/Controller/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct(AuthManager $authManager, DockerActionManager $docke
$this->dockerActionManager = $dockerActionManager;
}

public function TryLogin(Request $request, Response $response, $args) : Response {
public function TryLogin(Request $request, Response $response, mixed $args) : Response {
if (!$this->dockerActionManager->isLoginAllowed()) {
return $response->withHeader('Location', '/')->withStatus(302);
}
Expand All @@ -32,7 +32,7 @@ public function TryLogin(Request $request, Response $response, $args) : Response
return $response->withHeader('Location', '/')->withStatus(302);
}

public function GetTryLogin(Request $request, Response $response, $args) : Response {
public function GetTryLogin(Request $request, Response $response, mixed $args) : Response {
$token = $request->getQueryParams()['token'] ?? '';
if($this->authManager->CheckToken($token)) {
$this->authManager->SetAuthState(true);
Expand All @@ -42,7 +42,7 @@ public function GetTryLogin(Request $request, Response $response, $args) : Respo
return $response->withHeader('Location', '/')->withStatus(302);
}

public function Logout(Request $request, Response $response, $args) : Response
public function Logout(Request $request, Response $response, mixed $args) : Response
{
$this->authManager->SetAuthState(false);
return $response
Expand Down
2 changes: 1 addition & 1 deletion php/src/Twig/ClassExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function getFunctions() : array
);
}

public function getClassName($object) : ?string
public function getClassName(mixed $object) : ?string
{
if (!is_object($object)) {
return null;
Expand Down

0 comments on commit ad0cf67

Please sign in to comment.