Fix psalm spotted errors with new requirements

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/35943/head
Côme Chilliet 2 years ago
parent e4e20bf40a
commit a372564850
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A

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

@ -36,7 +36,6 @@ use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
class AppleProvisioningPlugin extends ServerPlugin {
/**
* @var Server
*/
@ -68,23 +67,21 @@ class AppleProvisioningPlugin extends ServerPlugin {
protected $l10n;
/**
* @var \closure
* @var \Closure
*/
protected $uuidClosure;
/**
* 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->urlGenerator = $urlGenerator;
$this->themingDefaults = $themingDefaults;

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

@ -27,9 +27,9 @@
namespace OCA\User_LDAP\Mapping;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use OCP\DB\IPreparedStatement;
use OCP\DB\QueryBuilder\IQueryBuilder;
use Doctrine\DBAL\Platforms\SqlitePlatform;
/**
* Class AbstractMapping
@ -191,12 +191,7 @@ abstract class AbstractMapping {
* Get the hash to store in database column ldap_dn_hash for a given dn
*/
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);
}
/**

@ -26,19 +26,19 @@ declare(strict_types=1);
*/
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\PropertyDoesNotExistException;
use OCP\IUserManager;
use OCP\Http\Client\IClientService;
use OCP\App\IAppManager;
use OCP\Http\Client\IClient;
use OCP\ICacheFactory;
use OCP\Http\Client\IClientService;
use OCP\ICache;
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IL10N;
use OCP\ILogger;
use OCA\WeatherStatus\AppInfo\Application;
use OCP\IUserManager;
/**
* Class WeatherStatusService
@ -426,8 +426,8 @@ class WeatherStatusService {
$cacheDuration = 60 * 60;
if (isset($headers['Expires']) && count($headers['Expires']) > 0) {
// 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;
if ($duration > $cacheDuration) {
$cacheDuration = $duration;

@ -31,7 +31,7 @@ use OC\Files\Filesystem;
*/
class EncodingDirectoryWrapper extends DirectoryWrapper {
/**
* @return string
* @return string|false
*/
public function dir_readdir() {
$file = readdir($this->source);

@ -32,7 +32,6 @@ use OCP\IDBConnection;
* @method KnownUser mapRowToEntity(array $row)
*/
class KnownUserMapper extends QBMapper {
/**
* @param IDBConnection $db
*/
@ -49,7 +48,7 @@ class KnownUserMapper extends QBMapper {
$query->delete($this->getTableName())
->where($query->expr()->eq('known_to', $query->createNamedParameter($knownTo)));
return (int) $query->execute();
return $query->executeStatement();
}
/**
@ -61,7 +60,7 @@ class KnownUserMapper extends QBMapper {
$query->delete($this->getTableName())
->where($query->expr()->eq('known_user', $query->createNamedParameter($knownUser)));
return (int) $query->execute();
return $query->executeStatement();
}
/**

@ -50,7 +50,7 @@ class LargeFileHelper {
/**
* @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.
*/
public function __construct() {

@ -71,7 +71,7 @@ abstract class Office extends ProviderV2 {
[$dirname, , , $filename] = array_values(pathinfo($absPath));
$pngPreview = $tmpDir . '/' . $filename . '.png';
$png = new \imagick($pngPreview . '[0]');
$png = new \Imagick($pngPreview . '[0]');
$png->setImageFormat('jpg');
} catch (\Exception $e) {
$this->cleanTmpFiles();

Loading…
Cancel
Save