Skip to content

Commit

Permalink
Fix array shapes with groups
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu committed Dec 6, 2020
1 parent ad8a050 commit 4987c52
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
30 changes: 27 additions & 3 deletions src/Admin/Pool.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,23 @@ class Pool

/**
* @var array
* @phpstan-var array<string, array{
* label: string,
* label_catalogue: string,
* icon: string,
* item_adds: array,
* items: array<array-key, array{
* admin?: string,
* label?: string,
* roles: list<string>,
* route?: string,
* router_absolute: bool,
* route_params: array<string, string>
* }>,
* keep_open: bool,
* on_top: bool,
* roles: list<string>
* }>
*/
protected $adminGroups = [];

Expand Down Expand Up @@ -136,9 +153,6 @@ public function __construct(
$this->propertyAccessor = $propertyAccessor;
}

/**
* @return array<string, array<string, AdminInterface>>
*/
public function getGroups()
{
$groups = $this->adminGroups;
Expand Down Expand Up @@ -166,6 +180,16 @@ public function hasGroup($group)

/**
* @return array
* @phpstan-return array<string, array{
* label: string,
* label_catalogue: string,
* icon: string,
* item_adds: array,
* items: array<array-key, AdminInterface>,
* keep_open: bool,
* on_top: bool,
* roles: list<string>
* }>
*/
public function getDashboardGroups()
{
Expand Down
13 changes: 8 additions & 5 deletions src/Twig/Extension/GroupExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,16 @@ public function getFunctions(): array
}

/**
* @phpstan-return array{array{
* roles: list<string>,
* icon: string,
* @phpstan-return array<array{
* label: string,
* label_catalogue: string,
* items: AdminInterface[]
* }}
* icon: string,
* item_adds: array,
* items: AdminInterface[],
* keep_open: bool,
* on_top: bool,
* roles: list<string>
* }>
*/
public function getDashboardGroupsWithCreatableAdmins(): array
{
Expand Down

0 comments on commit 4987c52

Please sign in to comment.