Browse Source

Fix psalm spotted errors with new requirements

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
tags/v26.0.0beta1
Côme Chilliet 1 year ago
parent
commit
a372564850
No account linked to committer's email address

+ 2
- 2
apps/dav/lib/Connector/Sabre/File.php View File

if ($result === false) { if ($result === false) {
$expected = -1; $expected = -1;
if (isset($_SERVER['CONTENT_LENGTH'])) { if (isset($_SERVER['CONTENT_LENGTH'])) {
$expected = $_SERVER['CONTENT_LENGTH'];
$expected = (int)$_SERVER['CONTENT_LENGTH'];
} }
if ($expected !== "0") {
if ($expected !== 0) {
throw new Exception( throw new Exception(
$this->l10n->t( $this->l10n->t(
'Error while copying file to target location (copied: %1$s, expected filesize: %2$s)', 'Error while copying file to target location (copied: %1$s, expected filesize: %2$s)',

+ 9
- 12
apps/dav/lib/Provisioning/Apple/AppleProvisioningPlugin.php View File

use Sabre\HTTP\ResponseInterface; use Sabre\HTTP\ResponseInterface;


class AppleProvisioningPlugin extends ServerPlugin { class AppleProvisioningPlugin extends ServerPlugin {

/** /**
* @var Server * @var Server
*/ */
protected $l10n; protected $l10n;


/** /**
* @var \closure
* @var \Closure
*/ */
protected $uuidClosure; protected $uuidClosure;


/** /**
* AppleProvisioningPlugin constructor. * AppleProvisioningPlugin constructor.
*
* @param IUserSession $userSession
* @param IURLGenerator $urlGenerator
* @param \OC_Defaults $themingDefaults
* @param IRequest $request
* @param IL10N $l10n
* @param \closure $uuidClosure
*/ */
public function __construct(IUserSession $userSession, IURLGenerator $urlGenerator,
\OC_Defaults $themingDefaults, IRequest $request,
IL10N $l10n, \closure $uuidClosure) {
public function __construct(
IUserSession $userSession,
IURLGenerator $urlGenerator,
\OC_Defaults $themingDefaults,
IRequest $request,
IL10N $l10n,
\Closure $uuidClosure
) {
$this->userSession = $userSession; $this->userSession = $userSession;
$this->urlGenerator = $urlGenerator; $this->urlGenerator = $urlGenerator;
$this->themingDefaults = $themingDefaults; $this->themingDefaults = $themingDefaults;

+ 4
- 0
apps/user_ldap/ajax/wizard.php View File

\OC_JSON::error(['message' => $l->t('No data specified')]); \OC_JSON::error(['message' => $l->t('No data specified')]);
exit; exit;
} }
if (is_array($key)) {
\OC_JSON::error(['message' => $l->t('Invalid data specified')]);
exit;
}
$cfg = [$key => $val]; $cfg = [$key => $val];
$setParameters = []; $setParameters = [];
$configuration->setConfiguration($cfg, $setParameters); $configuration->setConfiguration($cfg, $setParameters);

+ 2
- 7
apps/user_ldap/lib/Mapping/AbstractMapping.php View File

namespace OCA\User_LDAP\Mapping; namespace OCA\User_LDAP\Mapping;


use Doctrine\DBAL\Exception; use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use OCP\DB\IPreparedStatement; use OCP\DB\IPreparedStatement;
use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder;
use Doctrine\DBAL\Platforms\SqlitePlatform;


/** /**
* Class AbstractMapping * Class AbstractMapping
* Get the hash to store in database column ldap_dn_hash for a given dn * Get the hash to store in database column ldap_dn_hash for a given dn
*/ */
protected function getDNHash(string $fdn): string { protected function getDNHash(string $fdn): string {
$hash = hash('sha256', $fdn, false);
if (is_string($hash)) {
return $hash;
} else {
throw new \RuntimeException('hash function did not return a string');
}
return hash('sha256', $fdn, false);
} }


/** /**

+ 9
- 9
apps/weather_status/lib/Service/WeatherStatusService.php View File

*/ */
namespace OCA\WeatherStatus\Service; namespace OCA\WeatherStatus\Service;


use OCP\IConfig;
use OCP\IL10N;
use OCP\App\IAppManager;
use OCA\WeatherStatus\AppInfo\Application;
use OCP\Accounts\IAccountManager; use OCP\Accounts\IAccountManager;
use OCP\Accounts\PropertyDoesNotExistException; use OCP\Accounts\PropertyDoesNotExistException;
use OCP\IUserManager;
use OCP\Http\Client\IClientService;
use OCP\App\IAppManager;
use OCP\Http\Client\IClient; use OCP\Http\Client\IClient;
use OCP\ICacheFactory;
use OCP\Http\Client\IClientService;
use OCP\ICache; use OCP\ICache;
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IL10N;
use OCP\ILogger; use OCP\ILogger;


use OCA\WeatherStatus\AppInfo\Application;
use OCP\IUserManager;


/** /**
* Class WeatherStatusService * Class WeatherStatusService
$cacheDuration = 60 * 60; $cacheDuration = 60 * 60;
if (isset($headers['Expires']) && count($headers['Expires']) > 0) { if (isset($headers['Expires']) && count($headers['Expires']) > 0) {
// if the Expires response header is set, use it to define cache duration // if the Expires response header is set, use it to define cache duration
$expireTs = (new \Datetime($headers['Expires'][0]))->getTimestamp();
$nowTs = (new \Datetime())->getTimestamp();
$expireTs = (new \DateTime($headers['Expires'][0]))->getTimestamp();
$nowTs = (new \DateTime())->getTimestamp();
$duration = $expireTs - $nowTs; $duration = $expireTs - $nowTs;
if ($duration > $cacheDuration) { if ($duration > $cacheDuration) {
$cacheDuration = $duration; $cacheDuration = $duration;

+ 1
- 1
lib/private/Files/Storage/Wrapper/EncodingDirectoryWrapper.php View File

*/ */
class EncodingDirectoryWrapper extends DirectoryWrapper { class EncodingDirectoryWrapper extends DirectoryWrapper {
/** /**
* @return string
* @return string|false
*/ */
public function dir_readdir() { public function dir_readdir() {
$file = readdir($this->source); $file = readdir($this->source);

+ 2
- 3
lib/private/KnownUser/KnownUserMapper.php View File

* @method KnownUser mapRowToEntity(array $row) * @method KnownUser mapRowToEntity(array $row)
*/ */
class KnownUserMapper extends QBMapper { class KnownUserMapper extends QBMapper {

/** /**
* @param IDBConnection $db * @param IDBConnection $db
*/ */
$query->delete($this->getTableName()) $query->delete($this->getTableName())
->where($query->expr()->eq('known_to', $query->createNamedParameter($knownTo))); ->where($query->expr()->eq('known_to', $query->createNamedParameter($knownTo)));


return (int) $query->execute();
return $query->executeStatement();
} }


/** /**
$query->delete($this->getTableName()) $query->delete($this->getTableName())
->where($query->expr()->eq('known_user', $query->createNamedParameter($knownUser))); ->where($query->expr()->eq('known_user', $query->createNamedParameter($knownUser)));


return (int) $query->execute();
return $query->executeStatement();
} }


/** /**

+ 1
- 1
lib/private/LargeFileHelper.php View File

/** /**
* @brief Checks whether our assumptions hold on the PHP platform we are on. * @brief Checks whether our assumptions hold on the PHP platform we are on.
* *
* @throws \RunTimeException if our assumptions do not hold on the current
* @throws \RuntimeException if our assumptions do not hold on the current
* PHP platform. * PHP platform.
*/ */
public function __construct() { public function __construct() {

+ 1
- 1
lib/private/Preview/Office.php View File

[$dirname, , , $filename] = array_values(pathinfo($absPath)); [$dirname, , , $filename] = array_values(pathinfo($absPath));
$pngPreview = $tmpDir . '/' . $filename . '.png'; $pngPreview = $tmpDir . '/' . $filename . '.png';


$png = new \imagick($pngPreview . '[0]');
$png = new \Imagick($pngPreview . '[0]');
$png->setImageFormat('jpg'); $png->setImageFormat('jpg');
} catch (\Exception $e) { } catch (\Exception $e) {
$this->cleanTmpFiles(); $this->cleanTmpFiles();

Loading…
Cancel
Save