Skip to content

refactor(files_versions): add conservative typing and improve Storage phpdoc#59537

Draft
joshtrichards wants to merge 9 commits into
masterfrom
jtr/refactor-versions-Storage-typing
Draft

refactor(files_versions): add conservative typing and improve Storage phpdoc#59537
joshtrichards wants to merge 9 commits into
masterfrom
jtr/refactor-versions-Storage-typing

Conversation

@joshtrichards

@joshtrichards joshtrichards commented Apr 9, 2026

Copy link
Copy Markdown
Member
  • Resolves: #

Summary

Adds conservative type declarations and improves phpdoc in apps/files_versions/lib/Storage.php.

Storage is a legacy static utility class with several mixed-return methods and loosely documented array shapes. This makes the API clearer for readers and static analysis while preserving existing behavior.

What changed

  • added parameter types where inputs are already used consistently
  • added return types within the confines of legacy return contracts
  • improved phpdoc for shaped arrays and nullable/mixed returns

Notes

No functional changes.
Preserves legacy mixed-return behavior in store(), renameOrCopy(), and expire() to ensure compatibility, but this should make future refactoring easier.

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: Josh <josh.t.richards@gmail.com>
…eter typing

Signed-off-by: Josh <josh.t.richards@gmail.com>
To Storage::getUidAndFilename()

Signed-off-by: Josh <josh.t.richards@gmail.com>
…ge functions

Signed-off-by: Josh <josh.t.richards@gmail.com>
…hapes in Storage

Update/improve docblocks for key functions

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards requested a review from a team as a code owner April 9, 2026 13:26
@joshtrichards joshtrichards requested review from ArtificialOwl, icewind1991, leftybournes and salmart-dev and removed request for a team April 9, 2026 13:26
@joshtrichards joshtrichards added 3. to review Waiting for reviews feature: versions ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) labels Apr 9, 2026
@joshtrichards joshtrichards added this to the Nextcloud 34 milestone Apr 9, 2026
@joshtrichards joshtrichards requested a review from artonge April 9, 2026 13:28
@joshtrichards joshtrichards added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Apr 9, 2026
@joshtrichards joshtrichards marked this pull request as draft April 9, 2026 15:06
@@ -216,25 +229,25 @@ public static function store($filename) {
$versionManager->createVersion($user, $file);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$versionManager->createVersion($user, $file);
$versionManager->createVersion($user, $file);
return true;

Comment on lines +167 to +169
* @return false|null False if no version was created; null on successful creation
*/
public static function store($filename) {
public static function store(string $filename): false|null {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @return false|null False if no version was created; null on successful creation
*/
public static function store($filename) {
public static function store(string $filename): false|null {
* @return bool Whether a version was created
*/
public static function store(string $filename): bool {

@susnux susnux added the community pull requests from community label Jun 9, 2026
@susnux susnux modified the milestones: Nextcloud 34.0.1, Nextcloud 35 Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress community pull requests from community feature: versions ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants