This repository was archived by the owner on May 29, 2026. It is now read-only.
Clear PHPStan noise + align phpunit config + walkthrough screenshots#41
Merged
rubenvdlinde merged 1 commit intoApr 30, 2026
Conversation
…creenshots PHPStan ------- - Add autoload-dev mapping for nextcloud/ocp's OCP\* and NCU\* namespaces. The package ships PHP stubs but declares no autoload section, so PHPStan could not resolve any Nextcloud type and reported every OCP\IUser / IL10N / IURLGenerator etc. call as "unknown class" - 722 errors total. Registering the namespace in our autoload-dev makes the stubs reachable. - Tighten phpstan.neon scanDirectories to point at the OCP/ and NCU/ subdirectories (not the package root) and add focused ignoreErrors for Doctrine\DBAL\Schema\Table calls (provided by Nextcloud's 3rdparty bundle, not our app's vendor) and the JSONResponse strict-status union / Entity::jsonSerialize stub gaps. - Result: 722 -> 0 errors. PHPStan is now meaningful CI signal. Real type fixes surfaced once OCP became visible ------------------------------------------------ - AdminSettingMapper::setSetting(): pass formatted ISO string to setUpdatedAt() instead of a DateTime instance (the entity stores the timestamp as ?string). - DashboardResolver, DashboardService, TemplateService: use 1 instead of true for setIsActive(int), and 0 instead of false for the getIsCompulsory()/getIsVisible() comparisons. Same coercion semantics at runtime, but PHPStan can verify the types. - AdminTemplateService::createTemplate(): cast bool $isDefault to int before passing to the SMALLINT column setter. - DashboardResolver::getEffectivePermissionLevel(): drop the unreachable null-fallback branch (Dashboard::permissionLevel is non-nullable with PERMISSION_FULL default) and the unused settingMapper / AdminSetting imports that only existed to feed it. - ConditionalService / PermissionService: switch getIsVisible()/getIsCompulsory() === false to === 0 (the Entity stores these as int flags, not booleans). phpunit-unit.xml rename ----------------------- - git mv phpunit.xml -> phpunit-unit.xml to match the convention used across other Conduction apps. Composer scripts (test:unit, test:all, test:coverage, test) updated to pass --configuration explicitly so PHPUnit no longer needs to auto-discover. Screenshots ----------- - Add docs/screenshots/admin-settings.png, customize-panel-widgets.png, customize-panel-dashboards.png, template-create-modal.png to document the main customize / admin / template flows. Captured at 1440x1100. Tests: 106 / 106 passing, 293 assertions. PHPCS / PHPMD / Psalm / PHPStan: all clean.
rubenvdlinde
merged commit Apr 30, 2026
2f76611
into
chore/polish-and-walkthrough-2026-04-29
1 check passed
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Three quality / docs items left over after PR #39's walkthrough that were out of scope at the time but worth having before more code lands.
PHPStan: 722 → 0
PR #39 documented 719 unknown OCP* errors as an environmental issue. The actual cause:
nextcloud/ocpships PHP stubs but declares no autoload section, so neither composer nor PHPStan could resolve any Nextcloud type. EveryIUser,IL10N,IURLGenerator,IConfigcall was reported as a missing class.composer.jsongains anautoload-devblock mappingOCP\\→vendor/nextcloud/ocp/OCP/andNCU\\→vendor/nextcloud/ocp/NCU/. Nowcomposer dump-autoloadregisters the stubs and PHPStan resolves them.phpstan.neon:scanDirectoriesnarrowed to the actual subdirectories.ignoreErrorsadds focused entries forDoctrine\DBAL\Schema\Table(provided by Nextcloud's3rdpartybundle, not our app'svendor/— exercised at runtime), theJSONResponsestrict-status union (caller widens viaHttp::STATUS_*defaults at the public boundary), andEntity::jsonSerialize()(concrete subclasses implementJsonSerializable; the stub doesn't).Real type bugs PHPStan caught once it could see Nextcloud
AdminSettingMapper::setSetting()passed aDateTimeinstance tosetUpdatedAt(?string). Now passes(new DateTime())->format('c')like the rest of the codebase.setIsActive(true)inDashboardResolver,DashboardService,TemplateService→setIsActive(1)(int column).setIsDefault($isDefault)(bool) inAdminTemplateService→setIsDefault((int) $isDefault)(SMALLINT column).getIsVisible() === false/getIsCompulsory() === false(int columns) →=== 0inConditionalServiceandPermissionService.DashboardResolver::getEffectivePermissionLevel()— removed the unreachable null-fallback branch (Dashboard::permissionLevelis non-nullable withPERMISSION_FULLdefault) plus the now-unusedsettingMapper/AdminSettingimports that only existed for it.Same coercion semantics at runtime — PHPStan can now verify them.
phpunit-unit.xml rename
git mv phpunit.xml -> phpunit-unit.xmlto align with the convention other Conduction apps use. Composer scripts (test:unit,test:all,test:coverage,test) now pass--configuration phpunit-unit.xmlexplicitly so PHPUnit no longer relies on auto-discovery.Screenshots
Captured at 1440×1100 for
docs/screenshots/:admin-settings.png— full admin page with default settings + empty templates sectioncustomize-panel-widgets.png— Widgets tab of the customize sidebarcustomize-panel-dashboards.png— Dashboards tab with three test dashboards (My Dashboard, Walkthrough, Screenshot Demo active)template-create-modal.png— admin template creation modal with all fields visibleThe seeded-tiles screenshot lives on PR #40 (
feat/seed-tiles-on-new-dashboard) since that's the branch that introduces the seeding behaviour.Test plan
composer phpcs— cleancomposer phpmd— cleancomposer psalm— 0 errorscomposer phpstan— 0 errors (down from 722)phpunit --configuration phpunit-unit.xml— 106/106 passing, 293 assertionsNotes
chore/polish-and-walkthrough-2026-04-29(PR Repair conditional rules + admin templates + permission defaults #39). When Repair conditional rules + admin templates + permission defaults #39 merges to development, this PR retargets cleanly.