Skip to content

Commit

Permalink
Composer update (#1893)
Browse files Browse the repository at this point in the history
* composer update
* fix complaints
  • Loading branch information
ildyria authored Jun 21, 2023
1 parent 99a900a commit 6da4fd0
Show file tree
Hide file tree
Showing 67 changed files with 616 additions and 552 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
coverage: none
- name: Install PHP-CS-Fixer
run: |
curl -L https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.16.0/php-cs-fixer.phar -o .github/build/php-cs-fixer
curl -L https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.18.0/php-cs-fixer.phar -o .github/build/php-cs-fixer
chmod a+x .github/build/php-cs-fixer
- name: Prepare Git User
run: |
Expand Down
5 changes: 5 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function (PhpCsFixer\Finder $finder, $dir) {
)->notName('*.blade.php');
$rules = [
'@Symfony' => true,
'nullable_type_declaration_for_default_null_value' => true,
'align_multiline_comment' => true,
'array_indentation' => true,
'backtick_to_shell_exec' => true,
Expand All @@ -38,6 +39,10 @@ function (PhpCsFixer\Finder $finder, $dir) {
'no_unneeded_control_parentheses' => [
'statements' => ['break', 'clone', 'continue', 'echo_print', 'switch_case', 'yield'],
],
'operator_linebreak' => [
'only_booleans' => true,
'position' => 'end'
],
];
$config = new PhpCsFixer\Config();

Expand Down
4 changes: 2 additions & 2 deletions app/Actions/Diagnostics/Pipes/Checks/GDSupportCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public function handle(array &$data, \Closure $next): array
// @codeCoverageIgnoreEnd
}
if (
!$gdVersion['GIF Read Support']
|| !$gdVersion['GIF Create Support']
!$gdVersion['GIF Read Support'] ||
!$gdVersion['GIF Create Support']
) {
// @codeCoverageIgnoreStart
$data[] = 'Error: PHP gd extension without full gif support';
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
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
6 changes: 3 additions & 3 deletions app/Actions/Settings/UpdateLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public function do(?string $username, string $password, string $oldPassword, str
throw new UnauthenticatedException('Previous password is invalid');
}

if ($username !== null
&& $username !== ''
&& Configs::getValueAsBool('allow_username_change')) {
if ($username !== null &&
$username !== '' &&
Configs::getValueAsBool('allow_username_change')) {
$this->updateUsername($user, $username, $ip);
}

Expand Down
7 changes: 4 additions & 3 deletions app/Assets/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ public function hasFullPermissions(string $path): bool
// Check if the given path is readable and writable
// Both functions are also verifying that the path exists
if (
file_exists($path) === true && is_readable($path) === true
&& is_executable($path) === true
&& is_writeable($path) === true
file_exists($path) === true &&
is_readable($path) === true &&
is_executable($path) === true &&
is_writeable($path) === true
) {
return true;
}
Expand Down
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/Exceptions/AdminUserAlreadySetException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class AdminUserAlreadySetException extends BaseLycheeException
{
public function __construct(\Throwable $previous = null)
public function __construct(?\Throwable $previous = null)
{
parent::__construct(Response::HTTP_FORBIDDEN, 'Admin User has already been set', $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/AdminUserRequiredException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class AdminUserRequiredException extends BaseLycheeException
{
public function __construct(\Throwable $previous = null)
public function __construct(?\Throwable $previous = null)
{
parent::__construct(Response::HTTP_SERVICE_UNAVAILABLE, 'Admin user not found', $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/BadRequestHeaderException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class BadRequestHeaderException extends BaseLycheeException
{
public function __construct(string $msg, \Throwable $previous = null)
public function __construct(string $msg, ?\Throwable $previous = null)
{
parent::__construct(Response::HTTP_BAD_REQUEST, $msg, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/ConfigurationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
class ConfigurationException extends BaseLycheeException
{
public function __construct(string $msg, \Throwable $previous = null)
public function __construct(string $msg, ?\Throwable $previous = null)
{
parent::__construct(Response::HTTP_PRECONDITION_FAILED, $msg, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/ConfigurationKeyMissingException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
class ConfigurationKeyMissingException 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/ConflictingPropertyException.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
class ConflictingPropertyException extends InvalidPropertyException
{
public function __construct(string $msg, \Throwable $previous = null)
public function __construct(string $msg, ?\Throwable $previous = null)
{
parent::__construct($msg, $previous, Response::HTTP_CONFLICT);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/ExternalComponentFailedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
class ExternalComponentFailedException extends BaseLycheeException
{
public function __construct(string $msg, \Throwable $previous = null)
public function __construct(string $msg, ?\Throwable $previous = null)
{
parent::__construct(Response::HTTP_SERVICE_UNAVAILABLE, $msg, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/ExternalComponentMissingException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
class ExternalComponentMissingException extends BaseLycheeException
{
public function __construct(string $msg, \Throwable $previous = null)
public function __construct(string $msg, ?\Throwable $previous = null)
{
parent::__construct(Response::HTTP_NOT_IMPLEMENTED, $msg, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/FlySystemLycheeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class FlySystemLycheeException extends BaseLycheeException implements FilesystemException
{
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
6 changes: 4 additions & 2 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Contracts\Container\Container;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Session\TokenMismatchException;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Log;
Expand Down Expand Up @@ -214,14 +216,14 @@ protected function mapException(\Throwable $e): \Throwable
* @param Request $request
* @param \Throwable $e
*
* @return SymfonyResponse
* @return RedirectResponse|Response
*
* @throws BindingResolutionException
* @throws \InvalidArgumentException
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
protected function prepareResponse($request, \Throwable $e): SymfonyResponse
protected function prepareResponse($request, \Throwable $e): RedirectResponse|Response
{
if (!$this->isHttpException($e) && config('app.debug') === true) {
return $this->toIlluminateResponse($this->convertExceptionToResponse($e), $e);
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/HttpHoneyPotException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class HttpHoneyPotException extends HttpException
*
* @return void
*/
public function __construct(string $path, \Throwable $previous = null)
public function __construct(string $path, ?\Throwable $previous = null)
{
parent::__construct(Response::HTTP_I_AM_A_TEAPOT, sprintf('The route %s could not be found.', $path), $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/ImageProcessingException.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
class ImageProcessingException 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/ImportCancelledException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ImportCancelledException extends BaseLycheeException
{
public const DEFAULT_MESSAGE = 'Import cancelled';

public function __construct(string $msg = self::DEFAULT_MESSAGE, \Throwable $previous = null)
public function __construct(string $msg = self::DEFAULT_MESSAGE, ?\Throwable $previous = null)
{
parent::__construct(Response::HTTP_INTERNAL_SERVER_ERROR, $msg, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/InstallationAlreadyCompletedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class InstallationAlreadyCompletedException extends BaseLycheeException
{
public function __construct(\Throwable $previous = null)
public function __construct(?\Throwable $previous = null)
{
parent::__construct(Response::HTTP_FORBIDDEN, 'Installation has already been run', $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/InstallationFailedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class InstallationFailedException 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/InstallationRequiredException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class InstallationRequiredException extends BaseLycheeException
{
public function __construct(\Throwable $previous = null)
public function __construct(?\Throwable $previous = null)
{
parent::__construct(Response::HTTP_SERVICE_UNAVAILABLE, 'Installation not complete', $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/InsufficientEntropyException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
class InsufficientEntropyException extends BaseLycheeException
{
public function __construct(\Throwable $previous = null)
public function __construct(?\Throwable $previous = null)
{
parent::__construct(Response::HTTP_SERVICE_UNAVAILABLE, 'Insufficient entropy', $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/InsufficientFilesystemPermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
class InsufficientFilesystemPermissions extends BaseLycheeException
{
public function __construct(string $msg, \Throwable $previous = null)
public function __construct(string $msg, ?\Throwable $previous = null)
{
parent::__construct(Response::HTTP_NOT_IMPLEMENTED, $msg, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Internal/FailedModelAssumptionException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
class FailedModelAssumptionException extends LycheeLogicException
{
public function __construct(string $msg, \Throwable $previous = null)
public function __construct(string $msg, ?\Throwable $previous = null)
{
parent::__construct($msg, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Internal/FrameworkException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
class FrameworkException extends LycheeLogicException
{
public function __construct(string $what, \Throwable $previous = null)
public function __construct(string $what, ?\Throwable $previous = null)
{
parent::__construct($what . ' failed', $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Internal/InvalidConfigOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

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

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

class LycheeLogicException extends \LogicException implements InternalLycheeException
{
public function __construct(string $msg, \Throwable $previous = null)
public function __construct(string $msg, ?\Throwable $previous = null)
{
parent::__construct($msg, 0, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Internal/QueryBuilderException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class QueryBuilderException extends FrameworkException
{
public function __construct(\Throwable $previous = null)
public function __construct(?\Throwable $previous = null)
{
parent::__construct('Laravel/Eloquent query builder', $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Internal/TimeBasedIdException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class TimeBasedIdException extends \RuntimeException implements InternalLycheeException
{
public function __construct(string $msg, \Throwable $previous = null)
public function __construct(string $msg, ?\Throwable $previous = null)
{
parent::__construct($msg, 0, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/InvalidDirectoryException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class InvalidDirectoryException extends InvalidPropertyException
{
public const DEFAULT_MESSAGE = 'Given path is not a directory';

public function __construct(string $msg = self::DEFAULT_MESSAGE, \Throwable $previous = null)
public function __construct(string $msg = self::DEFAULT_MESSAGE, ?\Throwable $previous = null)
{
parent::__construct($msg, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/InvalidPropertyException.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
class InvalidPropertyException extends BaseLycheeException
{
public function __construct(string $msg, \Throwable $previous = null, int $statusCode = Response::HTTP_UNPROCESSABLE_ENTITY)
public function __construct(string $msg, ?\Throwable $previous = null, int $statusCode = Response::HTTP_UNPROCESSABLE_ENTITY)
{
parent::__construct($statusCode, $msg, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/MediaFileMissingException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MediaFileMissingException extends BaseLycheeException
{
public const DEFAULT_MESSAGE = 'The media file is missing';

public function __construct(string $msg = self::DEFAULT_MESSAGE, \Throwable $previous = null)
public function __construct(string $msg = self::DEFAULT_MESSAGE, ?\Throwable $previous = null)
{
parent::__construct(Response::HTTP_NOT_FOUND, $msg, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/MediaFileUnsupportedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MediaFileUnsupportedException extends BaseLycheeException
{
public const DEFAULT_MESSAGE = 'File format not supported';

public function __construct(string $msg = self::DEFAULT_MESSAGE, \Throwable $previous = null)
public function __construct(string $msg = self::DEFAULT_MESSAGE, ?\Throwable $previous = null)
{
parent::__construct(Response::HTTP_UNPROCESSABLE_ENTITY, $msg, $previous);
}
Expand Down
Loading

0 comments on commit 6da4fd0

Please sign in to comment.