Merge pull request #25073 from nextcloud/psalm/24521/remove-unneeded-casts

Remove unneeded casts that were found by Psalm
This commit is contained in:
Morris Jobke 2021-01-11 14:15:16 +01:00 committed by GitHub
commit 5ed673e5eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 170 additions and 172 deletions

View File

@ -185,7 +185,7 @@ class Provider implements IProvider {
// they will get the dead entries in their stream. // they will get the dead entries in their stream.
return [ return [
'actor' => $subjectParameters[0], 'actor' => $subjectParameters[0],
'fileId' => (int) $event->getObjectId(), 'fileId' => $event->getObjectId(),
'filePath' => trim($subjectParameters[1], '/'), 'filePath' => trim($subjectParameters[1], '/'),
]; ];
} }

View File

@ -229,32 +229,32 @@ class Calendar extends Base {
case self::SUBJECT_UNSHARE_USER . '_self': case self::SUBJECT_UNSHARE_USER . '_self':
return [ return [
'actor' => $this->generateUserParameter($parameters[0]), 'actor' => $this->generateUserParameter($parameters[0]),
'calendar' => $this->generateLegacyCalendarParameter((int)$event->getObjectId(), $parameters[1]), 'calendar' => $this->generateLegacyCalendarParameter($event->getObjectId(), $parameters[1]),
]; ];
case self::SUBJECT_SHARE_USER . '_you': case self::SUBJECT_SHARE_USER . '_you':
case self::SUBJECT_UNSHARE_USER . '_you': case self::SUBJECT_UNSHARE_USER . '_you':
return [ return [
'user' => $this->generateUserParameter($parameters[0]), 'user' => $this->generateUserParameter($parameters[0]),
'calendar' => $this->generateLegacyCalendarParameter((int)$event->getObjectId(), $parameters[1]), 'calendar' => $this->generateLegacyCalendarParameter($event->getObjectId(), $parameters[1]),
]; ];
case self::SUBJECT_SHARE_USER . '_by': case self::SUBJECT_SHARE_USER . '_by':
case self::SUBJECT_UNSHARE_USER . '_by': case self::SUBJECT_UNSHARE_USER . '_by':
return [ return [
'user' => $this->generateUserParameter($parameters[0]), 'user' => $this->generateUserParameter($parameters[0]),
'calendar' => $this->generateLegacyCalendarParameter((int)$event->getObjectId(), $parameters[1]), 'calendar' => $this->generateLegacyCalendarParameter($event->getObjectId(), $parameters[1]),
'actor' => $this->generateUserParameter($parameters[2]), 'actor' => $this->generateUserParameter($parameters[2]),
]; ];
case self::SUBJECT_SHARE_GROUP . '_you': case self::SUBJECT_SHARE_GROUP . '_you':
case self::SUBJECT_UNSHARE_GROUP . '_you': case self::SUBJECT_UNSHARE_GROUP . '_you':
return [ return [
'group' => $this->generateGroupParameter($parameters[0]), 'group' => $this->generateGroupParameter($parameters[0]),
'calendar' => $this->generateLegacyCalendarParameter((int)$event->getObjectId(), $parameters[1]), 'calendar' => $this->generateLegacyCalendarParameter($event->getObjectId(), $parameters[1]),
]; ];
case self::SUBJECT_SHARE_GROUP . '_by': case self::SUBJECT_SHARE_GROUP . '_by':
case self::SUBJECT_UNSHARE_GROUP . '_by': case self::SUBJECT_UNSHARE_GROUP . '_by':
return [ return [
'group' => $this->generateGroupParameter($parameters[0]), 'group' => $this->generateGroupParameter($parameters[0]),
'calendar' => $this->generateLegacyCalendarParameter((int)$event->getObjectId(), $parameters[1]), 'calendar' => $this->generateLegacyCalendarParameter($event->getObjectId(), $parameters[1]),
'actor' => $this->generateUserParameter($parameters[2]), 'actor' => $this->generateUserParameter($parameters[2]),
]; ];
} }

View File

@ -195,14 +195,14 @@ class Event extends Base {
case self::SUBJECT_OBJECT_UPDATE . '_event': case self::SUBJECT_OBJECT_UPDATE . '_event':
return [ return [
'actor' => $this->generateUserParameter($parameters[0]), 'actor' => $this->generateUserParameter($parameters[0]),
'calendar' => $this->generateLegacyCalendarParameter((int)$event->getObjectId(), $parameters[1]), 'calendar' => $this->generateLegacyCalendarParameter($event->getObjectId(), $parameters[1]),
'event' => $this->generateObjectParameter($parameters[2]), 'event' => $this->generateObjectParameter($parameters[2]),
]; ];
case self::SUBJECT_OBJECT_ADD . '_event_self': case self::SUBJECT_OBJECT_ADD . '_event_self':
case self::SUBJECT_OBJECT_DELETE . '_event_self': case self::SUBJECT_OBJECT_DELETE . '_event_self':
case self::SUBJECT_OBJECT_UPDATE . '_event_self': case self::SUBJECT_OBJECT_UPDATE . '_event_self':
return [ return [
'calendar' => $this->generateLegacyCalendarParameter((int)$event->getObjectId(), $parameters[1]), 'calendar' => $this->generateLegacyCalendarParameter($event->getObjectId(), $parameters[1]),
'event' => $this->generateObjectParameter($parameters[2]), 'event' => $this->generateObjectParameter($parameters[2]),
]; ];
} }

View File

@ -127,7 +127,7 @@ class Todo extends Event {
case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action': case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action':
return [ return [
'actor' => $this->generateUserParameter($parameters[0]), 'actor' => $this->generateUserParameter($parameters[0]),
'calendar' => $this->generateLegacyCalendarParameter((int)$event->getObjectId(), $parameters[1]), 'calendar' => $this->generateLegacyCalendarParameter($event->getObjectId(), $parameters[1]),
'todo' => $this->generateObjectParameter($parameters[2]), 'todo' => $this->generateObjectParameter($parameters[2]),
]; ];
case self::SUBJECT_OBJECT_ADD . '_todo_self': case self::SUBJECT_OBJECT_ADD . '_todo_self':
@ -136,7 +136,7 @@ class Todo extends Event {
case self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self': case self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self':
case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self': case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self':
return [ return [
'calendar' => $this->generateLegacyCalendarParameter((int)$event->getObjectId(), $parameters[1]), 'calendar' => $this->generateLegacyCalendarParameter($event->getObjectId(), $parameters[1]),
'todo' => $this->generateObjectParameter($parameters[2]), 'todo' => $this->generateObjectParameter($parameters[2]),
]; ];
} }

View File

@ -138,7 +138,7 @@ class PublishPlugin extends ServerPlugin {
$canPublish &= ($node->getOwner() === $node->getPrincipalURI()); $canPublish &= ($node->getOwner() === $node->getPrincipalURI());
} }
return new AllowedSharingModes((bool)$canShare, (bool)$canPublish); return new AllowedSharingModes($canShare, $canPublish);
}); });
} }
} }

View File

@ -75,36 +75,36 @@ class RecoveryController extends Controller {
public function adminRecovery($recoveryPassword, $confirmPassword, $adminEnableRecovery) { public function adminRecovery($recoveryPassword, $confirmPassword, $adminEnableRecovery) {
// Check if both passwords are the same // Check if both passwords are the same
if (empty($recoveryPassword)) { if (empty($recoveryPassword)) {
$errorMessage = (string)$this->l->t('Missing recovery key password'); $errorMessage = $this->l->t('Missing recovery key password');
return new DataResponse(['data' => ['message' => $errorMessage]], return new DataResponse(['data' => ['message' => $errorMessage]],
Http::STATUS_BAD_REQUEST); Http::STATUS_BAD_REQUEST);
} }
if (empty($confirmPassword)) { if (empty($confirmPassword)) {
$errorMessage = (string)$this->l->t('Please repeat the recovery key password'); $errorMessage = $this->l->t('Please repeat the recovery key password');
return new DataResponse(['data' => ['message' => $errorMessage]], return new DataResponse(['data' => ['message' => $errorMessage]],
Http::STATUS_BAD_REQUEST); Http::STATUS_BAD_REQUEST);
} }
if ($recoveryPassword !== $confirmPassword) { if ($recoveryPassword !== $confirmPassword) {
$errorMessage = (string)$this->l->t('Repeated recovery key password does not match the provided recovery key password'); $errorMessage = $this->l->t('Repeated recovery key password does not match the provided recovery key password');
return new DataResponse(['data' => ['message' => $errorMessage]], return new DataResponse(['data' => ['message' => $errorMessage]],
Http::STATUS_BAD_REQUEST); Http::STATUS_BAD_REQUEST);
} }
if (isset($adminEnableRecovery) && $adminEnableRecovery === '1') { if (isset($adminEnableRecovery) && $adminEnableRecovery === '1') {
if ($this->recovery->enableAdminRecovery($recoveryPassword)) { if ($this->recovery->enableAdminRecovery($recoveryPassword)) {
return new DataResponse(['data' => ['message' => (string)$this->l->t('Recovery key successfully enabled')]]); return new DataResponse(['data' => ['message' => $this->l->t('Recovery key successfully enabled')]]);
} }
return new DataResponse(['data' => ['message' => (string)$this->l->t('Could not enable recovery key. Please check your recovery key password!')]], Http::STATUS_BAD_REQUEST); return new DataResponse(['data' => ['message' => $this->l->t('Could not enable recovery key. Please check your recovery key password!')]], Http::STATUS_BAD_REQUEST);
} elseif (isset($adminEnableRecovery) && $adminEnableRecovery === '0') { } elseif (isset($adminEnableRecovery) && $adminEnableRecovery === '0') {
if ($this->recovery->disableAdminRecovery($recoveryPassword)) { if ($this->recovery->disableAdminRecovery($recoveryPassword)) {
return new DataResponse(['data' => ['message' => (string)$this->l->t('Recovery key successfully disabled')]]); return new DataResponse(['data' => ['message' => $this->l->t('Recovery key successfully disabled')]]);
} }
return new DataResponse(['data' => ['message' => (string)$this->l->t('Could not disable recovery key. Please check your recovery key password!')]], Http::STATUS_BAD_REQUEST); return new DataResponse(['data' => ['message' => $this->l->t('Could not disable recovery key. Please check your recovery key password!')]], Http::STATUS_BAD_REQUEST);
} }
// this response should never be sent but just in case. // this response should never be sent but just in case.
return new DataResponse(['data' => ['message' => (string)$this->l->t('Missing parameters')]], Http::STATUS_BAD_REQUEST); return new DataResponse(['data' => ['message' => $this->l->t('Missing parameters')]], Http::STATUS_BAD_REQUEST);
} }
/** /**
@ -116,22 +116,22 @@ class RecoveryController extends Controller {
public function changeRecoveryPassword($newPassword, $oldPassword, $confirmPassword) { public function changeRecoveryPassword($newPassword, $oldPassword, $confirmPassword) {
//check if both passwords are the same //check if both passwords are the same
if (empty($oldPassword)) { if (empty($oldPassword)) {
$errorMessage = (string)$this->l->t('Please provide the old recovery password'); $errorMessage = $this->l->t('Please provide the old recovery password');
return new DataResponse(['data' => ['message' => $errorMessage]], Http::STATUS_BAD_REQUEST); return new DataResponse(['data' => ['message' => $errorMessage]], Http::STATUS_BAD_REQUEST);
} }
if (empty($newPassword)) { if (empty($newPassword)) {
$errorMessage = (string)$this->l->t('Please provide a new recovery password'); $errorMessage = $this->l->t('Please provide a new recovery password');
return new DataResponse(['data' => ['message' => $errorMessage]], Http::STATUS_BAD_REQUEST); return new DataResponse(['data' => ['message' => $errorMessage]], Http::STATUS_BAD_REQUEST);
} }
if (empty($confirmPassword)) { if (empty($confirmPassword)) {
$errorMessage = (string)$this->l->t('Please repeat the new recovery password'); $errorMessage = $this->l->t('Please repeat the new recovery password');
return new DataResponse(['data' => ['message' => $errorMessage]], Http::STATUS_BAD_REQUEST); return new DataResponse(['data' => ['message' => $errorMessage]], Http::STATUS_BAD_REQUEST);
} }
if ($newPassword !== $confirmPassword) { if ($newPassword !== $confirmPassword) {
$errorMessage = (string)$this->l->t('Repeated recovery key password does not match the provided recovery key password'); $errorMessage = $this->l->t('Repeated recovery key password does not match the provided recovery key password');
return new DataResponse(['data' => ['message' => $errorMessage]], Http::STATUS_BAD_REQUEST); return new DataResponse(['data' => ['message' => $errorMessage]], Http::STATUS_BAD_REQUEST);
} }
@ -142,14 +142,14 @@ class RecoveryController extends Controller {
return new DataResponse( return new DataResponse(
[ [
'data' => [ 'data' => [
'message' => (string)$this->l->t('Password successfully changed.')] 'message' => $this->l->t('Password successfully changed.')]
] ]
); );
} }
return new DataResponse( return new DataResponse(
[ [
'data' => [ 'data' => [
'message' => (string)$this->l->t('Could not change the password. Maybe the old password was not correct.') 'message' => $this->l->t('Could not change the password. Maybe the old password was not correct.')
] ]
], Http::STATUS_BAD_REQUEST); ], Http::STATUS_BAD_REQUEST);
} }
@ -169,14 +169,14 @@ class RecoveryController extends Controller {
return new DataResponse( return new DataResponse(
[ [
'data' => [ 'data' => [
'message' => (string)$this->l->t('Recovery Key disabled')] 'message' => $this->l->t('Recovery Key disabled')]
] ]
); );
} }
return new DataResponse( return new DataResponse(
[ [
'data' => [ 'data' => [
'message' => (string)$this->l->t('Recovery Key enabled')] 'message' => $this->l->t('Recovery Key enabled')]
] ]
); );
} }
@ -184,7 +184,7 @@ class RecoveryController extends Controller {
return new DataResponse( return new DataResponse(
[ [
'data' => [ 'data' => [
'message' => (string)$this->l->t('Could not enable the recovery key, please try again or contact your administrator') 'message' => $this->l->t('Could not enable the recovery key, please try again or contact your administrator')
] ]
], Http::STATUS_BAD_REQUEST); ], Http::STATUS_BAD_REQUEST);
} }

View File

@ -142,11 +142,11 @@ class SettingsController extends Controller {
if ($result === true) { if ($result === true) {
$this->session->setStatus(Session::INIT_SUCCESSFUL); $this->session->setStatus(Session::INIT_SUCCESSFUL);
return new DataResponse( return new DataResponse(
['message' => (string) $this->l->t('Private key password successfully updated.')] ['message' => $this->l->t('Private key password successfully updated.')]
); );
} else { } else {
return new DataResponse( return new DataResponse(
['message' => (string) $errorMessage], ['message' => $errorMessage],
Http::STATUS_BAD_REQUEST Http::STATUS_BAD_REQUEST
); );
} }

View File

@ -73,25 +73,25 @@ class StatusController extends Controller {
switch ($this->session->getStatus()) { switch ($this->session->getStatus()) {
case Session::INIT_EXECUTED: case Session::INIT_EXECUTED:
$status = 'interactionNeeded'; $status = 'interactionNeeded';
$message = (string)$this->l->t( $message = $this->l->t(
'Invalid private key for encryption app. Please update your private key password in your personal settings to recover access to your encrypted files.' 'Invalid private key for encryption app. Please update your private key password in your personal settings to recover access to your encrypted files.'
); );
break; break;
case Session::NOT_INITIALIZED: case Session::NOT_INITIALIZED:
$status = 'interactionNeeded'; $status = 'interactionNeeded';
if ($this->encryptionManager->isEnabled()) { if ($this->encryptionManager->isEnabled()) {
$message = (string)$this->l->t( $message = $this->l->t(
'Encryption App is enabled, but your keys are not initialized. Please log-out and log-in again.' 'Encryption App is enabled, but your keys are not initialized. Please log-out and log-in again.'
); );
} else { } else {
$message = (string)$this->l->t( $message = $this->l->t(
'Please enable server side encryption in the admin settings in order to use the encryption module.' 'Please enable server side encryption in the admin settings in order to use the encryption module.'
); );
} }
break; break;
case Session::INIT_SUCCESSFUL: case Session::INIT_SUCCESSFUL:
$status = 'success'; $status = 'success';
$message = (string)$this->l->t('Encryption app is enabled and ready'); $message = $this->l->t('Encryption app is enabled and ready');
} }
return new DataResponse( return new DataResponse(

View File

@ -422,7 +422,7 @@ class EncryptAll {
continue; continue;
} }
$subject = (string)$this->l->t('one-time password for server-side-encryption'); $subject = $this->l->t('one-time password for server-side-encryption');
list($htmlBody, $textBody) = $this->createMailBody($password); list($htmlBody, $textBody) = $this->createMailBody($password);
// send it out now // send it out now

View File

@ -151,14 +151,14 @@ class Notifier implements INotifier {
switch ($action->getLabel()) { switch ($action->getLabel()) {
case 'accept': case 'accept':
$action->setParsedLabel( $action->setParsedLabel(
(string)$l->t('Accept') $l->t('Accept')
) )
->setPrimary(true); ->setPrimary(true);
break; break;
case 'decline': case 'decline':
$action->setParsedLabel( $action->setParsedLabel(
(string)$l->t('Decline') $l->t('Decline')
); );
break; break;
} }

View File

@ -71,7 +71,7 @@ class SettingsController extends Controller {
[ [
'url' => $url, 'url' => $url,
'id' => $id, 'id' => $id,
'message' => (string) $this->l->t('Added to the list of trusted servers') 'message' => $this->l->t('Added to the list of trusted servers')
] ]
); );
} }

View File

@ -321,7 +321,7 @@ class ApiController extends Controller {
foreach ($navItems as $item) { foreach ($navItems as $item) {
// check if data is valid // check if data is valid
if (($show === 0 || $show === 1) && isset($item['expandedState']) && $key === $item['expandedState']) { if (($show === 0 || $show === 1) && isset($item['expandedState']) && $key === $item['expandedState']) {
$this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', $key, (int)$show); $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', $key, $show);
return new Response(); return new Response();
} }
} }

View File

@ -179,7 +179,7 @@ class GlobalStoragesController extends StoragesController {
} catch (NotFoundException $e) { } catch (NotFoundException $e) {
return new DataResponse( return new DataResponse(
[ [
'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id]) 'message' => $this->l10n->t('Storage with ID "%d" not found', [$id])
], ],
Http::STATUS_NOT_FOUND Http::STATUS_NOT_FOUND
); );

View File

@ -145,7 +145,7 @@ abstract class StoragesController extends Controller {
$this->logger->logException($e); $this->logger->logException($e);
return new DataResponse( return new DataResponse(
[ [
'message' => (string)$this->l10n->t('Invalid backend or authentication mechanism class') 'message' => $this->l10n->t('Invalid backend or authentication mechanism class')
], ],
Http::STATUS_UNPROCESSABLE_ENTITY Http::STATUS_UNPROCESSABLE_ENTITY
); );
@ -164,7 +164,7 @@ abstract class StoragesController extends Controller {
if ($mountPoint === '') { if ($mountPoint === '') {
return new DataResponse( return new DataResponse(
[ [
'message' => (string)$this->l10n->t('Invalid mount point'), 'message' => $this->l10n->t('Invalid mount point'),
], ],
Http::STATUS_UNPROCESSABLE_ENTITY Http::STATUS_UNPROCESSABLE_ENTITY
); );
@ -174,7 +174,7 @@ abstract class StoragesController extends Controller {
// objectstore must not be sent from client side // objectstore must not be sent from client side
return new DataResponse( return new DataResponse(
[ [
'message' => (string)$this->l10n->t('Objectstore forbidden'), 'message' => $this->l10n->t('Objectstore forbidden'),
], ],
Http::STATUS_UNPROCESSABLE_ENTITY Http::STATUS_UNPROCESSABLE_ENTITY
); );
@ -188,7 +188,7 @@ abstract class StoragesController extends Controller {
// invalid backend // invalid backend
return new DataResponse( return new DataResponse(
[ [
'message' => (string)$this->l10n->t('Invalid storage backend "%s"', [ 'message' => $this->l10n->t('Invalid storage backend "%s"', [
$backend->getIdentifier(), $backend->getIdentifier(),
]), ]),
], ],
@ -200,7 +200,7 @@ abstract class StoragesController extends Controller {
// not permitted to use backend // not permitted to use backend
return new DataResponse( return new DataResponse(
[ [
'message' => (string)$this->l10n->t('Not permitted to use backend "%s"', [ 'message' => $this->l10n->t('Not permitted to use backend "%s"', [
$backend->getIdentifier(), $backend->getIdentifier(),
]), ]),
], ],
@ -211,7 +211,7 @@ abstract class StoragesController extends Controller {
// not permitted to use auth mechanism // not permitted to use auth mechanism
return new DataResponse( return new DataResponse(
[ [
'message' => (string)$this->l10n->t('Not permitted to use authentication mechanism "%s"', [ 'message' => $this->l10n->t('Not permitted to use authentication mechanism "%s"', [
$authMechanism->getIdentifier(), $authMechanism->getIdentifier(),
]), ]),
], ],
@ -223,7 +223,7 @@ abstract class StoragesController extends Controller {
// unsatisfied parameters // unsatisfied parameters
return new DataResponse( return new DataResponse(
[ [
'message' => (string)$this->l10n->t('Unsatisfied backend parameters'), 'message' => $this->l10n->t('Unsatisfied backend parameters'),
], ],
Http::STATUS_UNPROCESSABLE_ENTITY Http::STATUS_UNPROCESSABLE_ENTITY
); );
@ -232,7 +232,7 @@ abstract class StoragesController extends Controller {
// unsatisfied parameters // unsatisfied parameters
return new DataResponse( return new DataResponse(
[ [
'message' => (string)$this->l10n->t('Unsatisfied authentication mechanism parameters'), 'message' => $this->l10n->t('Unsatisfied authentication mechanism parameters'),
], ],
Http::STATUS_UNPROCESSABLE_ENTITY Http::STATUS_UNPROCESSABLE_ENTITY
); );
@ -347,7 +347,7 @@ abstract class StoragesController extends Controller {
} catch (NotFoundException $e) { } catch (NotFoundException $e) {
return new DataResponse( return new DataResponse(
[ [
'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id]), 'message' => $this->l10n->t('Storage with ID "%d" not found', [$id]),
], ],
Http::STATUS_NOT_FOUND Http::STATUS_NOT_FOUND
); );
@ -376,7 +376,7 @@ abstract class StoragesController extends Controller {
} catch (NotFoundException $e) { } catch (NotFoundException $e) {
return new DataResponse( return new DataResponse(
[ [
'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id]), 'message' => $this->l10n->t('Storage with ID "%d" not found', [$id]),
], ],
Http::STATUS_NOT_FOUND Http::STATUS_NOT_FOUND
); );

View File

@ -125,7 +125,7 @@ class UserGlobalStoragesController extends StoragesController {
} catch (NotFoundException $e) { } catch (NotFoundException $e) {
return new DataResponse( return new DataResponse(
[ [
'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id]) 'message' => $this->l10n->t('Storage with ID "%d" not found', [$id])
], ],
Http::STATUS_NOT_FOUND Http::STATUS_NOT_FOUND
); );
@ -169,7 +169,7 @@ class UserGlobalStoragesController extends StoragesController {
} else { } else {
return new DataResponse( return new DataResponse(
[ [
'message' => (string)$this->l10n->t('Storage with ID "%d" is not user editable', [$id]) 'message' => $this->l10n->t('Storage with ID "%d" is not user editable', [$id])
], ],
Http::STATUS_FORBIDDEN Http::STATUS_FORBIDDEN
); );
@ -177,7 +177,7 @@ class UserGlobalStoragesController extends StoragesController {
} catch (NotFoundException $e) { } catch (NotFoundException $e) {
return new DataResponse( return new DataResponse(
[ [
'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id]) 'message' => $this->l10n->t('Storage with ID "%d" not found', [$id])
], ],
Http::STATUS_NOT_FOUND Http::STATUS_NOT_FOUND
); );

View File

@ -198,7 +198,7 @@ class UserStoragesController extends StoragesController {
} catch (NotFoundException $e) { } catch (NotFoundException $e) {
return new DataResponse( return new DataResponse(
[ [
'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id]) 'message' => $this->l10n->t('Storage with ID "%d" not found', [$id])
], ],
Http::STATUS_NOT_FOUND Http::STATUS_NOT_FOUND
); );

View File

@ -295,11 +295,11 @@ class MountConfig {
private static function getSingleDependencyMessage(\OCP\IL10N $l, $module, $backend) { private static function getSingleDependencyMessage(\OCP\IL10N $l, $module, $backend) {
switch (strtolower($module)) { switch (strtolower($module)) {
case 'curl': case 'curl':
return (string)$l->t('The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$backend]); return $l->t('The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$backend]);
case 'ftp': case 'ftp':
return (string)$l->t('The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$backend]); return $l->t('The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$backend]);
default: default:
return (string)$l->t('"%1$s" is not installed. Mounting of %2$s is not possible. Please ask your system administrator to install it.', [$module, $backend]); return $l->t('"%1$s" is not installed. Mounting of %2$s is not possible. Please ask your system administrator to install it.', [$module, $backend]);
} }
} }

View File

@ -1064,7 +1064,7 @@ class ShareAPIController extends OCSController {
} }
if ($permissions !== null) { if ($permissions !== null) {
$newPermissions = (int) $permissions; $newPermissions = $permissions;
$newPermissions = $newPermissions & ~Constants::PERMISSION_SHARE; $newPermissions = $newPermissions & ~Constants::PERMISSION_SHARE;
} }
@ -1147,7 +1147,6 @@ class ShareAPIController extends OCSController {
// NOT A LINK SHARE // NOT A LINK SHARE
else { else {
if ($permissions !== null) { if ($permissions !== null) {
$permissions = (int) $permissions;
$share->setPermissions($permissions); $share->setPermissions($permissions);
} }

View File

@ -212,7 +212,7 @@ class ShareesAPIController extends OCSController {
} }
sort($shareTypes); sort($shareTypes);
$this->limit = (int) $perPage; $this->limit = $perPage;
$this->offset = $perPage * ($page - 1); $this->offset = $perPage * ($page - 1);
// In global scale mode we always search the loogup server // In global scale mode we always search the loogup server

View File

@ -239,9 +239,9 @@ class CheckSetupController extends Controller {
return ''; return '';
} }
$features = (string)$this->l10n->t('installing and updating apps via the app store or Federated Cloud Sharing'); $features = $this->l10n->t('installing and updating apps via the app store or Federated Cloud Sharing');
if (!$this->config->getSystemValue('appstoreenabled', true)) { if (!$this->config->getSystemValue('appstoreenabled', true)) {
$features = (string)$this->l10n->t('Federated Cloud Sharing'); $features = $this->l10n->t('Federated Cloud Sharing');
} }
// Check if at least OpenSSL after 1.01d or 1.0.2b // Check if at least OpenSSL after 1.01d or 1.0.2b

View File

@ -288,24 +288,24 @@ class Activity implements IProvider {
case self::SUBJECT_SHARED_EMAIL_SELF: case self::SUBJECT_SHARED_EMAIL_SELF:
case self::SUBJECT_UNSHARED_EMAIL_SELF: case self::SUBJECT_UNSHARED_EMAIL_SELF:
return [ return [
'file' => $this->generateFileParameter((int) $event->getObjectId(), $parameters[0]), 'file' => $this->generateFileParameter($event->getObjectId(), $parameters[0]),
'email' => $this->generateEmailParameter($parameters[1]), 'email' => $this->generateEmailParameter($parameters[1]),
]; ];
case self::SUBJECT_SHARED_EMAIL_BY: case self::SUBJECT_SHARED_EMAIL_BY:
case self::SUBJECT_UNSHARED_EMAIL_BY: case self::SUBJECT_UNSHARED_EMAIL_BY:
return [ return [
'file' => $this->generateFileParameter((int) $event->getObjectId(), $parameters[0]), 'file' => $this->generateFileParameter($event->getObjectId(), $parameters[0]),
'email' => $this->generateEmailParameter($parameters[1]), 'email' => $this->generateEmailParameter($parameters[1]),
'actor' => $this->generateUserParameter($parameters[2]), 'actor' => $this->generateUserParameter($parameters[2]),
]; ];
case self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND: case self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND:
return [ return [
'file' => $this->generateFileParameter((int) $event->getObjectId(), $parameters[0]), 'file' => $this->generateFileParameter($event->getObjectId(), $parameters[0]),
'email' => $this->generateEmailParameter($parameters[1]), 'email' => $this->generateEmailParameter($parameters[1]),
]; ];
case self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF: case self::SUBJECT_SHARED_EMAIL_PASSWORD_SEND_SELF:
return [ return [
'file' => $this->generateFileParameter((int) $event->getObjectId(), $parameters[0]), 'file' => $this->generateFileParameter($event->getObjectId(), $parameters[0]),
]; ];
} }
throw new \InvalidArgumentException(); throw new \InvalidArgumentException();

View File

@ -198,8 +198,8 @@ class IconBuilder {
// offset for icon positioning // offset for icon positioning
$border_w = (int)($appIconFile->getImageWidth() * 0.05); $border_w = (int)($appIconFile->getImageWidth() * 0.05);
$border_h = (int)($appIconFile->getImageHeight() * 0.05); $border_h = (int)($appIconFile->getImageHeight() * 0.05);
$innerWidth = (int)($appIconFile->getImageWidth() - $border_w * 2); $innerWidth = ($appIconFile->getImageWidth() - $border_w * 2);
$innerHeight = (int)($appIconFile->getImageHeight() - $border_h * 2); $innerHeight = ($appIconFile->getImageHeight() - $border_h * 2);
$appIconFile->adaptiveResizeImage($innerWidth, $innerHeight); $appIconFile->adaptiveResizeImage($innerWidth, $innerHeight);
// center icon // center icon
$offset_w = 512 / 2 - $innerWidth / 2; $offset_w = 512 / 2 - $innerWidth / 2;

View File

@ -76,7 +76,7 @@ class RequestUserAgent extends AbstractStringCheck {
* @return string * @return string
*/ */
protected function getActualValue() { protected function getActualValue() {
return (string) $this->request->getHeader('User-Agent'); return $this->request->getHeader('User-Agent');
} }
public function isAvailableForScope(int $scope): bool { public function isAvailableForScope(int $scope): bool {

View File

@ -1031,7 +1031,7 @@ class Version13000Date20170718121200 extends SimpleMigrationStep {
$insert->setParameter('propertypath', (string) $row['propertypath']) $insert->setParameter('propertypath', (string) $row['propertypath'])
->setParameter('propertyname', (string) $row['propertyname']) ->setParameter('propertyname', (string) $row['propertyname'])
->setParameter('propertyvalue', (string) $row['propertyvalue']) ->setParameter('propertyvalue', (string) $row['propertyvalue'])
->setParameter('userid', (string) ($match[2] ?? '')); ->setParameter('userid', ($match[2] ?? ''));
$insert->execute(); $insert->execute();
} }
} }

View File

@ -47,7 +47,7 @@ $eventSource = \OC::$server->createEventSource();
// need to send an initial message to force-init the event source, // need to send an initial message to force-init the event source,
// which will then trigger its own CSRF check and produces its own CSRF error // which will then trigger its own CSRF check and produces its own CSRF error
// message // message
$eventSource->send('success', (string)$l->t('Preparing update')); $eventSource->send('success', $l->t('Preparing update'));
class FeedBackHandler { class FeedBackHandler {
/** @var integer */ /** @var integer */
@ -83,23 +83,23 @@ class FeedBackHandler {
if (empty($desc)) { if (empty($desc)) {
$desc = $this->currentStep; $desc = $this->currentStep;
} }
$this->eventSource->send('success', (string)$this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $desc])); $this->eventSource->send('success', $this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $desc]));
break; break;
case '\OC\Repair::finishProgress': case '\OC\Repair::finishProgress':
$this->progressStateMax = $this->progressStateStep; $this->progressStateMax = $this->progressStateStep;
$this->eventSource->send('success', (string)$this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $this->currentStep])); $this->eventSource->send('success', $this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $this->currentStep]));
break; break;
case '\OC\Repair::step': case '\OC\Repair::step':
$this->eventSource->send('success', (string)$this->l10n->t('Repair step:') . ' ' . $event->getArgument(0)); $this->eventSource->send('success', $this->l10n->t('Repair step:') . ' ' . $event->getArgument(0));
break; break;
case '\OC\Repair::info': case '\OC\Repair::info':
$this->eventSource->send('success', (string)$this->l10n->t('Repair info:') . ' ' . $event->getArgument(0)); $this->eventSource->send('success', $this->l10n->t('Repair info:') . ' ' . $event->getArgument(0));
break; break;
case '\OC\Repair::warning': case '\OC\Repair::warning':
$this->eventSource->send('notice', (string)$this->l10n->t('Repair warning:') . ' ' . $event->getArgument(0)); $this->eventSource->send('notice', $this->l10n->t('Repair warning:') . ' ' . $event->getArgument(0));
break; break;
case '\OC\Repair::error': case '\OC\Repair::error':
$this->eventSource->send('notice', (string)$this->l10n->t('Repair error:') . ' ' . $event->getArgument(0)); $this->eventSource->send('notice', $this->l10n->t('Repair error:') . ' ' . $event->getArgument(0));
break; break;
} }
} }
@ -108,7 +108,7 @@ class FeedBackHandler {
if (\OCP\Util::needUpgrade()) { if (\OCP\Util::needUpgrade()) {
$config = \OC::$server->getSystemConfig(); $config = \OC::$server->getSystemConfig();
if ($config->getValue('upgrade.disable-web', false)) { if ($config->getValue('upgrade.disable-web', false)) {
$eventSource->send('failure', (string)$l->t('Please use the command line updater because automatic updating is disabled in the config.php.')); $eventSource->send('failure', $l->t('Please use the command line updater because automatic updating is disabled in the config.php.'));
$eventSource->close(); $eventSource->close();
exit(); exit();
} }
@ -130,12 +130,12 @@ if (\OCP\Util::needUpgrade()) {
$dispatcher = \OC::$server->getEventDispatcher(); $dispatcher = \OC::$server->getEventDispatcher();
$dispatcher->addListener('\OC\DB\Migrator::executeSql', function ($event) use ($eventSource, $l) { $dispatcher->addListener('\OC\DB\Migrator::executeSql', function ($event) use ($eventSource, $l) {
if ($event instanceof GenericEvent) { if ($event instanceof GenericEvent) {
$eventSource->send('success', (string)$l->t('[%d / %d]: %s', [$event[0], $event[1], $event->getSubject()])); $eventSource->send('success', $l->t('[%d / %d]: %s', [$event[0], $event[1], $event->getSubject()]));
} }
}); });
$dispatcher->addListener('\OC\DB\Migrator::checkTable', function ($event) use ($eventSource, $l) { $dispatcher->addListener('\OC\DB\Migrator::checkTable', function ($event) use ($eventSource, $l) {
if ($event instanceof GenericEvent) { if ($event instanceof GenericEvent) {
$eventSource->send('success', (string)$l->t('[%d / %d]: Checking table %s', [$event[0], $event[1], $event->getSubject()])); $eventSource->send('success', $l->t('[%d / %d]: Checking table %s', [$event[0], $event[1], $event->getSubject()]));
} }
}); });
$feedBack = new FeedBackHandler($eventSource, $l); $feedBack = new FeedBackHandler($eventSource, $l);
@ -148,46 +148,46 @@ if (\OCP\Util::needUpgrade()) {
$dispatcher->addListener('\OC\Repair::error', [$feedBack, 'handleRepairFeedback']); $dispatcher->addListener('\OC\Repair::error', [$feedBack, 'handleRepairFeedback']);
$updater->listen('\OC\Updater', 'maintenanceEnabled', function () use ($eventSource, $l) { $updater->listen('\OC\Updater', 'maintenanceEnabled', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Turned on maintenance mode')); $eventSource->send('success', $l->t('Turned on maintenance mode'));
}); });
$updater->listen('\OC\Updater', 'maintenanceDisabled', function () use ($eventSource, $l) { $updater->listen('\OC\Updater', 'maintenanceDisabled', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Turned off maintenance mode')); $eventSource->send('success', $l->t('Turned off maintenance mode'));
}); });
$updater->listen('\OC\Updater', 'maintenanceActive', function () use ($eventSource, $l) { $updater->listen('\OC\Updater', 'maintenanceActive', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Maintenance mode is kept active')); $eventSource->send('success', $l->t('Maintenance mode is kept active'));
}); });
$updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use ($eventSource, $l) { $updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Updating database schema')); $eventSource->send('success', $l->t('Updating database schema'));
}); });
$updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) { $updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Updated database')); $eventSource->send('success', $l->t('Updated database'));
}); });
$updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use ($eventSource, $l) { $updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Checking whether the database schema can be updated (this can take a long time depending on the database size)')); $eventSource->send('success', $l->t('Checking whether the database schema can be updated (this can take a long time depending on the database size)'));
}); });
$updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use ($eventSource, $l) { $updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Checked database schema update')); $eventSource->send('success', $l->t('Checked database schema update'));
}); });
$updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($eventSource, $l) { $updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Checking updates of apps')); $eventSource->send('success', $l->t('Checking updates of apps'));
}); });
$updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use ($eventSource, $l) { $updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Checking for update of app "%s" in appstore', [$app])); $eventSource->send('success', $l->t('Checking for update of app "%s" in appstore', [$app]));
}); });
$updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use ($eventSource, $l) { $updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Update app "%s" from appstore', [$app])); $eventSource->send('success', $l->t('Update app "%s" from appstore', [$app]));
}); });
$updater->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use ($eventSource, $l) { $updater->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Checked for update of app "%s" in appstore', [$app])); $eventSource->send('success', $l->t('Checked for update of app "%s" in appstore', [$app]));
}); });
$updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($eventSource, $l) { $updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Checking whether the database schema for %s can be updated (this can take a long time depending on the database size)', [$app])); $eventSource->send('success', $l->t('Checking whether the database schema for %s can be updated (this can take a long time depending on the database size)', [$app]));
}); });
$updater->listen('\OC\Updater', 'appUpgradeCheck', function () use ($eventSource, $l) { $updater->listen('\OC\Updater', 'appUpgradeCheck', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Checked database schema update for apps')); $eventSource->send('success', $l->t('Checked database schema update for apps'));
}); });
$updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($eventSource, $l) { $updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Updated "%1$s" to %2$s', [$app, $version])); $eventSource->send('success', $l->t('Updated "%1$s" to %2$s', [$app, $version]));
}); });
$updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use (&$incompatibleApps) { $updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use (&$incompatibleApps) {
$incompatibleApps[] = $app; $incompatibleApps[] = $app;
@ -198,16 +198,16 @@ if (\OCP\Util::needUpgrade()) {
$config->setSystemValue('maintenance', false); $config->setSystemValue('maintenance', false);
}); });
$updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l) { $updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Set log level to debug')); $eventSource->send('success', $l->t('Set log level to debug'));
}); });
$updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l) { $updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Reset log level')); $eventSource->send('success', $l->t('Reset log level'));
}); });
$updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use ($eventSource, $l) { $updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Starting code integrity check')); $eventSource->send('success', $l->t('Starting code integrity check'));
}); });
$updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use ($eventSource, $l) { $updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use ($eventSource, $l) {
$eventSource->send('success', (string)$l->t('Finished code integrity check')); $eventSource->send('success', $l->t('Finished code integrity check'));
}); });
try { try {
@ -224,15 +224,14 @@ if (\OCP\Util::needUpgrade()) {
$disabledApps = []; $disabledApps = [];
foreach ($incompatibleApps as $app) { foreach ($incompatibleApps as $app) {
$disabledApps[$app] = (string) $l->t('%s (incompatible)', [$app]); $disabledApps[$app] = $l->t('%s (incompatible)', [$app]);
} }
if (!empty($disabledApps)) { if (!empty($disabledApps)) {
$eventSource->send('notice', $eventSource->send('notice', $l->t('The following apps have been disabled: %s', [implode(', ', $disabledApps)]));
(string)$l->t('The following apps have been disabled: %s', [implode(', ', $disabledApps)]));
} }
} else { } else {
$eventSource->send('notice', (string)$l->t('Already up to date')); $eventSource->send('notice', $l->t('Already up to date'));
} }
$eventSource->send('done', ''); $eventSource->send('done', '');

View File

@ -29,7 +29,7 @@ class EducationBundle extends Bundle {
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getName() { public function getName() {
return (string)$this->l10n->t('Education Edition'); return $this->l10n->t('Education Edition');
} }
/** /**

View File

@ -30,7 +30,7 @@ class GroupwareBundle extends Bundle {
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getName() { public function getName() {
return (string)$this->l10n->t('Groupware bundle'); return $this->l10n->t('Groupware bundle');
} }
/** /**

View File

@ -29,7 +29,7 @@ class SocialSharingBundle extends Bundle {
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getName() { public function getName() {
return (string)$this->l10n->t('Social sharing bundle'); return $this->l10n->t('Social sharing bundle');
} }
/** /**

View File

@ -158,19 +158,19 @@ class DependencyAnalyzer {
if (isset($dependencies['php']['@attributes']['min-version'])) { if (isset($dependencies['php']['@attributes']['min-version'])) {
$minVersion = $dependencies['php']['@attributes']['min-version']; $minVersion = $dependencies['php']['@attributes']['min-version'];
if ($this->compareSmaller($this->platform->getPhpVersion(), $minVersion)) { if ($this->compareSmaller($this->platform->getPhpVersion(), $minVersion)) {
$missing[] = (string)$this->l->t('PHP %s or higher is required.', [$minVersion]); $missing[] = $this->l->t('PHP %s or higher is required.', [$minVersion]);
} }
} }
if (isset($dependencies['php']['@attributes']['max-version'])) { if (isset($dependencies['php']['@attributes']['max-version'])) {
$maxVersion = $dependencies['php']['@attributes']['max-version']; $maxVersion = $dependencies['php']['@attributes']['max-version'];
if ($this->compareBigger($this->platform->getPhpVersion(), $maxVersion)) { if ($this->compareBigger($this->platform->getPhpVersion(), $maxVersion)) {
$missing[] = (string)$this->l->t('PHP with a version lower than %s is required.', [$maxVersion]); $missing[] = $this->l->t('PHP with a version lower than %s is required.', [$maxVersion]);
} }
} }
if (isset($dependencies['php']['@attributes']['min-int-size'])) { if (isset($dependencies['php']['@attributes']['min-int-size'])) {
$intSize = $dependencies['php']['@attributes']['min-int-size']; $intSize = $dependencies['php']['@attributes']['min-int-size'];
if ($intSize > $this->platform->getIntSize() * 8) { if ($intSize > $this->platform->getIntSize() * 8) {
$missing[] = (string)$this->l->t('%sbit or higher PHP required.', [$intSize]); $missing[] = $this->l->t('%sbit or higher PHP required.', [$intSize]);
} }
} }
return $missing; return $missing;
@ -194,7 +194,7 @@ class DependencyAnalyzer {
}, $supportedArchitectures); }, $supportedArchitectures);
$currentArchitecture = $this->platform->getArchitecture(); $currentArchitecture = $this->platform->getArchitecture();
if (!in_array($currentArchitecture, $supportedArchitectures, true)) { if (!in_array($currentArchitecture, $supportedArchitectures, true)) {
$missing[] = (string)$this->l->t('The following architectures are supported: %s', [implode(', ', $supportedArchitectures)]); $missing[] = $this->l->t('The following architectures are supported: %s', [implode(', ', $supportedArchitectures)]);
} }
return $missing; return $missing;
} }
@ -221,7 +221,7 @@ class DependencyAnalyzer {
}, $supportedDatabases); }, $supportedDatabases);
$currentDatabase = $this->platform->getDatabase(); $currentDatabase = $this->platform->getDatabase();
if (!in_array($currentDatabase, $supportedDatabases)) { if (!in_array($currentDatabase, $supportedDatabases)) {
$missing[] = (string)$this->l->t('The following databases are supported: %s', [implode(', ', $supportedDatabases)]); $missing[] = $this->l->t('The following databases are supported: %s', [implode(', ', $supportedDatabases)]);
} }
return $missing; return $missing;
} }
@ -250,7 +250,7 @@ class DependencyAnalyzer {
} }
$commandName = $this->getValue($command); $commandName = $this->getValue($command);
if (!$this->platform->isCommandKnown($commandName)) { if (!$this->platform->isCommandKnown($commandName)) {
$missing[] = (string)$this->l->t('The command line tool %s could not be found', [$commandName]); $missing[] = $this->l->t('The command line tool %s could not be found', [$commandName]);
} }
} }
return $missing; return $missing;
@ -324,7 +324,7 @@ class DependencyAnalyzer {
} }
$currentOS = $this->platform->getOS(); $currentOS = $this->platform->getOS();
if (!in_array($currentOS, $oss)) { if (!in_array($currentOS, $oss)) {
$missing[] = (string)$this->l->t('The following platforms are supported: %s', [implode(', ', $oss)]); $missing[] = $this->l->t('The following platforms are supported: %s', [implode(', ', $oss)]);
} }
return $missing; return $missing;
} }
@ -350,12 +350,12 @@ class DependencyAnalyzer {
if (!is_null($minVersion)) { if (!is_null($minVersion)) {
if ($this->compareSmaller($this->platform->getOcVersion(), $minVersion)) { if ($this->compareSmaller($this->platform->getOcVersion(), $minVersion)) {
$missing[] = (string)$this->l->t('Server version %s or higher is required.', [$this->toVisibleVersion($minVersion)]); $missing[] = $this->l->t('Server version %s or higher is required.', [$this->toVisibleVersion($minVersion)]);
} }
} }
if (!$ignoreMax && !is_null($maxVersion)) { if (!$ignoreMax && !is_null($maxVersion)) {
if ($this->compareBigger($this->platform->getOcVersion(), $maxVersion)) { if ($this->compareBigger($this->platform->getOcVersion(), $maxVersion)) {
$missing[] = (string)$this->l->t('Server version %s or lower is required.', [$this->toVisibleVersion($maxVersion)]); $missing[] = $this->l->t('Server version %s or lower is required.', [$this->toVisibleVersion($maxVersion)]);
} }
} }
return $missing; return $missing;

View File

@ -133,7 +133,7 @@ class Dispatcher {
if ($numBuilt > 50) { if ($numBuilt > 50) {
$this->logger->debug('Controller {class}::{method} created {count} QueryBuilder objects, please check if they are created inside a loop by accident.' , [ $this->logger->debug('Controller {class}::{method} created {count} QueryBuilder objects, please check if they are created inside a loop by accident.' , [
'class' => (string) get_class($controller), 'class' => get_class($controller),
'method' => $methodName, 'method' => $methodName,
'count' => $numBuilt, 'count' => $numBuilt,
]); ]);
@ -141,7 +141,7 @@ class Dispatcher {
if ($numExecuted > 100) { if ($numExecuted > 100) {
$this->logger->warning('Controller {class}::{method} executed {count} queries.' , [ $this->logger->warning('Controller {class}::{method} executed {count} queries.' , [
'class' => (string) get_class($controller), 'class' => get_class($controller),
'method' => $methodName, 'method' => $methodName,
'count' => $numExecuted, 'count' => $numExecuted,
]); ]);

View File

@ -231,7 +231,7 @@ class RouteConfig {
$controllerName = $this->buildControllerName($controller); $controllerName = $this->buildControllerName($controller);
$actionName = $this->buildActionName($method); $actionName = $this->buildActionName($method);
$routeName = $routeNamePrefix . $this->appName . '.' . strtolower($resource) . '.' . strtolower($method); $routeName = $routeNamePrefix . $this->appName . '.' . strtolower($resource) . '.' . $method;
$route = $this->router->create($routeName, $url) $route = $this->router->create($routeName, $url)
->method($verb); ->method($verb);

View File

@ -100,7 +100,7 @@ class Search implements ISearch {
$searchResult->unsetResult($emailType); $searchResult->unsetResult($emailType);
} }
return [$searchResult->asArray(), (bool)$hasMoreResults]; return [$searchResult->asArray(), $hasMoreResults];
} }
public function registerPlugin(array $pluginInfo) { public function registerPlugin(array $pluginInfo) {

View File

@ -243,7 +243,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
if (\OCP\Util::isSharingDisabledForUser() || ($this->isShared() && !\OC\Share\Share::isResharingAllowed())) { if (\OCP\Util::isSharingDisabledForUser() || ($this->isShared() && !\OC\Share\Share::isResharingAllowed())) {
$perms = $perms & ~\OCP\Constants::PERMISSION_SHARE; $perms = $perms & ~\OCP\Constants::PERMISSION_SHARE;
} }
return (int) $perms; return $perms;
} }
/** /**

View File

@ -61,7 +61,7 @@ class Encoding extends Wrapper {
* @return bool true if the string is all ASCII, false otherwise * @return bool true if the string is all ASCII, false otherwise
*/ */
private function isAscii($str) { private function isAscii($str) {
return (bool) !preg_match('/[\\x80-\\xff]+/', $str); return !preg_match('/[\\x80-\\xff]+/', $str);
} }
/** /**

View File

@ -123,7 +123,7 @@ class Factory implements IFactory {
return new LazyL10N(function () use ($app, $lang, $locale) { return new LazyL10N(function () use ($app, $lang, $locale) {
$app = \OC_App::cleanAppId($app); $app = \OC_App::cleanAppId($app);
if ($lang !== null) { if ($lang !== null) {
$lang = str_replace(['\0', '/', '\\', '..'], '', (string)$lang); $lang = str_replace(['\0', '/', '\\', '..'], '', $lang);
} }
$forceLang = $this->config->getSystemValue('force_language', false); $forceLang = $this->config->getSystemValue('force_language', false);
@ -617,7 +617,7 @@ class Factory implements IFactory {
$forceLanguage = $this->config->getSystemValue('force_language', false); $forceLanguage = $this->config->getSystemValue('force_language', false);
if ($forceLanguage !== false) { if ($forceLanguage !== false) {
$l = $this->get('lib', $forceLanguage); $l = $this->get('lib', $forceLanguage);
$potentialName = (string) $l->t('__language_name__'); $potentialName = $l->t('__language_name__');
return [ return [
'commonlanguages' => [[ 'commonlanguages' => [[
@ -636,7 +636,7 @@ class Factory implements IFactory {
foreach ($languageCodes as $lang) { foreach ($languageCodes as $lang) {
$l = $this->get('lib', $lang); $l = $this->get('lib', $lang);
// TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version // TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version
$potentialName = (string) $l->t('__language_name__'); $potentialName = $l->t('__language_name__');
if ($l->getLanguageCode() === $lang && $potentialName[0] !== '_') {//first check if the language name is in the translation file if ($l->getLanguageCode() === $lang && $potentialName[0] !== '_') {//first check if the language name is in the translation file
$ln = [ $ln = [
'code' => $lang, 'code' => $lang,

View File

@ -206,7 +206,7 @@ class Notification implements INotification {
if ($id === '' || isset($id[64])) { if ($id === '' || isset($id[64])) {
throw new \InvalidArgumentException('The given object id is invalid'); throw new \InvalidArgumentException('The given object id is invalid');
} }
$this->objectId = (string) $id; $this->objectId = $id;
return $this; return $this;
} }

View File

@ -85,7 +85,7 @@ class TXT extends ProviderV2 {
foreach ($lines as $index => $line) { foreach ($lines as $index => $line) {
$index = $index + 1; $index = $index + 1;
$x = (int) 1; $x = 1;
$y = (int) ($index * $lineSize); $y = (int) ($index * $lineSize);
if ($canUseTTF === true) { if ($canUseTTF === true) {

View File

@ -58,7 +58,7 @@ class IpAddress {
$binary = \inet_pton($ip); $binary = \inet_pton($ip);
for ($i = 32; $i > $maskBits; $i -= 8) { for ($i = 32; $i > $maskBits; $i -= 8) {
$j = \intdiv($i, 8) - 1; $j = \intdiv($i, 8) - 1;
$k = (int) \min(8, $i - $maskBits); $k = \min(8, $i - $maskBits);
$mask = (0xff - ((2 ** $k) - 1)); $mask = (0xff - ((2 ** $k) - 1));
$int = \unpack('C', $binary[$j]); $int = \unpack('C', $binary[$j]);
$binary[$j] = \pack('C', $int[1] & $mask); $binary[$j] = \pack('C', $int[1] & $mask);
@ -84,7 +84,7 @@ class IpAddress {
$binary = \inet_pton($ip); $binary = \inet_pton($ip);
for ($i = 128; $i > $maskBits; $i -= 8) { for ($i = 128; $i > $maskBits; $i -= 8) {
$j = \intdiv($i, 8) - 1; $j = \intdiv($i, 8) - 1;
$k = (int) \min(8, $i - $maskBits); $k = \min(8, $i - $maskBits);
$mask = (0xff - ((2 ** $k) - 1)); $mask = (0xff - ((2 ** $k) - 1));
$int = \unpack('C', $binary[$j]); $int = \unpack('C', $binary[$j]);
$binary[$j] = \pack('C', $int[1] & $mask); $binary[$j] = \pack('C', $int[1] & $mask);

View File

@ -207,59 +207,59 @@ class JSConfigHelper {
'nc_lastLogin' => $lastConfirmTimestamp, 'nc_lastLogin' => $lastConfirmTimestamp,
'nc_pageLoad' => time(), 'nc_pageLoad' => time(),
"dayNames" => json_encode([ "dayNames" => json_encode([
(string)$this->l->t('Sunday'), $this->l->t('Sunday'),
(string)$this->l->t('Monday'), $this->l->t('Monday'),
(string)$this->l->t('Tuesday'), $this->l->t('Tuesday'),
(string)$this->l->t('Wednesday'), $this->l->t('Wednesday'),
(string)$this->l->t('Thursday'), $this->l->t('Thursday'),
(string)$this->l->t('Friday'), $this->l->t('Friday'),
(string)$this->l->t('Saturday') $this->l->t('Saturday')
]), ]),
"dayNamesShort" => json_encode([ "dayNamesShort" => json_encode([
(string)$this->l->t('Sun.'), $this->l->t('Sun.'),
(string)$this->l->t('Mon.'), $this->l->t('Mon.'),
(string)$this->l->t('Tue.'), $this->l->t('Tue.'),
(string)$this->l->t('Wed.'), $this->l->t('Wed.'),
(string)$this->l->t('Thu.'), $this->l->t('Thu.'),
(string)$this->l->t('Fri.'), $this->l->t('Fri.'),
(string)$this->l->t('Sat.') $this->l->t('Sat.')
]), ]),
"dayNamesMin" => json_encode([ "dayNamesMin" => json_encode([
(string)$this->l->t('Su'), $this->l->t('Su'),
(string)$this->l->t('Mo'), $this->l->t('Mo'),
(string)$this->l->t('Tu'), $this->l->t('Tu'),
(string)$this->l->t('We'), $this->l->t('We'),
(string)$this->l->t('Th'), $this->l->t('Th'),
(string)$this->l->t('Fr'), $this->l->t('Fr'),
(string)$this->l->t('Sa') $this->l->t('Sa')
]), ]),
"monthNames" => json_encode([ "monthNames" => json_encode([
(string)$this->l->t('January'), $this->l->t('January'),
(string)$this->l->t('February'), $this->l->t('February'),
(string)$this->l->t('March'), $this->l->t('March'),
(string)$this->l->t('April'), $this->l->t('April'),
(string)$this->l->t('May'), $this->l->t('May'),
(string)$this->l->t('June'), $this->l->t('June'),
(string)$this->l->t('July'), $this->l->t('July'),
(string)$this->l->t('August'), $this->l->t('August'),
(string)$this->l->t('September'), $this->l->t('September'),
(string)$this->l->t('October'), $this->l->t('October'),
(string)$this->l->t('November'), $this->l->t('November'),
(string)$this->l->t('December') $this->l->t('December')
]), ]),
"monthNamesShort" => json_encode([ "monthNamesShort" => json_encode([
(string)$this->l->t('Jan.'), $this->l->t('Jan.'),
(string)$this->l->t('Feb.'), $this->l->t('Feb.'),
(string)$this->l->t('Mar.'), $this->l->t('Mar.'),
(string)$this->l->t('Apr.'), $this->l->t('Apr.'),
(string)$this->l->t('May.'), $this->l->t('May.'),
(string)$this->l->t('Jun.'), $this->l->t('Jun.'),
(string)$this->l->t('Jul.'), $this->l->t('Jul.'),
(string)$this->l->t('Aug.'), $this->l->t('Aug.'),
(string)$this->l->t('Sep.'), $this->l->t('Sep.'),
(string)$this->l->t('Oct.'), $this->l->t('Oct.'),
(string)$this->l->t('Nov.'), $this->l->t('Nov.'),
(string)$this->l->t('Dec.') $this->l->t('Dec.')
]), ]),
"firstDay" => json_encode($this->l->l('firstday', null)), "firstDay" => json_encode($this->l->l('firstday', null)),
"_oc_config" => json_encode($config), "_oc_config" => json_encode($config),