From bd85adf9a4580c99fad8309abb960185f0deec34 Mon Sep 17 00:00:00 2001 From: Jordi Date: Mon, 10 Aug 2020 19:25:22 +0200 Subject: [PATCH] first round of review --- src/Admin/AbstractAdmin.php | 2 ++ src/Admin/AdminInterface.php | 3 +++ src/Datagrid/DatagridMapper.php | 4 ++-- src/Mapper/BaseMapper.php | 7 ++++++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Admin/AbstractAdmin.php b/src/Admin/AbstractAdmin.php index 9a8fd654c8c..5772399e3a7 100644 --- a/src/Admin/AbstractAdmin.php +++ b/src/Admin/AbstractAdmin.php @@ -1749,6 +1749,8 @@ public function isCurrentChild(): bool /** * Returns the current child admin instance. + * + * @return AdminInterface|null the current child admin instance */ public function getCurrentChildAdmin(): ?AdminInterface { diff --git a/src/Admin/AdminInterface.php b/src/Admin/AdminInterface.php index 98c568e6fcd..db61a3f3176 100644 --- a/src/Admin/AdminInterface.php +++ b/src/Admin/AdminInterface.php @@ -135,6 +135,9 @@ public function getSecurityInformation(): array; public function setParentFieldDescription(FieldDescriptionInterface $parentFieldDescription): void; + /** + * @throws \LogicException + */ public function getParentFieldDescription(): FieldDescriptionInterface; /** diff --git a/src/Datagrid/DatagridMapper.php b/src/Datagrid/DatagridMapper.php index aa7fba84022..f7497e64661 100644 --- a/src/Datagrid/DatagridMapper.php +++ b/src/Datagrid/DatagridMapper.php @@ -118,7 +118,7 @@ final public function keys(): array return array_keys($this->datagrid->getFilters()); } - public function remove(string $key): BaseMapper + public function remove(string $key): self { $this->admin->removeFilterFieldDescription($key); $this->datagrid->removeFilter($key); @@ -126,7 +126,7 @@ public function remove(string $key): BaseMapper return $this; } - public function reorder(array $keys): BaseMapper + public function reorder(array $keys): self { $this->datagrid->reorderFilters($keys); diff --git a/src/Mapper/BaseMapper.php b/src/Mapper/BaseMapper.php index 88f1b5303e2..5ce7676ec74 100644 --- a/src/Mapper/BaseMapper.php +++ b/src/Mapper/BaseMapper.php @@ -51,7 +51,10 @@ abstract public function get(string $key); abstract public function has(string $key): bool; - abstract public function remove(string $key): self; + /** + * @return static + */ + abstract public function remove(string $key); /** * Returns configured keys. @@ -62,6 +65,8 @@ abstract public function keys(): array; /** * @param string[] $keys field names + * + * @return static */ abstract public function reorder(array $keys): self; }