Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Check style update
Signed-off-by: Carl Schwan <[email protected]>
  • Loading branch information
CarlSchwan committed Jan 12, 2022
commit 6312c0df6949955d1cd59c3dd444268e0773293c
2 changes: 1 addition & 1 deletion build/integration/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ public function userUploadsChunkedFiles($user, $name1, $content1, $name2, $conte
$body .= $content3."\r\n";
$body .= '--'.$boundary."--\r\n";

$stream = fopen('php://temp','r+');
$stream = fopen('php://temp', 'r+');
fwrite($stream, $body);
rewind($stream);

Expand Down
2 changes: 1 addition & 1 deletion core/Command/Config/System/GetConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function configure() {
* @param OutputInterface $output An OutputInterface instance
* @return int 0 if everything went fine, or an error code
*/
protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$configNames = $input->getArgument('name');
$configName = array_shift($configNames);
$defaultValue = $input->getOption('default-value');
Expand Down
2 changes: 1 addition & 1 deletion core/Command/Db/Migrations/ExecuteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function execute(InputInterface $input, OutputInterface $output): int {
$olderVersions = $ms->getMigratedVersions();
$olderVersions[] = '0';
$olderVersions[] = 'prev';
if (in_array($version, $olderVersions, true)) {
if (in_array($version, $olderVersions, true)) {
$output->writeln('<error>Can not go back to previous migration without debug enabled</error>');
return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion core/Command/Db/Migrations/GenerateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function execute(InputInterface $input, OutputInterface $output): int {
$appName = $input->getArgument('app');
$version = $input->getArgument('version');

if (!preg_match('/^\d{1,16}$/',$version)) {
if (!preg_match('/^\d{1,16}$/', $version)) {
$output->writeln('<error>The given version is invalid. Only 0-9 are allowed (max. 16 digits)</error>');
return 1;
}
Expand Down
3 changes: 1 addition & 2 deletions core/Command/Upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,7 @@ function ($success) use ($output, $self) {
$output->write('<comment>Maybe an upgrade is already in process. Please check the '
. 'logfile (data/nextcloud.log). If you want to re-run the '
. 'upgrade procedure, remove the "maintenance mode" from '
. 'config.php and call this script again.</comment>'
, true);
. 'config.php and call this script again.</comment>', true);
return self::ERROR_MAINTENANCE_MODE;
} else {
$output->writeln('<info>Nextcloud is already latest version</info>');
Expand Down
2 changes: 1 addition & 1 deletion core/Command/User/Add.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$question = new Question('Confirm password: ');
$question->setHidden(true);
$confirm = $helper->ask($input, $output,$question);
$confirm = $helper->ask($input, $output, $question);

if ($password !== $confirm) {
$output->writeln("<error>Passwords did not match!</error>");
Expand Down
4 changes: 2 additions & 2 deletions core/Command/User/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return 1;
}

if ($app === 'settings' && in_array($key , ['email', 'display_name'])) {
if ($app === 'settings' && in_array($key, ['email', 'display_name'])) {
$user = $this->userManager->get($uid);
if ($user instanceof IUser) {
if ($key === 'email') {
Expand Down Expand Up @@ -208,7 +208,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return 1;
}

if ($app === 'settings' && in_array($key , ['email', 'display_name'])) {
if ($app === 'settings' && in_array($key, ['email', 'display_name'])) {
$user = $this->userManager->get($uid);
if ($user instanceof IUser) {
if ($key === 'email') {
Expand Down
2 changes: 1 addition & 1 deletion core/Migrations/Version15000Date20180926101451.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
$schema = $schemaClosure();

$table = $schema->getTable('authtoken');
$table->addColumn('password_invalid','boolean', [
$table->addColumn('password_invalid', 'boolean', [
'default' => 0,
'notnull' => false,
]);
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
* not return a webpage, so we only print the error page when html is accepted,
* otherwise we reply with a JSON array like the SecurityMiddleware would do.
*/
if (stripos($request->getHeader('Accept'),'html') === false) {
if (stripos($request->getHeader('Accept'), 'html') === false) {
http_response_code(401);
header('Content-Type: application/json; charset=utf-8');
echo json_encode(['message' => $ex->getMessage()]);
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Accounts/AccountManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ protected function writeUserDataProperties(IQueryBuilder $query, array $data): v
}

// the value col is limited to 255 bytes. It is used for searches only.
$value = $property['value'] ? Util::shortenMultibyteString($property['value'], 255) : '';
$value = $property['value'] ? Util::shortenMultibyteString($property['value'], 255) : '';

$query->setParameter('name', $property['name'])
->setParameter('value', $value);
Expand Down
4 changes: 2 additions & 2 deletions lib/private/AppFramework/Http/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ public function dispatch(Controller $controller, string $methodName): array {
$numExecuted = $databaseStatsAfter['executed'] - $databaseStatsBefore['executed'];

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' => get_class($controller),
'method' => $methodName,
'count' => $numBuilt,
]);
}

if ($numExecuted > 100) {
$this->logger->warning('Controller {class}::{method} executed {count} queries.' , [
$this->logger->warning('Controller {class}::{method} executed {count} queries.', [
'class' => get_class($controller),
'method' => $methodName,
'count' => $numExecuted,
Expand Down
2 changes: 1 addition & 1 deletion lib/private/AppFramework/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public function __unset($id) {
* @return string
*/
public function getHeader(string $name): string {
$name = strtoupper(str_replace('-', '_',$name));
$name = strtoupper(str_replace('-', '_', $name));
if (isset($this->server['HTTP_' . $name])) {
return $this->server['HTTP_' . $name];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function beforeController($controller, $methodName) {
*/
public function afterException($controller, $methodName, \Exception $exception) {
if ($exception instanceof RateLimitExceededException) {
if (stripos($this->request->getHeader('Accept'),'html') === false) {
if (stripos($this->request->getHeader('Accept'), 'html') === false) {
$response = new DataResponse([], $exception->getCode());
} else {
$response = new TemplateResponse(
Expand Down
4 changes: 2 additions & 2 deletions lib/private/BackgroundJob/JobList.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ public function setExecutionTime(IJob $job, $timeTaken) {
public function resetBackgroundJob(IJob $job): void {
$query = $this->connection->getQueryBuilder();
$query->update('jobs')
->set('last_run', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT))
->set('reserved_at', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT))
->set('last_run', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT))
->set('reserved_at', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT))
->where($query->expr()->eq('id', $query->createNamedParameter($job->getId()), IQueryBuilder::PARAM_INT));
$query->executeStatement();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/DB/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function insertIfNotExist($table, $input, array $compare = null) {
/**
* @throws \OCP\DB\Exception
*/
public function insertIgnoreConflict(string $table,array $values) : int {
public function insertIgnoreConflict(string $table, array $values) : int {
try {
$builder = $this->conn->getQueryBuilder();
$builder->insert($table);
Expand Down
2 changes: 1 addition & 1 deletion lib/private/DB/AdapterPgSql.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function fixupStatement($statement) {
return $statement;
}

public function insertIgnoreConflict(string $table,array $values) : int {
public function insertIgnoreConflict(string $table, array $values) : int {
if ($this->isPre9_5CompatMode() === true) {
return parent::insertIgnoreConflict($table, $values);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@ private function basicOperation($operation, $path, $hooks = [], $extraParam = nu
if ($result && in_array('delete', $hooks) and $result) {
$this->removeUpdate($storage, $internalPath);
}
if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') {
if ($result && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') {
$this->writeUpdate($storage, $internalPath);
}
if ($result && in_array('touch', $hooks)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Mail/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ protected function convertEmail(string $email): string {
}

[$name, $domain] = explode('@', $email, 2);
$domain = idn_to_ascii($domain, 0,INTL_IDNA_VARIANT_UTS46);
$domain = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46);
return $name.'@'.$domain;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/private/Memcache/Memcached.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function __construct($prefix = '') {
//\Memcached::OPT_BINARY_PROTOCOL => true,
];
// by default enable igbinary serializer if available
/** @psalm-suppress RedundantCondition */
/** @psalm-suppress RedundantCondition */
if (\Memcached::HAVE_IGBINARY) {
$defaultOptions[\Memcached::OPT_SERIALIZER] =
\Memcached::SERIALIZER_IGBINARY;
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Migration/BackgroundRepair.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ protected function run($argument) {
try {
$repair->addStep($step);
} catch (\Exception $ex) {
$this->logger->logException($ex,[
$this->logger->logException($ex, [
'app' => 'migration'
]);

Expand Down
4 changes: 2 additions & 2 deletions lib/private/Preview/MarkDown.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage {
return null;
}

$content = stream_get_contents($content,3000);
$content = stream_get_contents($content, 3000);

//don't create previews of empty text files
if (trim($content) === '') {
Expand Down Expand Up @@ -119,7 +119,7 @@ public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage {
// Get rid of markdown symbols that we still needed for the font size
$line = preg_replace('/^#*\s/', '', $line);

$wrappedText = wordwrap($line, $wordWrap,"\n");
$wrappedText = wordwrap($line, $wordWrap, "\n");
$linesWrapped = count(explode("\n", $wrappedText));
imagettftext($image, $actualFontSize, 0, $x, $y, $textColor, $actualFontSize === $fontSize ? $fontFile : $fontFileBold, $wrappedText);
$nextLineStart = (int)($linesWrapped * ceil($actualFontSize * 2));
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Preview/TXT.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage {
return null;
}

$content = stream_get_contents($content,3000);
$content = stream_get_contents($content, 3000);

//don't create previews of empty text files
if (trim($content) === '') {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Security/TrustedDomainHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function isTrustedDomain(string $domainWithPort): bool {
return true;
}
// Reject misformed domains in any case
if (strpos($domain,'-') === 0 || strpos($domain,'..') !== false) {
if (strpos($domain, '-') === 0 || strpos($domain, '..') !== false) {
return false;
}
// Match, allowing for * wildcards
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Setup/MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private function createDBUser($connection) {
$connection->executeUpdate($query);
}
} catch (\Exception $ex) {
$this->logger->error('Database user creation failed.',[
$this->logger->error('Database user creation failed.', [
'exception' => $ex,
'app' => 'mysql.setup',
]);
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Share/Share.php
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ private static function transformDBResults(&$row) {
* @param array $parameters additional format parameters
* @return array format result
*/
private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE , $parameters = null) {
private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE, $parameters = null) {
if ($format === self::FORMAT_NONE) {
return $items;
} elseif ($format === self::FORMAT_STATUSES) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Share20/DefaultShareProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ public function getSharesInFolder($userId, Folder $node, $reshares) {
);
}

$qb->innerJoin('s', 'filecache' ,'f', $qb->expr()->eq('s.file_source', 'f.fileid'));
$qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid'));
$qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId())));

$qb->orderBy('id');
Expand Down
2 changes: 1 addition & 1 deletion lib/private/URLGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function imagePath(string $appName, string $file): string {
$theme = \OC_Util::getTheme();

//if a theme has a png but not an svg always use the png
$basename = substr(basename($file),0,-4);
$basename = substr(basename($file), 0, -4);

$appPath = \OC_App::getAppPath($appName);

Expand Down
2 changes: 1 addition & 1 deletion lib/private/legacy/OC_DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class OC_DB {
*
* SQL query via Doctrine prepare(), needs to be execute()'d!
*/
public static function prepare($query , $limit = null, $offset = null, $isManipulation = null) {
public static function prepare($query, $limit = null, $offset = null, $isManipulation = null) {
$connection = \OC::$server->getDatabaseConnection();

if ($isManipulation === null) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/legacy/OC_DB_StatementWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __construct(IPreparedStatement $statement, $isManipulation) {
/**
* pass all other function directly to the \Doctrine\DBAL\Driver\Statement
*/
public function __call($name,$arguments) {
public function __call($name, $arguments) {
return call_user_func_array([$this->statement,$name], $arguments);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/public/IDBConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public function insertIfNotExist(string $table, array $input, array $compare = n
* @return int number of inserted rows
* @since 16.0.0
*/
public function insertIgnoreConflict(string $table,array $values) : int;
public function insertIgnoreConflict(string $table, array $values) : int;

/**
* Insert or update a row value
Expand Down
2 changes: 1 addition & 1 deletion ocs/providers.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

$writer = new XMLWriter();
$writer->openURI('php://output');
$writer->startDocument('1.0','UTF-8');
$writer->startDocument('1.0', 'UTF-8');
$writer->setIndent(true);
$writer->startElement('providers');
$writer->startElement('provider');
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/AppFramework/Db/QBMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ protected function setUp(): void {
->disableOriginalConstructor()
->getMock();

$this->qb = $this->getMockBuilder(IQueryBuilder:: class)
$this->qb = $this->getMockBuilder(IQueryBuilder::class)
->disableOriginalConstructor()
->getMock();

$this->expr = $this->getMockBuilder(IExpressionBuilder:: class)
$this->expr = $this->getMockBuilder(IExpressionBuilder::class)
->disableOriginalConstructor()
->getMock();

Expand Down
16 changes: 8 additions & 8 deletions tests/lib/AppFramework/Http/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ public function testInsecureServerHostServerNameHeader() {
$this->stream
);

$this->assertSame('from.server.name:8080', $request->getInsecureServerHost());
$this->assertSame('from.server.name:8080', $request->getInsecureServerHost());
}

public function testInsecureServerHostHttpHostHeader() {
Expand All @@ -1079,7 +1079,7 @@ public function testInsecureServerHostHttpHostHeader() {
$this->stream
);

$this->assertSame('from.host.header:8080', $request->getInsecureServerHost());
$this->assertSame('from.host.header:8080', $request->getInsecureServerHost());
}

public function testInsecureServerHostHttpFromForwardedHeaderSingle() {
Expand Down Expand Up @@ -1108,7 +1108,7 @@ public function testInsecureServerHostHttpFromForwardedHeaderSingle() {
$this->stream
);

$this->assertSame('from.forwarded.host:8080', $request->getInsecureServerHost());
$this->assertSame('from.forwarded.host:8080', $request->getInsecureServerHost());
}

public function testInsecureServerHostHttpFromForwardedHeaderStacked() {
Expand Down Expand Up @@ -1137,7 +1137,7 @@ public function testInsecureServerHostHttpFromForwardedHeaderStacked() {
$this->stream
);

$this->assertSame('from.forwarded.host2:8080', $request->getInsecureServerHost());
$this->assertSame('from.forwarded.host2:8080', $request->getInsecureServerHost());
}

public function testGetServerHostWithOverwriteHost() {
Expand All @@ -1161,7 +1161,7 @@ public function testGetServerHostWithOverwriteHost() {
$this->stream
);

$this->assertSame('my.overwritten.host', $request->getServerHost());
$this->assertSame('my.overwritten.host', $request->getServerHost());
}

public function testGetServerHostWithTrustedDomain() {
Expand Down Expand Up @@ -1190,7 +1190,7 @@ public function testGetServerHostWithTrustedDomain() {
$this->stream
);

$this->assertSame('my.trusted.host', $request->getServerHost());
$this->assertSame('my.trusted.host', $request->getServerHost());
}

public function testGetServerHostWithUntrustedDomain() {
Expand Down Expand Up @@ -1219,7 +1219,7 @@ public function testGetServerHostWithUntrustedDomain() {
$this->stream
);

$this->assertSame('my.trusted.host', $request->getServerHost());
$this->assertSame('my.trusted.host', $request->getServerHost());
}

public function testGetServerHostWithNoTrustedDomain() {
Expand All @@ -1245,7 +1245,7 @@ public function testGetServerHostWithNoTrustedDomain() {
$this->stream
);

$this->assertSame('', $request->getServerHost());
$this->assertSame('', $request->getServerHost());
}

/**
Expand Down
Loading