Minor code style fixes.

This commit is contained in:
Buster Neece 2023-06-06 05:43:06 -05:00
parent b4ce92f58b
commit 2be71a2c04
No known key found for this signature in database
20 changed files with 28 additions and 49 deletions

View File

@ -61,7 +61,7 @@ final class RunnerCommand extends AbstractSyncCommand
}
}
$this->manageStartedEvents($io);
$this->manageStartedEvents();
$settings->updateSyncLastRun();
$this->settingsRepo->writeSettings($settings);
@ -69,7 +69,7 @@ final class RunnerCommand extends AbstractSyncCommand
return 0;
}
private function manageStartedEvents(SymfonyStyle $io): void
private function manageStartedEvents(): void
{
while ($this->processes) {
$this->checkRunningProcesses();

View File

@ -94,23 +94,13 @@ abstract class AbstractApiCrudController
array_merge(
$context,
[
AbstractObjectNormalizer::ENABLE_MAX_DEPTH => true,
AbstractObjectNormalizer::MAX_DEPTH_HANDLER => function (
$innerObject,
$outerObject,
string $attributeName,
string $format = null,
array $context = []
) {
return $this->displayShortenedObject($innerObject);
},
AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER => function (
$object,
string $format = null,
array $context = []
) {
return $this->displayShortenedObject($object);
},
AbstractObjectNormalizer::ENABLE_MAX_DEPTH => true,
AbstractObjectNormalizer::MAX_DEPTH_HANDLER => fn($innerObject) => $this->displayShortenedObject(
$innerObject
),
AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER => fn($object) => $this->displayShortenedObject(
$object
),
]
)
);

View File

@ -15,7 +15,6 @@ use InvalidArgumentException;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
use RuntimeException;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Validator\Validator\ValidatorInterface;

View File

@ -42,8 +42,6 @@ final class PutTwoFactorAction extends UsersController
$totp->setLabel($user->getEmail() ?: 'AzuraCast');
if (!empty($params['otp'])) {
$otp = $params['otp'];
if ($totp->verify($params['otp'], null, Auth::TOTP_WINDOW)) {
$user = $this->em->refetch($user);
$user->setTwoFactorSecret($totp->getProvisioningUri());

View File

@ -16,7 +16,6 @@ use App\Service\Flow\UploadedFile;
use InvalidArgumentException;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ResponseInterface;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Validator\Validator\ValidatorInterface;

View File

@ -51,7 +51,7 @@ final class PlaylistAction
continue;
}
$stream_url = $this->adapters->getRemoteAdapter($station, $remote)
$stream_url = $this->adapters->getRemoteAdapter($remote)
->getPublicUrl($remote);
$stream_urls[] = $stream_url;

View File

@ -17,7 +17,7 @@ final class Customization
{
use RequestAwareTrait;
private ?Entity\User $user = null;
private ?Entity\User $user;
private Entity\Settings $settings;
@ -27,7 +27,7 @@ final class Customization
private SupportedThemes $publicTheme;
private string $instanceName = '';
private string $instanceName;
public function __construct(
private readonly Environment $environment,

View File

@ -13,7 +13,6 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Event\OnFlushEventArgs;
use Doctrine\ORM\Events;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\PersistentCollection;
use Doctrine\ORM\UnitOfWork;
use ReflectionClass;
use ReflectionObject;

View File

@ -67,7 +67,7 @@ final class StationApiGenerator
foreach ($station->getRemotes() as $remote) {
if ($showAllMounts || $remote->getIsVisibleOnPublicPages()) {
$remotes[] = $remote->api(
$this->adapters->getRemoteAdapter($station, $remote)
$this->adapters->getRemoteAdapter($remote)
);
}
}

View File

@ -13,7 +13,6 @@ use App\Service\Avatar;
use App\Utilities\Strings;
use App\Utilities\Urls;
use Doctrine\ORM\Mapping as ORM;
use InvalidArgumentException;
use OpenApi\Attributes as OA;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\UriInterface;

View File

@ -13,7 +13,6 @@ use App\Utilities\File;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use InvalidArgumentException;
use OpenApi\Attributes as OA;
use Stringable;
use Symfony\Component\Serializer\Annotation as Serializer;

View File

@ -15,7 +15,7 @@ final class Environment
{
private static Environment $instance;
private array $data = [];
private array $data;
// Core settings values
public const APP_NAME = 'APP_NAME';

View File

@ -44,7 +44,7 @@ final class GenerateRawNowPlaying extends Event
public function getRemoteAdapter(StationRemote $remote): AbstractRemote
{
return $this->adapters->getRemoteAdapter($this->station, $remote);
return $this->adapters->getRemoteAdapter($remote);
}
public function includeClients(): bool

View File

@ -39,7 +39,7 @@ abstract class AbstractFilesystem extends Filesystem implements ExtendedFilesyst
{
try {
return $this->getMetadata($path)->isDir();
} catch (UnableToRetrieveMetadata $e) {
} catch (UnableToRetrieveMetadata) {
return false;
}
}
@ -48,7 +48,7 @@ abstract class AbstractFilesystem extends Filesystem implements ExtendedFilesyst
{
try {
return $this->getMetadata($path)->isFile();
} catch (UnableToRetrieveMetadata $e) {
} catch (UnableToRetrieveMetadata) {
return false;
}
}

View File

@ -28,7 +28,7 @@ final class ResetArrayCacheSubscriber implements EventSubscriberInterface
];
}
public function resetArrayCache(WorkerMessageReceivedEvent $event): void
public function resetArrayCache(): void
{
if ($this->cache instanceof ArrayAdapter) {
$this->cache->reset();

View File

@ -34,7 +34,7 @@ final class Paginator implements IteratorAggregate, Countable
private int $maxPerPage = 25;
/** @var bool Whether the user is currently authenticated on this request. */
private bool $isAuthenticated = false;
private bool $isAuthenticated;
/** @var bool Whether to show pagination controls. */
private bool $isDisabled = true;

View File

@ -59,7 +59,7 @@ final class Adapters
return $this->listAdaptersFromEnum(BackendAdapters::cases(), $checkInstalled);
}
public function getRemoteAdapter(Entity\Station $station, Entity\StationRemote $remote): Remote\AbstractRemote
public function getRemoteAdapter(Entity\StationRemote $remote): Remote\AbstractRemote
{
$class_name = $remote->getType()->getClass();
if ($this->adapters->has($class_name)) {

View File

@ -18,7 +18,7 @@ final class LastFm
{
public const API_BASE_URL = 'https://ws.audioscrobbler.com/2.0/';
private ?string $apiKey = null;
private ?string $apiKey;
public function __construct(
private readonly Client $httpClient,

View File

@ -68,21 +68,17 @@ final class CheckFolderPlaylistsTask extends AbstractTask
}
$this->em->wrapInTransaction(
function () use ($station, $playlist, $fsMedia, $mediaInPlaylistQuery, $mediaInFolderQuery): void {
$this->processPlaylist(
$station,
$playlist,
$fsMedia,
$mediaInPlaylistQuery,
$mediaInFolderQuery
);
}
fn() => $this->processPlaylist(
$playlist,
$fsMedia,
$mediaInPlaylistQuery,
$mediaInFolderQuery
)
);
}
}
private function processPlaylist(
Entity\Station $station,
Entity\StationPlaylist $playlist,
ExtendedFilesystemInterface $fsMedia,
Query $mediaInPlaylistQuery,

View File

@ -294,7 +294,7 @@ final class CheckMediaTask extends AbstractTask
array $musicFiles,
array &$stats
): void {
foreach ($musicFiles as $pathHash => $newMusicFile) {
foreach ($musicFiles as $newMusicFile) {
$path = $newMusicFile[StorageAttributes::ATTRIBUTE_PATH];
$message = new AddNewMediaMessage();