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

Define getSystemValueBool/Int/String function default parameter with correct type #20717

Merged
merged 1 commit into from
Apr 30, 2020

Conversation

MichaIng
Copy link
Member

I guess it does only have minor effect, but at least for consistency the param type should match the actual type defined in the functions.

@MichaIng MichaIng added the 3. to review Waiting for reviews label Apr 29, 2020
@MichaIng
Copy link
Member Author

Do we want to backport this? Just checked and it can be applied at least until back to NC16. On the other hand it does not fix any issues.

@rullzer rullzer added this to the Nextcloud 19 milestone Apr 30, 2020
@rullzer rullzer merged commit 4472777 into master Apr 30, 2020
@rullzer rullzer deleted the fix/getconfig-param-definitions branch April 30, 2020 07:03
@rullzer
Copy link
Member

rullzer commented Apr 30, 2020

Do we want to backport this? Just checked and it can be applied at least until back to NC16. On the other hand it does not fix any issues.

I usually like to keep backports at minimum. Esp in this case the typing already is correct.

@rullzer rullzer mentioned this pull request Apr 30, 2020
11 tasks
@MichaIng
Copy link
Member Author

Just for completeness, the new types now also match the public IConfig interface defined here:

/**
* Looks up a boolean system wide defined value
*
* @param string $key the key of the value, under which it was saved
* @param bool $default the default value to be returned if the value isn't set
* @return bool the value or $default
* @since 16.0.0
*/
public function getSystemValueBool(string $key, bool $default = false): bool;
/**
* Looks up an integer system wide defined value
*
* @param string $key the key of the value, under which it was saved
* @param int $default the default value to be returned if the value isn't set
* @return int the value or $default
* @since 16.0.0
*/
public function getSystemValueInt(string $key, int $default = 0): int;
/**
* Looks up a string system wide defined value
*
* @param string $key the key of the value, under which it was saved
* @param string $default the default value to be returned if the value isn't set
* @return string the value or $default
* @since 16.0.0
*/
public function getSystemValueString(string $key, string $default = ''): string;

@rullzer

Esp in this case the typing already is correct.

What you mean with "correct"? However, I agree to skip the backports in this case.

@kesselb
Copy link
Contributor

kesselb commented Apr 30, 2020

What you mean with "correct"?

public function getSystemValueBool(string $key, bool $default = false): bool;

: bool means the method will always return a boolean value. The @return annotation is redundant for methods with a return type.

bool $default = false the default parameter must be an boolean too. @param bool $default is also optional.

@MichaIng
Copy link
Member Author

MichaIng commented May 1, 2020

@kesselb

bool $default = false the default parameter must be an boolean too. @param bool $default is also optional.

Ah okay yes that was what I was assuming since the "wrong" annotation obviously does/did not cause any issue. So indeed this is of a visual-only kind that popped up to me when looking into the code for another reason 😉. Hence no real reason to backport.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants