Skip to content

Conversation

@fsamapoor
Copy link
Member

Summary

I have made some adjustments to the apps/files_trashbin/lib/Command classes to improve the code readability.

The improvements in this PR include but are not limited to:

  • Using PHP8's constructor property promotion
  • Adding return types
  • Replacing return code integers with more readable strings.
  • Using early returns

Checklist

$query->delete('files_trash')
->where($query->expr()->eq('user', $query->createParameter('uid')))
->setParameter('uid', $uid);
$query->execute();

Check notice

Code scanning / Psalm

DeprecatedMethod

The method OCP\DB\QueryBuilder\IQueryBuilder::execute has been marked as deprecated
$userObject = $this->userManager->get($user);
$this->expireTrashForUser($userObject);
} else {
if (! $this->userManager->userExists($user)) {

Check notice

Code scanning / Psalm

PossiblyNullReference

Cannot call method userExists on possibly null value

$output->writeln("Remove deleted files of <info>$user</info>");
$userObject = $this->userManager->get($user);
$this->expireTrashForUser($userObject);

Check notice

Code scanning / Psalm

PossiblyNullArgument

Argument 1 of OCA\Files_Trashbin\Command\ExpireTrash::expireTrashForUser cannot be null, possibly null value provided

$p = new ProgressBar($output);
$p->start();
$this->userManager->callForSeenUsers(function (IUser $user) use ($p) {

Check notice

Code scanning / Psalm

PossiblyNullReference

Cannot call method callForSeenUsers on possibly null value
@fsamapoor fsamapoor added 3. to review Waiting for reviews technical debt labels Aug 15, 2023
@fsamapoor fsamapoor added this to the Nextcloud 28 milestone Aug 15, 2023
@fsamapoor fsamapoor requested review from a team, blizzz, icewind1991 and nfebe and removed request for a team August 15, 2023 18:31
@fsamapoor fsamapoor force-pushed the refactor_files_trashbin_app_commands branch from 42794ad to 35b0f7a Compare September 21, 2023 05:55
@fsamapoor
Copy link
Member Author

Conflicts resolved!

@blizzz blizzz removed their request for review September 21, 2023 08:12
@skjnldsv skjnldsv mentioned this pull request Nov 1, 2023
This was referenced Nov 6, 2023
This was referenced Nov 14, 2023
@blizzz blizzz modified the milestones: Nextcloud 28, Nextcloud 29 Nov 23, 2023
@fsamapoor fsamapoor force-pushed the refactor_files_trashbin_app_commands branch from 35b0f7a to e5e9aed Compare January 3, 2024 07:30
@AndyScherzinger AndyScherzinger force-pushed the refactor_files_trashbin_app_commands branch from e5e9aed to e085779 Compare February 27, 2024 13:29
}

return 0;
$this->config->setAppValue('files_trashbin', 'trashbin_size', (string)$parsedSize);

Check notice

Code scanning / Psalm

DeprecatedMethod

The method OCP\IConfig::setAppValue has been marked as deprecated
Faraz Samapoor added 2 commits March 8, 2024 19:19
To improve code readability.

Signed-off-by: Faraz Samapoor <[email protected]>
To improve code readability.

Signed-off-by: Faraz Samapoor <[email protected]>
@fsamapoor fsamapoor force-pushed the refactor_files_trashbin_app_commands branch from e085779 to 754b425 Compare March 8, 2024 15:49
This was referenced Mar 12, 2024
This was referenced Mar 20, 2024
@skjnldsv skjnldsv mentioned this pull request Mar 28, 2024
81 tasks
This was referenced Apr 4, 2024
@blizzz blizzz modified the milestones: Nextcloud 29, Nextcloud 30 Apr 8, 2024
@skjnldsv skjnldsv added 2. developing Work in progress stale Ticket or PR with no recent activity and removed 3. to review Waiting for reviews labels Jul 27, 2024
This was referenced Jul 30, 2024
This was referenced Aug 5, 2024
@skjnldsv skjnldsv mentioned this pull request Aug 13, 2024
@skjnldsv skjnldsv removed this from the Nextcloud 30 milestone Aug 14, 2024
@skjnldsv skjnldsv added this to the Nextcloud 32 milestone Jan 30, 2025
@fsamapoor fsamapoor closed this Aug 2, 2025
@skjnldsv skjnldsv modified the milestones: Nextcloud 32, Nextcloud 33 Sep 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress stale Ticket or PR with no recent activity technical debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants