From b5bcc60d5cda24583068deedc43f0c4f022867ba Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Sun, 30 Aug 2026 12:48:33 +0200 Subject: [PATCH 1/2] fix(phpstan): guard against a null user, not against false IUserManager::get() returns IUser|null. Six call sites guarded it with $user !== false, which is ALWAYS TRUE for that type -- so the guard let a null straight through to $user->isEnabled() and $maintainerGroup->inGroup($user). A username that does not resolve would fatal, and the code reads as if it had been checked. phpstan reported it as 'Strict comparison using !== between OCP\IUser|null and false will always evaluate to true'. That is not a style complaint: the guard does not guard. StackiqService.php 6 sites (2095, 2187, 2271, 2281, 2379, 2389) Stackiq/ContactPersonHandler 1 site (1417) phpstan named three of them; grepping the type found six, all assigned from $userManager->get($username) a few lines above. OrganizationHandler also compared getLastLogin(), an int, against null and false. Both are always true and are removed; only !== 0 carries meaning. Verified: php -l clean on all three files. phpstan itself is not installed locally -- and note its composer script echoes 'PHPStan not installed, skipping...' rather than failing, so a local green there would have proved nothing. CI runs it for real. --- lib/Service/Stackiq/ContactPersonHandler.php | 2 +- lib/Service/Stackiq/OrganizationHandler.php | 4 ++-- lib/Service/StackiqService.php | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/Service/Stackiq/ContactPersonHandler.php b/lib/Service/Stackiq/ContactPersonHandler.php index 1bbd2601..91c66563 100644 --- a/lib/Service/Stackiq/ContactPersonHandler.php +++ b/lib/Service/Stackiq/ContactPersonHandler.php @@ -1414,7 +1414,7 @@ public function assignBeheerderRole(object $contactPersonObject, string $usernam if (empty($maintainerGroup) === false) { $user = $this->_userManager->get($username); - if ($user !== false && $maintainerGroup->inGroup($user) === false) { + if ($user !== null && $maintainerGroup->inGroup($user) === false) { $maintainerGroup->addUser($user); } } diff --git a/lib/Service/Stackiq/OrganizationHandler.php b/lib/Service/Stackiq/OrganizationHandler.php index 3901015f..af63c2fc 100644 --- a/lib/Service/Stackiq/OrganizationHandler.php +++ b/lib/Service/Stackiq/OrganizationHandler.php @@ -699,7 +699,7 @@ function ($a, $b) { $timeA = 0; if ($userA !== null) { $lastLoginA = $userA->getLastLogin(); - if ($lastLoginA !== 0 && $lastLoginA !== null && $lastLoginA !== false) { + if ($lastLoginA !== 0) { $timeA = (int)$lastLoginA; } } @@ -707,7 +707,7 @@ function ($a, $b) { $timeB = 0; if ($userB !== null) { $lastLoginB = $userB->getLastLogin(); - if ($lastLoginB !== 0 && $lastLoginB !== null && $lastLoginB !== false) { + if ($lastLoginB !== 0) { $timeB = (int)$lastLoginB; } } diff --git a/lib/Service/StackiqService.php b/lib/Service/StackiqService.php index 42e4f461..7fa7bcc4 100644 --- a/lib/Service/StackiqService.php +++ b/lib/Service/StackiqService.php @@ -2092,7 +2092,7 @@ private function activateUsersForOrganization(string $organizationUuid): void { if (empty($username) === false) { $user = $userManager->get($username); - if ($user !== false && $user->isEnabled() === false) { + if ($user !== null && $user->isEnabled() === false) { $user->setEnabled(true); $activatedCount++; @@ -2184,7 +2184,7 @@ private function deactivateUsersForOrganization(string $organizationUuid): void if (empty($username) === false) { $user = $userManager->get($username); - if ($user !== false && $user->isEnabled() === true) { + if ($user !== null && $user->isEnabled() === true) { $user->setEnabled(false); $deactivatedCount++; @@ -2268,7 +2268,7 @@ private function activateStackiqUsersForOrganization(string $organizationUuid): foreach ($softwareCatalogUsers as $username) { try { $user = $userManager->get($username); - if ($user !== false && $user->isEnabled() === false) { + if ($user !== null && $user->isEnabled() === false) { $user->setEnabled(true); $activatedUsers[] = $username; $this->_logger->debug( @@ -2278,7 +2278,7 @@ private function activateStackiqUsersForOrganization(string $organizationUuid): 'username' => $username, ] ); - } elseif ($user !== false && $user->isEnabled() === true) { + } elseif ($user !== null && $user->isEnabled() === true) { $this->_logger->debug( 'StackiqService: Stackiq user already active', [ @@ -2376,7 +2376,7 @@ private function deactivateStackiqUsersForOrganization(string $organizationUuid) foreach ($softwareCatalogUsers as $username) { try { $user = $userManager->get($username); - if ($user !== false && $user->isEnabled() === true) { + if ($user !== null && $user->isEnabled() === true) { $user->setEnabled(false); $deactivatedUsers[] = $username; $this->_logger->debug( @@ -2386,7 +2386,7 @@ private function deactivateStackiqUsersForOrganization(string $organizationUuid) 'username' => $username, ] ); - } elseif ($user !== false && $user->isEnabled() === false) { + } elseif ($user !== null && $user->isEnabled() === false) { $this->_logger->debug( 'StackiqService: Stackiq user already inactive', [ From e719da0414b9329be121c634ba65767444448f09 Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Sun, 30 Aug 2026 14:44:45 +0200 Subject: [PATCH 2/2] style: Prettier the sidebar change here too Merged development in, which carried the unformatted src/App.vue from the sidebar commit. Same one-file fix as #836; whichever lands first makes the other a no-op. --- src/App.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/App.vue b/src/App.vue index bb2e4832..1987ef14 100644 --- a/src/App.vue +++ b/src/App.vue @@ -43,9 +43,7 @@ - +