From e0eadb1f612e9123ee2d38c6634f9c2f4af30088 Mon Sep 17 00:00:00 2001 From: Jorrit Schippers Date: Tue, 29 Sep 2020 15:14:26 +0200 Subject: [PATCH] Prevent deprecation notice when AdminInterface.isCurrentChild is implemented --- src/Admin/AbstractAdmin.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Admin/AbstractAdmin.php b/src/Admin/AbstractAdmin.php index 96dae0bddf6..2a6819c6c06 100644 --- a/src/Admin/AbstractAdmin.php +++ b/src/Admin/AbstractAdmin.php @@ -2435,12 +2435,16 @@ public function isCurrentChild(): bool */ public function getCurrentChildAdmin() { - foreach ($this->children as $children) { + foreach ($this->children as $child) { // NEXT_MAJOR: Remove method_exists check and delete elseif case - if (method_exists($children, 'isCurrentChild') && $children->isCurrentChild()) { - return $children; - } elseif ($children->getCurrentChild()) { - return $children; + if (method_exists($child, 'isCurrentChild')) { + if ($child->isCurrentChild()) { + return $child; + } + } else { + if ($child->getCurrentChild()) { + return $child; + } } }