[TOOLS] Continue raising PHPStan level to 6

This commit is contained in:
2022-10-19 22:39:17 +01:00
parent c31f3d4997
commit 2fd46ca886
89 changed files with 646 additions and 278 deletions

View File

@@ -49,9 +49,14 @@ use Symfony\Component\HttpFoundation\Request;
class AttachmentCollections extends Plugin
{
/** @phpstan-use MetaCollectionTrait<AttachmentCollection> */
use MetaCollectionTrait;
protected const SLUG = 'collection';
protected const PLURAL_SLUG = 'collections';
/**
* @param array<string, mixed> $vars
*/
protected function createCollection(Actor $owner, array $vars, string $name): void
{
$col = AttachmentCollection::create([
@@ -65,6 +70,12 @@ class AttachmentCollections extends Plugin
'attachment_collection_id' => $col->getId(),
]));
}
/**
* @param array<string, mixed> $vars
* @param int[] $items
* @param array<string, mixed> $collections
*/
protected function removeItem(Actor $owner, array $vars, array $items, array $collections): bool
{
return DB::dql(<<<'EOF'
@@ -83,6 +94,11 @@ class AttachmentCollections extends Plugin
]);
}
/**
* @param array<string, mixed> $vars
* @param int[] $items
* @param array<string, mixed> $collections
*/
protected function addItem(Actor $owner, array $vars, array $items, array $collections): void
{
foreach ($items as $id) {
@@ -97,14 +113,18 @@ class AttachmentCollections extends Plugin
}
}
protected function shouldAddToRightPanel(Actor $user, $vars, Request $request): bool
/**
* @param array<string, mixed> $vars
*/
protected function shouldAddToRightPanel(Actor $user, array $vars, Request $request): bool
{
return $vars['path'] === 'note_attachment_show';
}
/**
* @param array<string, mixed> $vars
* @return int[]
*
* @return ($ids_only is true ? int[] : AttachmentCollection[])
*/
protected function getCollectionsBy(Actor $owner, ?array $vars = null, bool $ids_only = false): array
{