psalm: refactor suppressions

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/888/head
Varun Patil 2023-10-22 13:56:27 -07:00
parent c9e87c4cf6
commit 46366d6715
7 changed files with 15 additions and 13 deletions

View File

@ -57,13 +57,8 @@ class IndexOpts
class Index extends Command class Index extends Command
{ {
/** @psalm-suppress PropertyNotSetInConstructor */
private InputInterface $input; private InputInterface $input;
/** @psalm-suppress PropertyNotSetInConstructor */
private OutputInterface $output; private OutputInterface $output;
/** @psalm-suppress PropertyNotSetInConstructor */
private IndexOpts $opts; private IndexOpts $opts;
public function __construct( public function __construct(

View File

@ -44,10 +44,7 @@ class MigrateGoogleTakeout extends Command
protected const MIGRATOR_VERSION = 1; protected const MIGRATOR_VERSION = 1;
protected const MIGRATED_KEY = 'memoriesMigratorVersion'; protected const MIGRATED_KEY = 'memoriesMigratorVersion';
/** @psalm-suppress PropertyNotSetInConstructor */
protected OutputInterface $output; protected OutputInterface $output;
/** @psalm-suppress PropertyNotSetInConstructor */
protected InputInterface $input; protected InputInterface $input;
// Stats // Stats

View File

@ -31,7 +31,6 @@ use Symfony\Component\Console\Output\OutputInterface;
class PlacesSetup extends Command class PlacesSetup extends Command
{ {
/** @psalm-suppress PropertyNotSetInConstructor */
protected OutputInterface $output; protected OutputInterface $output;
public function __construct(protected Places $places) public function __construct(protected Places $places)

View File

@ -149,6 +149,7 @@ class AlbumsQuery
public function getIfAllowed(string $uid, string $albumId): ?array public function getIfAllowed(string $uid, string $albumId): ?array
{ {
$album = null; $album = null;
$albumUid = null;
// Split name and uid // Split name and uid
$parts = explode('/', $albumId); $parts = explode('/', $albumId);
@ -173,7 +174,6 @@ class AlbumsQuery
} }
// Check if user is owner // Check if user is owner
/** @psalm-suppress PossiblyUndefinedVariable */
if ($albumUid === $uid) { if ($albumUid === $uid) {
return $album; return $album;
} }

View File

@ -81,12 +81,13 @@ trait TimelineWriteOrphans
protected function getSomeOrphans(int $count, array $fields): array protected function getSomeOrphans(int $count, array $fields): array
{ {
$query = $this->connection->getQueryBuilder(); $query = $this->connection->getQueryBuilder();
$query->select(...$fields)
return $query->select(...$fields)
->from('memories') ->from('memories')
->where($query->expr()->eq('orphan', $query->expr()->literal(1))) ->where($query->expr()->eq('orphan', $query->expr()->literal(1)))
->setMaxResults($count) ->setMaxResults($count)
->executeQuery()
->fetchAll()
; ;
return $query->executeQuery()->fetchAll();
} }
} }

View File

@ -43,6 +43,11 @@
<file name="lib/Service/FileRobotMagick.php" /> <file name="lib/Service/FileRobotMagick.php" />
</errorLevel> </errorLevel>
</PossiblyUnusedMethod> </PossiblyUnusedMethod>
<PropertyNotSetInConstructor>
<errorLevel type="suppress">
<directory name="lib/Command" />
</errorLevel>
</PropertyNotSetInConstructor>
</issueHandlers> </issueHandlers>
<forbiddenFunctions> <forbiddenFunctions>
<function name="var_dump" /> <function name="var_dump" />

View File

@ -42,6 +42,11 @@
<file name="lib/Service/FileRobotMagick.php" /> <file name="lib/Service/FileRobotMagick.php" />
</errorLevel> </errorLevel>
</PossiblyUnusedMethod> </PossiblyUnusedMethod>
<PropertyNotSetInConstructor>
<errorLevel type="suppress">
<directory name="lib/Command" />
</errorLevel>
</PropertyNotSetInConstructor>
</issueHandlers> </issueHandlers>
<forbiddenFunctions> <forbiddenFunctions>
<function name="var_dump" /> <function name="var_dump" />