Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ildyria committed Jun 24, 2023
1 parent 281e956 commit c8011b9
Show file tree
Hide file tree
Showing 83 changed files with 311 additions and 317 deletions.
4 changes: 2 additions & 2 deletions app/Actions/Album/Archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ private function compressAlbum(AbstractAlbum $album, array &$usedDirNames, ?stri
// album_id === null shouldn't really be needed as all such photos
// in smart albums should be owned by the current user...
if (
($album instanceof BaseSmartAlbum || $album instanceof TagAlbum) &&
!Gate::check(PhotoPolicy::CAN_DOWNLOAD, $photo)
($album instanceof BaseSmartAlbum || $album instanceof TagAlbum)
&& !Gate::check(PhotoPolicy::CAN_DOWNLOAD, $photo)
) {
continue;
}
Expand Down
6 changes: 3 additions & 3 deletions app/Actions/Album/Unlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public function do(BaseAlbum $album, string $password): void
{
if ($album->is_public) {
if (
$album->password === null ||
$album->password === '' ||
$this->albumPolicy->isUnlocked($album)
$album->password === null
|| $album->password === ''
|| $this->albumPolicy->isUnlocked($album)
) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Actions/Diagnostics/Pipes/Checks/IniSettingsCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function handle(array &$data, \Closure $next): array
if (!extension_loaded('imagick')) {
// @codeCoverageIgnoreStart
$data[] = 'Warning: Pictures that are rotated lose their metadata! Please install Imagick to avoid that.';
// @codeCoverageIgnoreEnd
// @codeCoverageIgnoreEnd
} else {
if (!isset($settings['imagick'])) {
// @codeCoverageIgnoreStart
Expand Down
2 changes: 1 addition & 1 deletion app/Actions/Diagnostics/Pipes/Infos/ExtensionsInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function handle(array &$data, \Closure $next): array
if (!isset($imagickVersion, $imagickVersion['versionNumber'])) {
// @codeCoverageIgnoreStart
$imagickVersion = '-';
// @codeCoverageIgnoreEnd
// @codeCoverageIgnoreEnd
} else {
$imagickVersion = $imagickVersion['versionNumber'];
}
Expand Down
2 changes: 1 addition & 1 deletion app/Actions/Diagnostics/Pipes/Infos/VersionInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function handle(array &$data, \Closure $next): array
$fileVersion->hydrate(false, false);

$lycheeInfoString = $fileVersion->getVersion()->toString();
// @codeCoverageIgnoreEnd
// @codeCoverageIgnoreEnd
} else {
$gitHubFunctions = resolve(GitHubVersion::class);
$gitHubFunctions->hydrate();
Expand Down
18 changes: 9 additions & 9 deletions app/Actions/Import/Exec.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,15 @@ private static function normalizePath(string $path): string
//
// This way we could simply check if the path is anything below `vault`
if (
$realPath === Storage::path('big') ||
$realPath === Storage::path('raw') ||
$realPath === Storage::path('original') ||
$realPath === Storage::path('medium2x') ||
$realPath === Storage::path('medium') ||
$realPath === Storage::path('small2x') ||
$realPath === Storage::path('small') ||
$realPath === Storage::path('thumb2x') ||
$realPath === Storage::path('thumb')
$realPath === Storage::path('big')
|| $realPath === Storage::path('raw')
|| $realPath === Storage::path('original')
|| $realPath === Storage::path('medium2x')
|| $realPath === Storage::path('medium')
|| $realPath === Storage::path('small2x')
|| $realPath === Storage::path('small')
|| $realPath === Storage::path('thumb2x')
|| $realPath === Storage::path('thumb')
) {
throw new ReservedDirectoryException('The given path is a reserved path of Lychee (' . $path . ')');
}
Expand Down
4 changes: 2 additions & 2 deletions app/Actions/InstallUpdate/Pipes/ArtisanKeyGenerate.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public function handle(array &$output, \Closure $next): array

// Always false on CICD
if (
!str_contains(end($output), 'Application key set successfully') ||
config('app.key') === null
!str_contains(end($output), 'Application key set successfully')
|| config('app.key') === null
) {
// @codeCoverageIgnoreStart
$output[] = 'We could not generate the encryption key.';
Expand Down
2 changes: 1 addition & 1 deletion app/Actions/InstallUpdate/Pipes/ComposerCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function handle(array &$output, \Closure $next): array
chdir(base_path());
exec(sprintf('composer install %s--no-progress 2>&1', $noDev), $output);
chdir(base_path('public'));
// @codeCoverageIgnoreEnd
// @codeCoverageIgnoreEnd
} else {
$output[] = 'Composer update are always dangerous when automated.';
$output[] = 'So we did not execute it.';
Expand Down
2 changes: 1 addition & 1 deletion app/Actions/InstallUpdate/RequirementsChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function check(array $requirements): array
*
* @return array
*/
public function checkPHPVersion(?string $minPhpVersion = null): array
public function checkPHPVersion(string $minPhpVersion = null): array
{
$minVersionPhp = $minPhpVersion ?? self::MIN_PHP_VERSION;
$currentPhpVersion = self::getPhpVersionInfo();
Expand Down
12 changes: 6 additions & 6 deletions app/Actions/Photo/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function __construct(?ImportMode $importMode, int $intendedOwnerId)
* @throws ModelNotFoundException
* @throws LycheeException
*/
public function add(NativeLocalFile $sourceFile, ?AbstractAlbum $album = null): Photo
public function add(NativeLocalFile $sourceFile, AbstractAlbum $album = null): Photo
{
$sourceFile->assertIsSupportedMediaOrAcceptedRaw();

Expand Down Expand Up @@ -129,8 +129,8 @@ protected function loadFileMetadata(NativeLocalFile $sourceFile): void

// Use basename of file if IPTC title missing
if (
$this->strategyParameters->exifInfo->title === null ||
$this->strategyParameters->exifInfo->title === ''
$this->strategyParameters->exifInfo->title === null
|| $this->strategyParameters->exifInfo->title === ''
) {
$this->strategyParameters->exifInfo->title = substr($sourceFile->getOriginalBasename(), 0, 98);
}
Expand Down Expand Up @@ -173,8 +173,8 @@ protected function findLivePartner(
// different kind then the uploaded media.
if (
$livePartner !== null && !(
BaseMediaFile::isSupportedImageMimeType($mimeType) && $livePartner->isVideo() ||
BaseMediaFile::isSupportedVideoMimeType($mimeType) && $livePartner->isPhoto()
BaseMediaFile::isSupportedImageMimeType($mimeType) && $livePartner->isVideo()
|| BaseMediaFile::isSupportedVideoMimeType($mimeType) && $livePartner->isPhoto()
)
) {
$livePartner = null;
Expand All @@ -201,7 +201,7 @@ protected function findLivePartner(
*
* @throws InvalidPropertyException
*/
protected function initParentAlbum(?AbstractAlbum $album = null): void
protected function initParentAlbum(AbstractAlbum $album = null): void
{
if ($album === null) {
$this->strategyParameters->album = null;
Expand Down
6 changes: 3 additions & 3 deletions app/Actions/Photo/Strategies/AddStandaloneStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ private function putSourceIntoFinalDestination(FlysystemFile $targetFile): Strea
\Safe\symlink($sourcePath, $targetPath);
$streamStat = StreamStat::createFromLocalFile($this->sourceFile);
} else {
$shallNormalize = Configs::getValueAsBool('auto_fix_orientation') &&
$this->sourceImage !== null &&
$this->parameters->exifInfo->orientation !== 1;
$shallNormalize = Configs::getValueAsBool('auto_fix_orientation')
&& $this->sourceImage !== null
&& $this->parameters->exifInfo->orientation !== 1;

if ($shallNormalize) {
// Saving the loaded image to the final target normalizes
Expand Down
2 changes: 1 addition & 1 deletion app/Assets/ArrayToTextTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function __toString(): string
* @throws PcreException
* @throws MbstringException
*/
public function getTable(?array $rawData = null): string
public function getTable(array $rawData = null): string
{
if (!is_null($rawData)) {
$this->setData($rawData);
Expand Down
6 changes: 3 additions & 3 deletions app/Assets/BaseSizeVariantNamingStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ abstract class BaseSizeVariantNamingStrategy extends AbstractSizeVariantNamingSt
*/
protected function generateExtension(SizeVariantType $sizeVariant): string
{
if ($sizeVariant === SizeVariantType::THUMB ||
$sizeVariant === SizeVariantType::THUMB2X ||
($sizeVariant !== SizeVariantType::ORIGINAL && !$this->photo->isPhoto())
if ($sizeVariant === SizeVariantType::THUMB
|| $sizeVariant === SizeVariantType::THUMB2X
|| ($sizeVariant !== SizeVariantType::ORIGINAL && !$this->photo->isPhoto())
) {
return self::THUMB_EXTENSION;
}
Expand Down
6 changes: 3 additions & 3 deletions app/Assets/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ public function hasPermissions(string $path): bool
// Check if the given path is readable and writable
// Both functions are also verifying that the path exists
return
file_exists($path) &&
is_readable($path) &&
is_writeable($path);
file_exists($path)
&& is_readable($path)
&& is_writeable($path);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Casts/MustNotSetCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class MustNotSetCast implements CastsInboundAttributes
* the name of the alternative is included
* into the exception message
*/
public function __construct(?string $alternative = null)
public function __construct(string $alternative = null)
{
$this->alternative = $alternative;
}
Expand Down
42 changes: 21 additions & 21 deletions app/Console/Commands/ExifLens.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,57 +77,57 @@ public function handle(): int
$updated = true;
}
if (
($photo->iso === null || $photo->iso === '') &&
$info->iso !== null &&
$info->iso !== ''
($photo->iso === null || $photo->iso === '')
&& $info->iso !== null
&& $info->iso !== ''
) {
$photo->iso = $info->iso;
$updated = true;
}
if (
($photo->aperture === null || $photo->aperture === '') &&
$info->aperture !== null &&
$info->aperture !== ''
($photo->aperture === null || $photo->aperture === '')
&& $info->aperture !== null
&& $info->aperture !== ''
) {
$photo->aperture = $info->aperture;
$updated = true;
}
if (
($photo->make === null || $photo->make === '') &&
$info->make !== null &&
$info->make !== ''
($photo->make === null || $photo->make === '')
&& $info->make !== null
&& $info->make !== ''
) {
$photo->make = $info->make;
$updated = true;
}
if (
($photo->model === null || $photo->model === '') &&
$info->model !== null &&
$info->model !== ''
($photo->model === null || $photo->model === '')
&& $info->model !== null
&& $info->model !== ''
) {
$photo->model = $info->model;
$updated = true;
}
if (
($photo->lens === null || $photo->lens === '') &&
$info->lens !== null &&
$info->lens !== ''
($photo->lens === null || $photo->lens === '')
&& $info->lens !== null
&& $info->lens !== ''
) {
$photo->lens = $info->lens;
$updated = true;
}
if (
($photo->shutter === null || $photo->shutter === '') &&
$info->shutter !== null &&
$info->shutter !== ''
($photo->shutter === null || $photo->shutter === '')
&& $info->shutter !== null
&& $info->shutter !== ''
) {
$photo->shutter = $info->shutter;
$updated = true;
}
if (
($photo->focal === null || $photo->focal === '') &&
$info->focal !== null &&
$info->focal !== ''
($photo->focal === null || $photo->focal === '')
&& $info->focal !== null
&& $info->focal !== ''
) {
$photo->focal = $info->focal;
$updated = true;
Expand Down
12 changes: 6 additions & 6 deletions app/Console/Commands/Optimize.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ public function handle(): void
protected function isNonProductive(): bool
{
return
'production' !== $this->getLaravel()->environment() ||
true === config('app.debug', false) ||
true === config('debugbar.enabled', false) ||
file_exists(base_path('vendor/bin/phpunit')) ||
file_exists(base_path('vendor/bin/phpstan')) ||
file_exists(base_path('vendor/bin/phpstan.phar'));
'production' !== $this->getLaravel()->environment()
|| true === config('app.debug', false)
|| true === config('debugbar.enabled', false)
|| file_exists(base_path('vendor/bin/phpunit'))
|| file_exists(base_path('vendor/bin/phpstan'))
|| file_exists(base_path('vendor/bin/phpstan.phar'));
}
}
1 change: 0 additions & 1 deletion app/Console/Commands/Sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use App\Exceptions\UnexpectedException;
use App\Models\Album;
use App\Models\Configs;
use Exception;
use Illuminate\Console\Command;
use Symfony\Component\Console\Exception\ExceptionInterface as SymfonyConsoleException;

Expand Down
2 changes: 1 addition & 1 deletion app/Contracts/Models/SizeVariantFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface SizeVariantFactory
*
* @throws LycheeException
*/
public function init(Photo $photo, ?ImageHandlerInterface $referenceImage = null, ?AbstractSizeVariantNamingStrategy $namingStrategy = null): void;
public function init(Photo $photo, ImageHandlerInterface $referenceImage = null, AbstractSizeVariantNamingStrategy $namingStrategy = null): void;

/**
* Conditionally creates a size variant for the designated size variant.
Expand Down
2 changes: 1 addition & 1 deletion app/DTO/ImportEventReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ImportEventReport extends BaseImportReport
protected string $message;
protected ?\Throwable $throwable;

protected function __construct(string $subtype, SeverityType $severity, ?string $path, string $message, ?\Throwable $throwable = null)
protected function __construct(string $subtype, SeverityType $severity, ?string $path, string $message, \Throwable $throwable = null)
{
parent::__construct(self::REPORT_TYPE);
$this->subtype = $subtype;
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/BaseLycheeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ abstract class BaseLycheeException extends HttpException implements ExternalLych
* for a typical end-user)
* @param \Throwable|null $previous an optional previous exception
*/
protected function __construct(int $httpStatusCode, string $message, ?\Throwable $previous = null)
protected function __construct(int $httpStatusCode, string $message, \Throwable $previous = null)
{
$code = null;
if ($previous !== null) {
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/FileOperationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
class FileOperationException extends BaseLycheeException
{
public function __construct(string $msg, ?\Throwable $previous = null)
public function __construct(string $msg, \Throwable $previous = null)
{
parent::__construct(Response::HTTP_INTERNAL_SERVER_ERROR, $msg, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Internal/InvalidUserIdException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class InvalidUserIdException extends LycheeDomainException
{
public function __construct(?\Throwable $previous = null)
public function __construct(\Throwable $previous = null)
{
parent::__construct('Invalid user ID', $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Internal/LycheeAssertionError.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class LycheeAssertionError extends \AssertionError implements InternalLycheeException
{
public function __construct(string $msg, ?\Throwable $previous = null)
public function __construct(string $msg, \Throwable $previous = null)
{
parent::__construct($msg, $previous !== null ? $previous->getCode() : 0, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Internal/LycheeDomainException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class LycheeDomainException extends \DomainException implements InternalLycheeException
{
public function __construct(string $msg, ?\Throwable $previous = null)
public function __construct(string $msg, \Throwable $previous = null)
{
parent::__construct($msg, $previous !== null ? $previous->getCode() : 0, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/MediaFileOperationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
class MediaFileOperationException extends FileOperationException
{
public function __construct(string $msg, ?\Throwable $previous = null)
public function __construct(string $msg, \Throwable $previous = null)
{
parent::__construct($msg, $previous);
}
Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/Administration/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
use App\Http\Requests\Settings\SetPublicSearchSettingRequest;
use App\Http\Requests\Settings\SetSortingSettingsRequest;
use App\Models\Configs;
use App\Models\User;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Storage;
Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/ImportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use App\Models\Photo;
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
use Illuminate\Routing\Controller;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;
use Symfony\Component\HttpFoundation\StreamedResponse;
Expand Down
Loading

0 comments on commit c8011b9

Please sign in to comment.