-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Clean up PHPDoc params and return values #40046
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,7 +157,7 @@ public function getPrincipalsByPrefix($prefixPath): array { | |
* | ||
* @param string $prefixPath | ||
* | ||
* @return array | ||
* @return array|null | ||
Check failure Code scanning / Psalm ImplementedReturnTypeMismatch
The inherited return type 'array<array-key, mixed>' for Sabre\DAVACL\PrincipalBackend\BackendInterface::getPrincipalByPath is different to the implemented return type for OCA\DAV\CalDAV\ResourceBooking\AbstractPrincipalBackend::getprincipalbypath 'array<array-key, mixed>|null'
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs a PR in SabreDAV to fix the PHPDoc there as well. |
||
*/ | ||
public function getPrincipalByPath($path) { | ||
if (strpos($path, $this->principalPrefix) !== 0) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -543,7 +543,7 @@ public function getCards($addressbookId) { | |
* | ||
* @param mixed $addressBookId | ||
* @param string $cardUri | ||
* @return array | ||
* @return array|false | ||
Check failure Code scanning / Psalm ImplementedReturnTypeMismatch
The inherited return type 'array<array-key, mixed>' for Sabre\CardDAV\Backend\BackendInterface::getCard is different to the implemented return type for OCA\DAV\CardDAV\CardDavBackend::getcard 'array<array-key, mixed>|false'
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs a PR in SabreDAV to fix the PHPDoc there as well. |
||
*/ | ||
public function getCard($addressBookId, $cardUri) { | ||
$query = $this->db->getQueryBuilder(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,7 +183,7 @@ public function getSupportedReportSet($uri) { | |
public function onReport($reportName, $report, $uri) { | ||
$reportTargetNode = $this->server->tree->getNodeForPath($uri); | ||
if (!$reportTargetNode instanceof Directory || $reportName !== self::REPORT_NAME) { | ||
return; | ||
return false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks wrong. onReport is an event handler for sabre/event. false = cancel the event handler. return without argument is null and will not cancel the event handler: https://3v4l.org/Eifl3 I don't know if we want to cancel the event handler here or not. |
||
} | ||
|
||
$ns = '{' . $this::NS_OWNCLOUD . '}'; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,7 +159,7 @@ public function getPrincipalsByPrefix($prefixPath) { | |
* getPrincipalsByPrefix. | ||
* | ||
* @param string $path | ||
* @return array | ||
* @return array|null | ||
Check failure Code scanning / Psalm ImplementedReturnTypeMismatch
The inherited return type 'array<array-key, mixed>' for Sabre\DAVACL\PrincipalBackend\BackendInterface::getPrincipalByPath is different to the implemented return type for OCA\DAV\Connector\Sabre\Principal::getprincipalbypath 'array<array-key, mixed>|null'
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs a PR in SabreDAV to fix the PHPDoc there as well. |
||
*/ | ||
public function getPrincipalByPath($path) { | ||
[$prefix, $name] = \Sabre\Uri\split($path); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,7 +101,7 @@ public function getPrincipalsByPrefix($prefixPath) { | |
* getPrincipalsByPrefix. | ||
* | ||
* @param string $path | ||
* @return array | ||
* @return array|null | ||
Check failure Code scanning / Psalm ImplementedReturnTypeMismatch
The inherited return type 'array<array-key, mixed>' for Sabre\DAVACL\PrincipalBackend\BackendInterface::getPrincipalByPath is different to the implemented return type for OCA\DAV\DAV\GroupPrincipalBackend::getprincipalbypath 'array<array-key, mixed>|null'
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs a PR in SabreDAV to fix the PHPDoc there as well. |
||
*/ | ||
public function getPrincipalByPath($path) { | ||
$elements = explode('/', $path, 3); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,7 +65,7 @@ public function getPrincipalsByPrefix($prefixPath) { | |
* getPrincipalsByPrefix. | ||
* | ||
* @param string $path | ||
* @return array | ||
* @return array|null | ||
Check failure Code scanning / Psalm ImplementedReturnTypeMismatch
The inherited return type 'array<array-key, mixed>' for Sabre\DAVACL\PrincipalBackend\BackendInterface::getPrincipalByPath is different to the implemented return type for OCA\DAV\DAV\SystemPrincipalBackend::getprincipalbypath 'array<array-key, mixed>|null'
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs a PR in SabreDAV to fix the PHPDoc there as well. |
||
*/ | ||
public function getPrincipalByPath($path) { | ||
if ($path === 'principals/system/system') { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,7 +187,7 @@ public function get($allowUnstable = false) { | |
|
||
// Refresh the file content | ||
try { | ||
$responseJson = $this->fetch($ETag, $content, $allowUnstable); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh. Please don't change it. I think the signature for fetch is actually wrong, but we should not touch it in this pr. |
||
$responseJson = $this->fetch($ETag, $content); | ||
|
||
if (empty($responseJson)) { | ||
return []; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -321,7 +321,7 @@ protected function logQueryToFile(string $sql): void { | |
* | ||
* @param string $seqName Name of the sequence object from which the ID should be returned. | ||
* | ||
* @return string the last inserted ID. | ||
* @return int the last inserted ID. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Our Connection class is a wrapper for doctrine: https://github.com/nextcloud/3rdparty/blob/9f53e69990ad79b4e25647c72ffc455918592c24/doctrine/dbal/src/Driver/Connection.php#L54 The return should be int|string|false |
||
* @throws Exception | ||
*/ | ||
public function lastInsertId($seqName = null) { | ||
|
Check failure
Code scanning / Psalm
ImplementedReturnTypeMismatch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a PR in SabreDAV to fix the PHPDoc there as well.