Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor lib/private #39249

Conversation

shdehnavi
Copy link
Contributor

@shdehnavi shdehnavi commented Jul 9, 2023

Summary

The required adjustments have been made to the following classes under /lib/private namespace:

  • PreviewManager.php
  • Repair.php
  • RedisFactory.php
  • Search.php
  • Server.php
  • ServerContainer.php

The improvements:

  • Using PHP8's constructor property promotion
  • Adding return types
  • Adding types to properties
  • Updating doc blocks
  • Converting if (isset(...)) to null coalescing operator

Checklist

lib/private/Server.php Fixed Show fixed Hide fixed
@solracsf solracsf added 3. to review Waiting for reviews technical debt labels Jul 9, 2023
@solracsf solracsf added this to the Nextcloud 28 milestone Jul 9, 2023
@shdehnavi shdehnavi requested review from come-nc and skjnldsv July 14, 2023 12:08
@fsamapoor
Copy link
Member

Could you please resolve the conflicts?

@shdehnavi shdehnavi force-pushed the refactor_lib_private_root_classes_part_3 branch from 083a390 to f837b57 Compare August 16, 2023 06:30
@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
This was referenced Mar 12, 2024
This was referenced Mar 20, 2024
@skjnldsv skjnldsv mentioned this pull request Mar 28, 2024
81 tasks
@skjnldsv skjnldsv modified the milestones: Nextcloud 29, Nextcloud 30 Mar 28, 2024
@skjnldsv skjnldsv force-pushed the refactor_lib_private_root_classes_part_3 branch from be88bf5 to c3ca53f Compare May 2, 2024 15:36
@skjnldsv skjnldsv requested review from a team and removed request for a team May 2, 2024 15:39
@skjnldsv skjnldsv force-pushed the refactor_lib_private_root_classes_part_3 branch from c3ca53f to 876fbbe Compare May 2, 2024 15:39
@skjnldsv skjnldsv force-pushed the refactor_lib_private_root_classes_part_3 branch from 876fbbe to 98ef21f Compare May 2, 2024 15:41
*/
protected function getEnabledDefaultProvider() {
protected function getEnabledDefaultProvider(): ?array {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
protected function getEnabledDefaultProvider(): ?array {
protected function getEnabledDefaultProvider(): array {

I do not see where it returns null?
Docblock @return should be reverted to array as well or removed.

private SystemConfig $config;

private IEventLogger $eventLogger;
private \Redis|\RedisCluster $instance;
Copy link
Contributor

Choose a reason for hiding this comment

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

This cannot work because the property is not instanciated in constructor.
Most likely should be changed to:

Suggested change
private \Redis|\RedisCluster $instance;
private \Redis|\RedisCluster|null $instance;

And then the class should be adapted so that psalm is happy. The create method is used for creating the object.
The instanceof test in getInstance looks wrong as it does not test cluster.

@@ -1446,23 +1445,23 @@ public function boot() {
* @return \OCP\Calendar\IManager
* @deprecated 20.0.0
*/
public function getCalendarManager() {
public function getCalendarManager(): \OCP\Calendar\IManager {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure it makes sense to strong type these obsolete methods.

Copy link
Member

Choose a reason for hiding this comment

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

deprecated since 20 means we can even remove it when not actively used in shipped apps or server :P

return $this->get(CsrfTokenManager::class);
}

/**
* @return IThrottler
* @deprecated 20.0.0
*/
public function getBruteForceThrottler() {
public function getBruteForceThrottler(): Throttler {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public function getBruteForceThrottler(): Throttler {
public function getBruteForceThrottler(): IThrottler {

@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
@skjnldsv skjnldsv closed this Aug 3, 2024
@skjnldsv skjnldsv removed this from the Nextcloud 30 milestone Aug 14, 2024
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.

7 participants