Skip to content

refactor(types): add native parameter/return types to Data::get and APIv2Controller#2573

Open
miaulalala wants to merge 1 commit intomasterfrom
refactor/type-safety-data-get
Open

refactor(types): add native parameter/return types to Data::get and APIv2Controller#2573
miaulalala wants to merge 1 commit intomasterfrom
refactor/type-safety-data-get

Conversation

@miaulalala
Copy link
Copy Markdown
Collaborator

Summary

  • Data::get(): type the 5 previously untyped parameters (string $user, int $since, int $limit, string $sort, string $filter) and add array return type; same treatment for the private setOffsetFromSince() helper
  • APIv2Controller: replace eight /** @var type */ docblock properties with native typed properties, each with a sensible default matching what validateParameters() would set

Test plan

  • composer test:unit passes (328 tests)
  • Three test mocks that previously relied on null being assignable to untyped properties are updated to return a real string from getUID()

🤖 AI-Assisted-By: Claude Sonnet 4.6 noreply@anthropic.com

@cypress
Copy link
Copy Markdown

cypress Bot commented May 6, 2026

Activity    Run #3714

Run Properties:  status check passed Passed #3714  •  git commit 52b9138cf9: refactor(types): add native parameter/return types to Data::get and APIv2Control...
Project Activity
Branch Review refactor/type-safety-data-get
Run status status check passed Passed #3714
Run duration 01m 58s
Commit git commit 52b9138cf9: refactor(types): add native parameter/return types to Data::get and APIv2Control...
Committer Anna
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 1
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 9
View all changes introduced in this branch ↗︎

@miaulalala miaulalala requested review from ShGKme, artonge and blizzz May 6, 2026 22:52
@miaulalala miaulalala self-assigned this May 6, 2026
@miaulalala miaulalala added this to the Nextcloud 34 milestone May 6, 2026
@ShGKme
Copy link
Copy Markdown
Contributor

ShGKme commented May 6, 2026

Why replace some @var with type annotations in the controller, but not all of them?

…PIv2Controller

- Data::get(): type the 5 previously untyped parameters (string $user,
  int $since, int $limit, string $sort, string $filter) and add array
  return type; same for the related setOffsetFromSince() helper
- APIv2Controller: replace @var docblock properties with native typed
  properties, all with sensible defaults matching validateParameters()

Three test mocks that relied on null being assignable to untyped IUser::getUID()
are updated to return 'testuser' so the string property assignment passes.

Signed-off-by: Anna Larch <anna@nextcloud.com>
AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@miaulalala miaulalala force-pushed the refactor/type-safety-data-get branch from 065c38e to e1c042b Compare May 6, 2026 23:13
@miaulalala
Copy link
Copy Markdown
Collaborator Author

Why replace some @var with type annotations in the controller, but not all of them?

wdym?

@ShGKme
Copy link
Copy Markdown
Contributor

ShGKme commented May 7, 2026

wdym?

I meant, in APIv2Controller there are also methods with types only in @param docs comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants