[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

@@ -56,9 +56,9 @@ trait MetaCollectionTrait
/**
* create a collection owned by Actor $owner.
*
* @param Actor $owner The collection's owner
* @param array<string, mixed> $vars Page vars sent by AppendRightPanelBlock event
* @param string $name Collection's name
* @param Actor $owner The collection's owner
* @param array<string, mixed> $vars Page vars sent by AppendRightPanelBlock event
* @param string $name Collection's name
*/
abstract protected function createCollection(Actor $owner, array $vars, string $name): void;
/**
@@ -82,6 +82,7 @@ trait MetaCollectionTrait
/**
* Check the route to determine whether the widget should be added
*
* @param array<string, mixed> $vars
*/
abstract protected function shouldAddToRightPanel(Actor $user, array $vars, Request $request): bool;
@@ -91,7 +92,8 @@ trait MetaCollectionTrait
* @param Actor $owner Collection's owner
* @param null|array<string, mixed> $vars Page vars sent by AppendRightPanelBlock event
* @param bool $ids_only if true, the function must return only the primary key or each collections
* @return T[]|int[]
*
* @return int[]|T[]
*/
abstract protected function getCollectionsBy(Actor $owner, ?array $vars = null, bool $ids_only = false): array;
@@ -101,7 +103,7 @@ trait MetaCollectionTrait
* the current item to, and another to create a new collection.
*
* @param array<string, mixed> $vars
* @param string[] $res
* @param string[] $res
*/
public function onAppendRightPanelBlock(Request $request, array $vars, array &$res): EventResult
{
@@ -146,7 +148,7 @@ trait MetaCollectionTrait
if ($add_form->isSubmitted() && $add_form->isValid()) {
$selected = $add_form->getData()['collections'];
$removed = array_filter($already_selected, fn ($x) => !\in_array($x, $selected));
$added = array_filter($selected, fn ($x) => !\in_array($x, $already_selected));
$added = array_filter($selected, fn ($x) => !\in_array($x, $already_selected));
if (\count($removed) > 0) {
$this->removeItem($user, $vars, $removed, $collections);
}
@@ -196,7 +198,7 @@ trait MetaCollectionTrait
}
/**
* @param string[]
* @param string[] $styles
*/
public function onEndShowStyles(array &$styles, string $route): EventResult
{