Files
nextcloud-server-mirror/psalm.xml
skjnldsv ae4c1065d0 feat(viewer): keep the legacy viewer API in apps/viewer until 39
Dropping the bundled app takes the OCA.Viewer global and the LoadViewer
event with it, and apps in the wild still use both: text and
recommendations ask the global what it can open, photos opens and closes
it, files_pdfviewer re-opens the current file with another handler, and
photos, maps and collectives construct the event without checking that
it exists, so their pages would fail on the missing class.

The global goes back on the page, backed by the package rather than by
the app. open() takes the paths and the loose file info apps passed
before and turns them into nodes, the getters answer from what the last
open() was given, and mimetypes answers by asking the handlers about a
file of that type. registerHandler is deliberately not here: it was
deprecated in the viewer app in August 2025 and this is where it stops.
The event stays as an empty class nobody dispatches.

Both live in apps/viewer, which is not an app: it has no appinfo, the
server autoloads the event from it and the core viewer init script
imports the bridge. The checkers that take every folder in apps/ for an
app are told so: .noopenapi, the untranslated list, and a skip in the
autoloader checker and in tests/enable_all.php for folders without an
appinfo/info.xml. psalm lints it like the others.

Every use of the global logs a warning naming the replacement and
Nextcloud 39, where the folder and those exceptions go.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
2026-10-01 15:21:14 +02:00

261 lines
10 KiB
XML

<?xml version="1.0"?>
<!--
- SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<psalm
errorLevel="4"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config https://getpsalm.org/schema/config"
errorBaseline="build/psalm-baseline.xml"
findUnusedBaselineEntry="true"
findUnusedCode="false"
findUnusedIssueHandlerSuppression="false"
strictBinaryOperands="false"
phpVersion="8.3"
>
<plugins>
<plugin filename="build/psalm/AppFrameworkTainter.php" />
<plugin filename="build/psalm/AttributeNamedParameters.php" />
<plugin filename="build/psalm/LogicalOperatorChecker.php" />
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
<plugin filename="build/psalm/StaticVarsChecker.php" />
<plugin filename="build/psalm/UnstrictComparisonChecker.php" />
<plugin filename="build/psalm/InArrayStrictChecker.php" />
</plugins>
<projectFiles>
<directory name="apps/admin_audit"/>
<directory name="apps/appstore"/>
<directory name="apps/cloud_federation_api"/>
<directory name="apps/comments"/>
<directory name="apps/contactsinteraction"/>
<directory name="apps/dashboard"/>
<directory name="apps/dav"/>
<directory name="apps/encryption"/>
<directory name="apps/federatedfilesharing"/>
<directory name="apps/federation"/>
<directory name="apps/files"/>
<directory name="apps/files_external"/>
<directory name="apps/files_reminders"/>
<directory name="apps/files_sharing"/>
<directory name="apps/files_trashbin"/>
<directory name="apps/files_versions"/>
<directory name="apps/lookup_server_connector"/>
<directory name="apps/oauth2"/>
<directory name="apps/profile"/>
<directory name="apps/provisioning_api"/>
<directory name="apps/settings"/>
<directory name="apps/sharebymail"/>
<directory name="apps/sharing"/>
<directory name="apps/systemtags"/>
<directory name="apps/testing"/>
<directory name="apps/theming"/>
<directory name="apps/twofactor_backupcodes"/>
<directory name="apps/updatenotification"/>
<directory name="apps/user_ldap"/>
<directory name="apps/user_status"/>
<directory name="apps/viewer"/>
<directory name="apps/weather_status"/>
<directory name="apps/webhook_listeners"/>
<directory name="apps/workflowengine"/>
<directory name="core"/>
<directory name="lib"/>
<directory name="ocs"/>
<directory name="tests/lib/Comments"/>
<directory name="ocs-provider"/>
<file name="cron.php"/>
<file name="index.php"/>
<file name="public.php"/>
<file name="remote.php"/>
<file name="status.php"/>
<file name="version.php"/>
<file name="tests/lib/TestCase.php"/>
<file name="tests/lib/Files/Template/*.php"/>
<file name="tests/lib/Util/User/Dummy.php"/>
<file name="tests/lib/User/SessionTest.php"/>
<ignoreFiles>
<directory name="apps/admin_audit/tests"/>
<directory name="apps/contactsinteraction/tests"/>
<directory name="apps/dashboard/tests"/>
<directory name="apps/dav/tests"/>
<directory name="apps/encryption/tests"/>
<directory name="apps/federatedfilesharing/tests"/>
<directory name="apps/federation/tests"/>
<directory name="apps/files/tests"/>
<directory name="apps/files_external/tests"/>
<directory name="apps/files_sharing/tests"/>
<directory name="apps/files_trashbin/tests"/>
<directory name="apps/files_versions/tests"/>
<directory name="apps/oauth2/tests"/>
<directory name="apps/profile/tests"/>
<directory name="apps/provisioning_api/tests"/>
<directory name="apps/settings/tests"/>
<directory name="apps/sharebymail/tests"/>
<directory name="apps/systemtags/tests"/>
<directory name="apps/theming/tests"/>
<directory name="apps/twofactor_backupcodes/tests"/>
<directory name="apps/updatenotification/tests"/>
<directory name="apps/user_ldap/tests"/>
<directory name="apps/user_status/tests"/>
<directory name="apps/viewer/tests"/>
<directory name="apps/webhook_listeners/tests"/>
<directory name="apps/workflowengine/tests"/>
<directory name="apps/**/composer"/>
<directory name="lib/composer"/>
<directory name="lib/l10n"/>
<directory name="3rdparty"/>
<directory name="vendor-bin"/>
</ignoreFiles>
</projectFiles>
<extraFiles>
<directory name="3rdparty"/>
<directory name="vendor-bin/phpunit/vendor/phpunit"/>
<directory name="tests/lib/Sharing"/>
</extraFiles>
<stubs>
<file name="build/stubs/apcu.php"/>
<file name="build/stubs/excimer.php"/>
<file name="build/stubs/gd.php"/>
<file name="build/stubs/imagick.php"/>
<file name="build/stubs/intl.php"/>
<file name="build/stubs/IntlChar.php"/>
<file name="build/stubs/SensitiveParameter.phpstub"/>
<file name="build/stubs/ldap.php"/>
<file name="build/stubs/memcached.php"/>
<file name="build/stubs/openssl.php"/>
<file name="build/stubs/redis.php"/>
<file name="build/stubs/redis_cluster.php"/>
<file name="build/stubs/sftp.php"/>
<file name="build/stubs/sodium.php"/>
<file name="build/stubs/ssh2.php"/>
<file name="build/stubs/xsl.php"/>
<file name="build/stubs/ftp.php"/>
<file name="build/stubs/pcntl.php"/>
<file name="build/stubs/zip.php"/>
<file name="build/stubs/psr_container.php"/>
<file name="3rdparty/sabre/uri/lib/functions.php" />
<file name="build/stubs/app_api.php" />
<file name="build/stubs/php-polyfill.php" />
<file name="build/stubs/oca_talk_share_helper_shareapicontroller.php" />
</stubs>
<forbiddenFunctions>
<function name="iconv"/>
</forbiddenFunctions>
<issueHandlers>
<LessSpecificReturnStatement errorLevel="error"/>
<LessSpecificReturnType errorLevel="error"/>
<LessSpecificImplementedReturnType errorLevel="error"/>
<MoreSpecificReturnType errorLevel="error"/>
<UndefinedClass>
<errorLevel type="suppress">
<referencedClass name="OCA\Circles\CirclesManager"/>
<referencedClass name="OCA\Circles\Exceptions\CircleNotFoundException"/>
<referencedClass name="OCA\Circles\Model\Circle"/>
<referencedClass name="OCA\Circles\Model\Member"/>
<referencedClass name="OCA\Circles\Model\Probes\CircleProbe"/>
<referencedClass name="OCA\ContextChat\Public\ContentManager"/>
<referencedClass name="OCA\GroupFolders\Mount\GroupFolderStorage"/>
<referencedClass name="OCA\TwoFactorNextcloudNotification\Controller\APIController"/>
<referencedClass name="OCA\GlobalSiteSelector\Service\SlaveService"/>
<referencedClass name="OCA\Guests\UserBackend"/>
<referencedClass name="OCA\GroupFolders\Mount\GroupMountPoint"/>
</errorLevel>
</UndefinedClass>
<UndefinedFunction>
<errorLevel type="suppress">
<!-- template functions: https://github.com/nextcloud/server/blob/6e8e34fef920a073118c22111f0f31eb3b3a91dc/lib/private/legacy/template/functions.php -->
<referencedFunction name="p"/>
<referencedFunction name="emit_css_tag"/>
<referencedFunction name="emit_css_loading_tags"/>
<referencedFunction name="emit_script_tag"/>
<referencedFunction name="emit_script_loading_tags"/>
<referencedFunction name="print_unescaped"/>
<referencedFunction name="script"/>
<referencedFunction name="vendor_script"/>
<referencedFunction name="style"/>
<referencedFunction name="vendor_style"/>
<referencedFunction name="translation"/>
<referencedFunction name="component"/>
<referencedFunction name="link_to"/>
<referencedFunction name="link_to_docs"/>
<referencedFunction name="image_path"/>
<referencedFunction name="mimetype_icon"/>
<referencedFunction name="preview_icon"/>
<referencedFunction name="publicPreview_icon"/>
<referencedFunction name="human_file_size"/>
<referencedFunction name="strip_time"/>
<referencedFunction name="relative_modified_date"/>
<referencedFunction name="html_select_options"/>
</errorLevel>
</UndefinedFunction>
<UndefinedGlobalVariable>
<errorLevel type="suppress">
<referencedVariable name="$_"/>
<referencedVariable name="$l"/>
<referencedVariable name="$theme"/>
<!-- false positive: https://github.com/nextcloud/server/blob/cb057829f72c70e819f456edfadbb29d72dba832/lib/private/Console/Application.php#L92 -->
<file name="core/register_command.php" />
</errorLevel>
</UndefinedGlobalVariable>
<UndefinedDocblockClass>
<errorLevel type="suppress">
<!-- Helper classes for sharing API integration from other apps -->
<referencedClass name="OCA\Deck\Sharing\ShareAPIHelper" />
<referencedClass name="OCA\Talk\Share\Helper\DeletedShareAPIController" />
<referencedClass name="OCA\GlobalSiteSelector\Service\SlaveService"/>
</errorLevel>
</UndefinedDocblockClass>
<AmbiguousConstantInheritance>
<errorLevel type="suppress">
<!-- false positive: https://github.com/vimeo/psalm/issues/7818 -->
<referencedConstant name="OC\Memcache\Redis::DEFAULT_TTL" />
<referencedConstant name="OC\Memcache\LoggerWrapperCache::DEFAULT_TTL" />
</errorLevel>
</AmbiguousConstantInheritance>
<DeprecatedClass>
<errorLevel type="suppress">
<directory name="lib" />
<directory name="tests" />
<directory name="apps/*/tests" />
</errorLevel>
</DeprecatedClass>
<DeprecatedConstant>
<errorLevel type="suppress">
<directory name="lib" />
<directory name="apps/*/tests" />
</errorLevel>
</DeprecatedConstant>
<DeprecatedInterface>
<errorLevel type="suppress">
<directory name="lib" />
<directory name="apps/*/tests" />
</errorLevel>
</DeprecatedInterface>
<DeprecatedMethod>
<errorLevel type="suppress">
<directory name="lib" />
<directory name="apps/*/tests" />
</errorLevel>
</DeprecatedMethod>
<DeprecatedProperty>
<errorLevel type="suppress">
<directory name="lib" />
<directory name="apps/*/tests" />
</errorLevel>
</DeprecatedProperty>
<DeprecatedTrait>
<errorLevel type="suppress">
<directory name="lib" />
<directory name="apps/*/tests" />
</errorLevel>
</DeprecatedTrait>
<PluginIssue name="ImpureStaticProperty">
<errorLevel type="suppress">
<directory name="lib/private/legacy" />
</errorLevel>
</PluginIssue>
</issueHandlers>
</psalm>