From 9c92cc161755ecd37ce0edafd198f2eb9f9de0ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Tue, 19 May 2026 16:42:38 +0200 Subject: [PATCH] chore: Suppress last known impure static properties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We will keep these legacy ones for now. We can search for the ImpureStaticProperty suppression and add special treatement for them in the frankenphp PR if needed. Signed-off-by: Côme Chilliet --- apps/encryption/lib/Crypto/Encryption.php | 5 ++++- apps/files_sharing/lib/SharedStorage.php | 3 +++ apps/files_versions/lib/Storage.php | 10 +++++++-- lib/base.php | 18 ++++++++++++++++ lib/private/Files/Filesystem.php | 26 +++++++++++++++++++---- 5 files changed, 55 insertions(+), 7 deletions(-) diff --git a/apps/encryption/lib/Crypto/Encryption.php b/apps/encryption/lib/Crypto/Encryption.php index 1ae615822a5..5769b48a381 100644 --- a/apps/encryption/lib/Crypto/Encryption.php +++ b/apps/encryption/lib/Crypto/Encryption.php @@ -56,7 +56,10 @@ class Encryption implements IEncryptionModule { /** @var int Current version of the file */ private int $version = 0; - /** @var array remember encryption signature version */ + /** + * @var array remember encryption signature version + * @psalm-suppress ImpureStaticProperty + */ private static $rememberVersion = []; public function __construct( diff --git a/apps/files_sharing/lib/SharedStorage.php b/apps/files_sharing/lib/SharedStorage.php index 49a13995481..539b0d865bc 100644 --- a/apps/files_sharing/lib/SharedStorage.php +++ b/apps/files_sharing/lib/SharedStorage.php @@ -89,6 +89,9 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage private IAppConfig $appConfig; private IShareManager $shareManager; + /** + * @psalm-suppress ImpureStaticProperty + */ private static int $initDepth = 0; public function __construct(array $parameters) { diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index 01e152a577f..47f14d96b61 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -56,9 +56,15 @@ class Storage { public const DELETE_TRIGGER_QUOTA_EXCEEDED = 2; // files for which we can remove the versions after the delete operation was successful - private static $deletedFiles = []; + /** + * @psalm-suppress ImpureStaticProperty + */ + private static array $deletedFiles = []; - private static $sourcePathAndUser = []; + /** + * @psalm-suppress ImpureStaticProperty + */ + private static array $sourcePathAndUser = []; private const MAX_VERSIONS_PER_INTERVAL = [ //first 10sec, one version every 2sec diff --git a/lib/base.php b/lib/base.php index fc09cc64849..10f86c59bc5 100644 --- a/lib/base.php +++ b/lib/base.php @@ -47,38 +47,56 @@ class OC { /** * The installation path for Nextcloud on the server (e.g. /srv/http/nextcloud) * @internal Use auto-loaded $serverRoot with DI instead. + * @psalm-suppress ImpureStaticProperty */ public static string $SERVERROOT = ''; /** * the current request path relative to the Nextcloud root (e.g. files/index.php) + * @psalm-suppress ImpureStaticProperty */ private static string $SUBURI = ''; /** * the Nextcloud root path for http requests (e.g. /nextcloud) + * @psalm-suppress ImpureStaticProperty */ public static string $WEBROOT = ''; /** * The installation path array of the apps folder on the server (e.g. /srv/http/nextcloud) 'path' and * web path in 'url' + * @psalm-suppress ImpureStaticProperty */ public static array $APPSROOTS = []; + /** + * @psalm-suppress ImpureStaticProperty + */ public static string $configDir; /** * requested app + * @psalm-suppress ImpureStaticProperty */ public static string $REQUESTEDAPP = ''; /** * check if Nextcloud runs in cli mode + * @psalm-suppress ImpureStaticProperty */ public static bool $CLI = false; + /** + * @psalm-suppress ImpureStaticProperty + */ public static \Composer\Autoload\ClassLoader $composerAutoloader; + /** + * @psalm-suppress ImpureStaticProperty + */ public static \OC\Server $server; + /** + * @psalm-suppress ImpureStaticProperty + */ private static \OC\Config $config; /** diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php index 8dffd9bd1b3..5d8824c67e1 100644 --- a/lib/private/Files/Filesystem.php +++ b/lib/private/Files/Filesystem.php @@ -27,14 +27,36 @@ use OCP\Server; use Psr\Log\LoggerInterface; class Filesystem { + /** + * @psalm-suppress ImpureStaticProperty + */ private static ?Mount\Manager $mounts = null; + /** + * @psalm-suppress ImpureStaticProperty + */ public static bool $loaded = false; + /** + * @psalm-suppress ImpureStaticProperty + */ private static ?View $defaultInstance = null; + /** + * @psalm-suppress ImpureStaticProperty + */ private static ?FilenameValidator $validator = null; + /** + * @psalm-suppress ImpureStaticProperty + */ + private static ?StorageFactory $loader = null; + + /** + * @psalm-suppress ImpureStaticProperty + */ + private static bool $logWarningWhenAddingStorageWrapper = true; + /** * classname which used for hooks handling * used as signalclass in OC_Hooks::emit() @@ -152,10 +174,6 @@ class Filesystem { public const signal_param_mount_type = 'mounttype'; public const signal_param_users = 'users'; - private static ?StorageFactory $loader = null; - - private static bool $logWarningWhenAddingStorageWrapper = true; - /** * @param bool $shouldLog * @return bool previous value