php-cs: add more rules
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/877/head
parent
03c55a8d67
commit
465c5f2597
|
@ -25,10 +25,17 @@ $config
|
||||||
->setRules([
|
->setRules([
|
||||||
'@PhpCsFixer' => true,
|
'@PhpCsFixer' => true,
|
||||||
'@PhpCsFixer:risky' => true,
|
'@PhpCsFixer:risky' => true,
|
||||||
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'parameters', 'arguments']],
|
|
||||||
'general_phpdoc_annotation_remove' => ['annotations' => ['expectedDeprecation']], // one should use PHPUnit built-in method instead
|
'general_phpdoc_annotation_remove' => ['annotations' => ['expectedDeprecation']], // one should use PHPUnit built-in method instead
|
||||||
'modernize_strpos' => false, // needs PHP 8+ or polyfill
|
|
||||||
'phpdoc_to_comment' => ['ignored_tags' => ['psalm-suppress', 'template-implements']],
|
'phpdoc_to_comment' => ['ignored_tags' => ['psalm-suppress', 'template-implements']],
|
||||||
|
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'parameters', 'arguments']],
|
||||||
|
'modernize_strpos' => true,
|
||||||
|
'no_alias_functions' => true,
|
||||||
|
'array_syntax' => ['syntax' => 'short'],
|
||||||
|
'ternary_to_elvis_operator' => true,
|
||||||
|
'ternary_to_null_coalescing' => true,
|
||||||
|
'return_assignment' => true,
|
||||||
|
'declare_strict_types' => true,
|
||||||
|
'strict_param' => true,
|
||||||
])
|
])
|
||||||
->setFinder($finder)
|
->setFinder($finder)
|
||||||
;
|
;
|
||||||
|
|
|
@ -64,7 +64,7 @@ class AdminController extends GenericApiController
|
||||||
Util::setSystemConfig($key, $value);
|
Util::setSystemConfig($key, $value);
|
||||||
|
|
||||||
// If changing vod settings, kill any running go-vod instances
|
// If changing vod settings, kill any running go-vod instances
|
||||||
if (0 === strpos($key, 'memories.vod.')) {
|
if (str_starts_with($key, 'memories.vod.')) {
|
||||||
try {
|
try {
|
||||||
BinExt::startGoVod();
|
BinExt::startGoVod();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace OCA\Memories\Controller;
|
namespace OCA\Memories\Controller;
|
||||||
|
|
||||||
use OCA\Memories\Db\TimelineRoot;
|
use OCA\Memories\Db\TimelineRoot;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace OCA\Memories\Controller;
|
namespace OCA\Memories\Controller;
|
||||||
|
|
||||||
use OCA\Files\Event\LoadSidebar;
|
use OCA\Files\Event\LoadSidebar;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace OCA\Memories\Controller;
|
namespace OCA\Memories\Controller;
|
||||||
|
|
||||||
use OCA\Memories\AppInfo\Application;
|
use OCA\Memories\AppInfo\Application;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace OCA\Memories\Controller;
|
namespace OCA\Memories\Controller;
|
||||||
|
|
||||||
use OCA\Memories\AppInfo\Application;
|
use OCA\Memories\AppInfo\Application;
|
||||||
|
@ -185,7 +187,7 @@ class PublicController extends AuthPublicShareController
|
||||||
$foldersPath = Util::sanitizePath('/'.$foldersPath.'/');
|
$foldersPath = Util::sanitizePath('/'.$foldersPath.'/');
|
||||||
|
|
||||||
// Check if relPath starts with foldersPath
|
// Check if relPath starts with foldersPath
|
||||||
if (0 !== strpos($relPath, $foldersPath)) {
|
if (!str_starts_with($relPath, $foldersPath)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ class VideoController extends GenericApiController
|
||||||
|
|
||||||
// Check if file starts with temp dir
|
// Check if file starts with temp dir
|
||||||
$tmpDir = sys_get_temp_dir();
|
$tmpDir = sys_get_temp_dir();
|
||||||
if (0 === strpos($path, $tmpDir)) {
|
if (str_starts_with($path, $tmpDir)) {
|
||||||
throw Exceptions::Forbidden('files in temp directory not supported');
|
throw Exceptions::Forbidden('files in temp directory not supported');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace OCA\Memories\Cron;
|
namespace OCA\Memories\Cron;
|
||||||
|
|
||||||
use OCA\Memories\AppInfo\Application;
|
use OCA\Memories\AppInfo\Application;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace OCA\Memories\Db;
|
namespace OCA\Memories\Db;
|
||||||
|
|
||||||
use OC\DB\SchemaWrapper;
|
use OC\DB\SchemaWrapper;
|
||||||
|
|
|
@ -150,7 +150,7 @@ trait TimelineQueryDays
|
||||||
: self::CTE_FOLDERS(\array_key_exists('cteIncludeHidden', $params));
|
: self::CTE_FOLDERS(\array_key_exists('cteIncludeHidden', $params));
|
||||||
|
|
||||||
// Add WITH clause if needed
|
// Add WITH clause if needed
|
||||||
if (false !== strpos($sql, 'cte_folders')) {
|
if (str_contains($sql, 'cte_folders')) {
|
||||||
$sql = $CTE_SQL.' '.$sql;
|
$sql = $CTE_SQL.' '.$sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -323,7 +323,7 @@ class Exif
|
||||||
fclose($pipes[2]);
|
fclose($pipes[2]);
|
||||||
proc_terminate($proc);
|
proc_terminate($proc);
|
||||||
proc_close($proc);
|
proc_close($proc);
|
||||||
if (false !== strpos($stdout, 'error')) {
|
if (str_contains($stdout, 'error')) {
|
||||||
error_log("Exiftool error: {$stdout}");
|
error_log("Exiftool error: {$stdout}");
|
||||||
|
|
||||||
throw new \Exception('Could not set exif data: '.$stdout);
|
throw new \Exception('Could not set exif data: '.$stdout);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the list of fields that will be STORED in the databse as JSON.
|
* This is the list of fields that will be STORED in the databse as JSON.
|
||||||
* This is mostly only used for the metadata view.
|
* This is mostly only used for the metadata view.
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace OCA\Memories;
|
namespace OCA\Memories;
|
||||||
|
|
||||||
use OCP\AppFramework\Http;
|
use OCP\AppFramework\Http;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace OCA\Memories\Service;
|
namespace OCA\Memories\Service;
|
||||||
|
|
||||||
use OCA\Memories\Db\TimelineWrite;
|
use OCA\Memories\Db\TimelineWrite;
|
||||||
|
@ -36,7 +38,7 @@ class Places
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect database type
|
// Detect database type
|
||||||
$platform = strtolower(\get_class($this->connection->getDatabasePlatform()));
|
$platform = strtolower($this->connection->getDatabasePlatform()::class);
|
||||||
|
|
||||||
// Test MySQL-like support in databse
|
// Test MySQL-like support in databse
|
||||||
if (str_contains($platform, 'mysql') || str_contains($platform, 'mariadb')) {
|
if (str_contains($platform, 'mysql') || str_contains($platform, 'mariadb')) {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace OCA\Memories\Settings;
|
namespace OCA\Memories\Settings;
|
||||||
|
|
||||||
use OCA\Memories\AppInfo\Application;
|
use OCA\Memories\AppInfo\Application;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace OCA\Memories\Settings;
|
namespace OCA\Memories\Settings;
|
||||||
|
|
||||||
use OCP\AppFramework\Http\TemplateResponse;
|
use OCP\AppFramework\Http\TemplateResponse;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
// Path to exiftool binary
|
// Path to exiftool binary
|
||||||
'memories.exiftool' => '',
|
'memories.exiftool' => '',
|
||||||
|
|
|
@ -465,7 +465,7 @@ class Util
|
||||||
return 'gallery.memories' === $_SERVER['HTTP_X_REQUESTED_WITH'];
|
return 'gallery.memories' === $_SERVER['HTTP_X_REQUESTED_WITH'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return false !== strpos($_SERVER['HTTP_USER_AGENT'] ?? '', 'MemoriesNative');
|
return str_contains($_SERVER['HTTP_USER_AGENT'] ?? '', 'MemoriesNative');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue