From b9871ab6572fdd79ec63f31d15af35ccd3071e0d Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Sun, 10 Dec 2023 02:02:33 -0500 Subject: [PATCH] CI: Fix psalm UndefinedVariable errors --- .../Controller/Admin/IndexBlocksController.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/CoreBundle/Controller/Admin/IndexBlocksController.php b/src/CoreBundle/Controller/Admin/IndexBlocksController.php index d05738a14c..a1e2ea19bc 100644 --- a/src/CoreBundle/Controller/Admin/IndexBlocksController.php +++ b/src/CoreBundle/Controller/Admin/IndexBlocksController.php @@ -19,11 +19,16 @@ class IndexBlocksController extends BaseController { private bool $isAdmin = false; private bool $isSessionAdmin = false; + private $extAuthSource = []; public function __construct( private readonly TranslatorInterface $translator, private readonly SettingsManager $settingsManager ) { + $this->extAuthSource = [ + 'extldap' => [], + 'ldap' => [], + ]; } public function __invoke(): JsonResponse @@ -133,7 +138,7 @@ class IndexBlocksController extends BaseController 'label' => $this->translator->trans('Anonymise users list'), ]; - if (isset($extAuthSource, $extAuthSource['extldap']) && \count($extAuthSource['extldap']) > 0) { + if (\count($this->extAuthSource['extldap']) > 0) { $items[] = [ 'class' => 'item-user-ldap-list', 'url' => $this->generateUrl('legacy_main', ['name' => 'admin/ldap_users_list.php']), @@ -279,7 +284,7 @@ class IndexBlocksController extends BaseController ]; } - if (isset($extAuthSource, $extAuthSource['ldap']) && \count($extAuthSource['ldap']) > 0) { + if (\count($this->extAuthSource['ldap']) > 0) { $items[] = [ 'class' => 'item-course-subscription-ldap', 'url' => $this->generateUrl('legacy_main', ['name' => 'admin/ldap_import_students.php']), @@ -483,7 +488,7 @@ class IndexBlocksController extends BaseController 'url' => $this->generateUrl('legacy_main', ['name' => 'session/session_import_drh.php']), 'label' => $this->translator->trans('Import list of HR directors into sessions'), ]; - if (isset($extAuthSource, $extAuthSource['ldap']) && \count($extAuthSource['ldap']) > 0) { + if (\count($this->extAuthSource['ldap']) > 0) { $items[] = [ 'class' => 'item-session-subscription-ldap-import', 'url' => $this->generateUrl('legacy_main', ['name' => 'admin/ldap_import_students_to_session.php']),