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

Clean up PHPDoc params and return values #40046

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -2602,7 +2602,7 @@
*
* @param string $principalUri
* @param string $objectUri
* @return array
* @return array|null

Check failure on line 2605 in apps/dav/lib/CalDAV/CalDavBackend.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

ImplementedReturnTypeMismatch

apps/dav/lib/CalDAV/CalDavBackend.php:2605:13: ImplementedReturnTypeMismatch: The inherited return type 'array<array-key, mixed>' for Sabre\CalDAV\Backend\SchedulingSupport::getSchedulingObject is different to the implemented return type for OCA\DAV\CalDAV\CalDavBackend::getschedulingobject 'array<array-key, mixed>|null' (see https://psalm.dev/123)

Check failure

Code scanning / Psalm

ImplementedReturnTypeMismatch Error

The inherited return type 'array<array-key, mixed>' for Sabre\CalDAV\Backend\SchedulingSupport::getSchedulingObject is different to the implemented return type for OCA\DAV\CalDAV\CalDavBackend::getschedulingobject 'array<array-key, mixed>|null'
Copy link
Member

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.

*/
public function getSchedulingObject($principalUri, $objectUri) {
$query = $this->db->getQueryBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
*
* @param string $prefixPath
*
* @return array
* @return array|null

Check failure on line 160 in apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

ImplementedReturnTypeMismatch

apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php:160:13: 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' (see https://psalm.dev/123)

Check failure

Code scanning / Psalm

ImplementedReturnTypeMismatch Error

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'
Copy link
Member

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.

*/
public function getPrincipalByPath($path) {
if (strpos($path, $this->principalPrefix) !== 0) {
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/CardDAV/CardDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@
*
* @param mixed $addressBookId
* @param string $cardUri
* @return array
* @return array|false

Check failure on line 546 in apps/dav/lib/CardDAV/CardDavBackend.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

ImplementedReturnTypeMismatch

apps/dav/lib/CardDAV/CardDavBackend.php:546:13: 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' (see https://psalm.dev/123)

Check failure

Code scanning / Psalm

ImplementedReturnTypeMismatch Error

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'
Copy link
Member

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.

*/
public function getCard($addressBookId, $cardUri) {
$query = $this->db->getQueryBuilder();
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/FilesReportPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The 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 . '}';
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/Principal.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
* getPrincipalsByPrefix.
*
* @param string $path
* @return array
* @return array|null

Check failure on line 162 in apps/dav/lib/Connector/Sabre/Principal.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

ImplementedReturnTypeMismatch

apps/dav/lib/Connector/Sabre/Principal.php:162:13: 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' (see https://psalm.dev/123)

Check failure

Code scanning / Psalm

ImplementedReturnTypeMismatch Error

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'
Copy link
Member

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.

*/
public function getPrincipalByPath($path) {
[$prefix, $name] = \Sabre\Uri\split($path);
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/TagsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private function getTagsAndFav($fileId) {
* Returns tags for the given file id
*
* @param integer $fileId file id
* @return array list of tags for that file
* @return array|null list of tags for that file
*/
private function getTags($fileId) {
if (isset($this->cachedTags[$fileId])) {
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/DAV/GroupPrincipalBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
* getPrincipalsByPrefix.
*
* @param string $path
* @return array
* @return array|null

Check failure on line 104 in apps/dav/lib/DAV/GroupPrincipalBackend.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

ImplementedReturnTypeMismatch

apps/dav/lib/DAV/GroupPrincipalBackend.php:104:13: 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' (see https://psalm.dev/123)

Check failure

Code scanning / Psalm

ImplementedReturnTypeMismatch Error

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'
Copy link
Member

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.

*/
public function getPrincipalByPath($path) {
$elements = explode('/', $path, 3);
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/DAV/SystemPrincipalBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
* getPrincipalsByPrefix.
*
* @param string $path
* @return array
* @return array|null

Check failure on line 68 in apps/dav/lib/DAV/SystemPrincipalBackend.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

ImplementedReturnTypeMismatch

apps/dav/lib/DAV/SystemPrincipalBackend.php:68:13: 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' (see https://psalm.dev/123)

Check failure

Code scanning / Psalm

ImplementedReturnTypeMismatch Error

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'
Copy link
Member

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.

*/
public function getPrincipalByPath($path) {
if ($path === 'principals/system/system') {
Expand Down
2 changes: 1 addition & 1 deletion core/Command/Config/ListConfigs.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected function getSystemConfigs($noSensitiveValues) {
*/
protected function getAppConfigs($app, $noSensitiveValues) {
if ($noSensitiveValues) {
return $this->appConfig->getFilteredValues($app, false);
return $this->appConfig->getFilteredValues($app);
} else {
return $this->appConfig->getValues($app, false);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/App/AppStore/Fetcher/Fetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function get($allowUnstable = false) {

// Refresh the file content
try {
$responseJson = $this->fetch($ETag, $content, $allowUnstable);
Copy link
Contributor

Choose a reason for hiding this comment

The 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 [];
Expand Down
2 changes: 1 addition & 1 deletion lib/private/App/InfoParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ private function isNavigationItem($data): bool {

/**
* @param \SimpleXMLElement $xml
* @return array
* @return array|string
*/
public function xmlToArray($xml) {
if (!$xml->children()) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Comments/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ public function searchForObjects(string $search, string $objectType, array $obje
* @param \DateTime $notOlderThan optional, timestamp of the oldest comments
* that may be returned
* @param string $verb Limit the verb of the comment - Added in 14.0.0
* @return Int
* @return int
* @since 9.0.0
*/
public function getNumberOfCommentsForObject($objectType, $objectId, \DateTime $notOlderThan = null, $verb = '') {
Expand Down
6 changes: 3 additions & 3 deletions lib/private/ContactsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
*
* @param int $id the unique identifier to a contact
* @param string $address_book_key identifier of the address book in which the contact shall be deleted
* @return bool successful or not
* @return bool|null successful or not

Check failure on line 95 in lib/private/ContactsManager.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

ImplementedReturnTypeMismatch

lib/private/ContactsManager.php:95:13: ImplementedReturnTypeMismatch: The inherited return type 'bool' for OCP\Contacts\IManager::delete is different to the implemented return type for OC\ContactsManager::delete 'bool|null' (see https://psalm.dev/123)

Check failure

Code scanning / Psalm

ImplementedReturnTypeMismatch Error

The inherited return type 'bool' for OCP\Contacts\IManager::delete is different to the implemented return type for OC\ContactsManager::delete 'bool|null'
*/
public function delete($id, $address_book_key) {
$addressBook = $this->getAddressBook($address_book_key);
Expand All @@ -113,7 +113,7 @@
*
* @param array $properties this array if key-value-pairs defines a contact
* @param string $address_book_key identifier of the address book in which the contact shall be created or updated
* @return array representing the contact just created or updated
* @return array|null representing the contact just created or updated

Check failure on line 116 in lib/private/ContactsManager.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

ImplementedReturnTypeMismatch

lib/private/ContactsManager.php:116:13: ImplementedReturnTypeMismatch: The inherited return type 'array<array-key, mixed>' for OCP\Contacts\IManager::createOrUpdate is different to the implemented return type for OC\ContactsManager::createorupdate 'array<array-key, mixed>|null' (see https://psalm.dev/123)

Check failure

Code scanning / Psalm

ImplementedReturnTypeMismatch Error

The inherited return type 'array<array-key, mixed>' for OCP\Contacts\IManager::createOrUpdate is different to the implemented return type for OC\ContactsManager::createorupdate 'array<array-key, mixed>|null'
*/
public function createOrUpdate($properties, $address_book_key) {
$addressBook = $this->getAddressBook($address_book_key);
Expand Down Expand Up @@ -194,7 +194,7 @@
* Get (and load when needed) the address book for $key
*
* @param string $addressBookKey
* @return IAddressBook
* @return IAddressBook|null
*/
protected function getAddressBook($addressBookKey) {
$this->loadAddressBooks();
Expand Down
2 changes: 1 addition & 1 deletion lib/private/DB/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Contributor

Choose a reason for hiding this comment

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

* @throws Exception
*/
public function lastInsertId($seqName = null) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ public function getPathById($id) {
* instead does a global search in the cache table
*
* @param int $id
* @return array first element holding the storage id, second the path
* @return array|null first element holding the storage id, second the path
* @deprecated use getPathById() instead
*/
public static function getById($id) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Mount/ObjectHomeMountProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct(IConfig $config) {
*
* @param IUser $user
* @param IStorageFactory $loader
* @return \OCP\Files\Mount\IMountPoint
* @return \OCP\Files\Mount\IMountPoint|null
*/
public function getHomeMountForUser(IUser $user, IStorageFactory $loader) {
$config = $this->getMultiBucketObjectStoreConfig($user);
Expand Down
8 changes: 4 additions & 4 deletions lib/private/Share20/ProviderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected function defaultShareProvider() {
/**
* Create the federated share provider
*
* @return FederatedShareProvider
* @return FederatedShareProvider|null
*/
protected function federatedShareProvider() {
if ($this->federatedProvider === null) {
Expand Down Expand Up @@ -171,7 +171,7 @@ protected function federatedShareProvider() {
/**
* Create the federated share provider
*
* @return ShareByMailProvider
* @return ShareByMailProvider|null
*/
protected function getShareByMailProvider() {
if ($this->shareByMailProvider === null) {
Expand Down Expand Up @@ -211,7 +211,7 @@ protected function getShareByMailProvider() {
/**
* Create the circle share provider
*
* @return FederatedShareProvider
* @return FederatedShareProvider|null
*
* @suppress PhanUndeclaredClassMethod
*/
Expand Down Expand Up @@ -245,7 +245,7 @@ protected function getShareByCircleProvider() {
/**
* Create the room share provider
*
* @return RoomShareProvider
* @return RoomShareProvider|null
*/
protected function getRoomShareProvider() {
if ($this->roomShareProvider === null) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/TagManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
* @param boolean $includeShared Whether to include tags for items shared with this user by others.
* @param string $userId user for which to retrieve the tags, defaults to the currently
* logged in user
* @return \OCP\ITags
* @return \OCP\ITags|null

Check failure

Code scanning / Psalm

ImplementedReturnTypeMismatch Error

The inherited return type 'OCP\ITags' for OCP\ITagManager::load is different to the implemented return type for OC\TagManager::load 'OCP\ITags|null'
*
* since 20.0.0 $includeShared isn't used anymore
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/private/User/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public function searchKnownUsersByDisplayName(string $searcher, string $pattern,
*
* @param string $loginName The loginname
* @param string $password The password
* @return string
* @return string|false
*
* Check if the password is correct without logging in the user
* returns the user id or false
Expand Down
2 changes: 1 addition & 1 deletion lib/private/legacy/OC_API.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected static function isV2(\OCP\IRequest $request) {

/**
* @param integer $sc
* @return int
* @return int|null
*/
public static function mapStatusCodes($sc) {
switch ($sc) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/legacy/OC_App.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public function enable(string $appId,
/**
* Get the path where to install apps
*
* @return string|false
* @return string|false|null
*/
public static function getInstallPath() {
foreach (OC::$APPSROOTS as $dir) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/legacy/OC_Defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public function getEntity() {
*/
public function getSlogan(?string $lang = null) {
if ($this->themeExist('getSlogan')) {
return $this->theme->getSlogan($lang);
return $this->theme->getSlogan();
} else {
if ($this->defaultSlogan === null) {
$l10n = \OC::$server->getL10N('lib', $lang);
Expand Down
2 changes: 1 addition & 1 deletion lib/public/Comments/ICommentsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function searchForObjects(string $search, string $objectType, array $obje
* @param \DateTime|null $notOlderThan optional, timestamp of the oldest comments
* that may be returned
* @param string $verb Limit the verb of the comment - Added in 14.0.0
* @return Int
* @return int
* @since 9.0.0
*/
public function getNumberOfCommentsForObject($objectType, $objectId, \DateTime $notOlderThan = null, $verb = '');
Expand Down
Loading