chore(psalm): reduce baseline noise — suppress + stubs + redundant casts (#122)#133
Merged
Conversation
… casts) (#122) Part 1 of the Psalm baseline burn-down (#122): clear the trivial/artifact findings so the baseline reflects only real type issues (131 -> 34). - Suppress MissingOverrideAttribute project-wide (33): the #[\Override] attribute is PHP 8.3+, but the app supports PHP 8.1+ (info.xml). - Resolve the OCP-resolution artifacts (36): - tests/psalm/missing-class-stubs.php defines the two unshipped OC internals (OC\Hooks\Emitter, OC\User\NoUserException) that nextcloud/ocp's OCP\Files\IRootFolder references, so the real OCP type files load and Psalm gets their actual API instead of UndefinedClass. - Targeted <referencedClass> suppressions for genuinely-external classes not in nextcloud/ocp and not cleanly stubbable (Doctrine\DBAL\Schema\Table, \OC, OC\Security\CSRF\CsrfTokenManager, the Files/Files_Sharing/Viewer events, and OCP\Image whose concrete internal base needs 25 IImage methods). - Remove 31 RedundantCasts (casts on parse_url()/preg_match() results Psalm already types) across 11 services — behaviour-neutral. PHPUnit 409 + Psalm green (baseline now 34 real type issues, tackled in the follow-up); full Playwright 23/23 on NC 33. Part of #122.
This was referenced Jun 9, 2026
Jaggob
added a commit
that referenced
this pull request
Jun 9, 2026
Bump version to 1.1.0-alpha.3 across appinfo/info.xml, package.json, and package-lock.json (consistency guard green); regenerate js/ license sidecars with the new version (bundles unchanged). Add the alpha.3 CHANGELOG section summarising the security hardening (#105, #102, #110), the Playwright e2e suite (#54), the Psalm burndown + findUnusedCode (#82, #122, #133, #134), and the supporting refactors/tooling.
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 1 of the Psalm baseline burn-down (#122). Clears the trivial / OCP-resolution-artifact findings so the baseline reflects only real type issues — from 131 → 34.
Changes
#[\Override]is PHP 8.3+, but the app supports PHP 8.1+ (info.xml), so requiring it isn't appropriate.tests/psalm/missing-class-stubs.phpdefines the two unshippedOC\internals (OC\Hooks\Emitter,OC\User\NoUserException) thatnextcloud/ocp'sOCP\Files\IRootFolderreferences. With those present the real OCP type files load, so Psalm gets the actual API (notUndefinedClass).<referencedClass>suppressions for genuinely-external classes that aren't innextcloud/ocpand can't be cleanly stubbed:Doctrine\DBAL\Schema\Table,\OC,OC\Security\CSRF\CsrfTokenManager, the Files/Files_Sharing/Viewer events, andOCP\Image(its concrete internal base would need all 25IImagemethods).parse_url()/preg_match()results Psalm already types). Behaviour-neutral — careful not to touch the non-redundant(string)/(int)coercions onmixed(e.g.AdminSettingsValidator::normalizeHostUrl).Verification
Follow-up (part 2)
The remaining 34 baseline entries are the real type issues (
TypeDoesNotContainType,InvalidReturnStatement/Type,MismatchingDocblockParamType,MissingTemplateParam, …) — fixed in a separate PR, along with enablingfindUnusedCode.Part of #122.