Skip to content

Conversation

@rullzer
Copy link
Member

@rullzer rullzer commented Jan 16, 2018

  • Made strict
  • Type hints
  • Return types

Signed-off-by: Roeland Jago Douma roeland@famdouma.nl

* Made strict
* Type hints
* Return types

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
public function discover(string $remote, string $service): array {
// Check the cache first
$cacheData = $this->cache->get($remote . '#' . $service);
if($cacheData) {
Copy link
Member

Choose a reason for hiding this comment

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

Regarding the next line, maybe we should add a check here since json_decode might be null which will then cause a type error.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds sane I'll add it

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@codecov
Copy link

codecov bot commented Jan 16, 2018

Codecov Report

Merging #7899 into master will increase coverage by 44.49%.
The diff coverage is 77.77%.

@@              Coverage Diff              @@
##             master    #7899       +/-   ##
=============================================
+ Coverage      6.63%   51.12%   +44.49%     
- Complexity    24930    24992       +62     
=============================================
  Files          1604     1604               
  Lines         94988    95165      +177     
  Branches       1376     1376               
=============================================
+ Hits           6302    48657    +42355     
+ Misses        88686    46508    -42178
Impacted Files Coverage Δ Complexity Δ
lib/private/OCS/DiscoveryService.php 85.71% <77.77%> (+85.71%) 12 <11> (+1) ⬆️
lib/public/Security/StringUtils.php 0% <0%> (ø) 1% <0%> (ø) ⬇️
settings/users.php 0% <0%> (ø) 0% <0%> (ø) ⬇️
lib/private/Files/Storage/DAV.php 65.4% <0%> (+0.21%) 163% <0%> (ø) ⬇️
apps/admin_audit/lib/AppInfo/Application.php 1.73% <0%> (+1.73%) 13% <0%> (ø) ⬇️
apps/dav/lib/CardDAV/PhotoCache.php 1.75% <0%> (+1.75%) 39% <0%> (ø) ⬇️
lib/base.php 3.09% <0%> (+3.09%) 167% <0%> (ø) ⬇️
lib/private/Files/Storage/FailedStorage.php 3.4% <0%> (+3.4%) 44% <0%> (ø) ⬇️
apps/user_ldap/lib/Jobs/UpdateGroups.php 3.41% <0%> (+3.41%) 21% <0%> (ø) ⬇️
lib/private/Files/Cache/FailedCache.php 3.44% <0%> (+3.44%) 26% <0%> (ø) ⬇️
... and 862 more

@MorrisJobke
Copy link
Member

ref (#7392)

json_decode can return false if we have invalid data.
In that case just assume there was nothing cached

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
@MorrisJobke MorrisJobke added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Jan 17, 2018
@MorrisJobke
Copy link
Member

@rullzer rullzer merged commit 6e95bd7 into master Jan 17, 2018
@rullzer rullzer deleted the strict_discservice branch January 17, 2018 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish enhancement technical debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants