Skip to content

Commit 7c8363c

Browse files
committed
Fix CS
1 parent 45e3283 commit 7c8363c

File tree

70 files changed

+219
-135
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+219
-135
lines changed

src/Command/CleanSpamPackagesCommand.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,8 @@
1919
use App\Model\ProviderManager;
2020
use Doctrine\Persistence\ManagerRegistry;
2121
use App\Entity\Package;
22-
use App\Service\Locker;
23-
use Psr\Log\LoggerInterface;
24-
use Seld\Signal\SignalHandler;
2522
use Symfony\Component\Console\Command\Command;
2623
use Symfony\Component\Console\Input\InputInterface;
27-
use Symfony\Component\Console\Input\InputOption;
2824
use Symfony\Component\Console\Output\OutputInterface;
2925

3026
/**

src/Command/IndexPackagesCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
use Symfony\Component\Console\Input\InputInterface;
2424
use Symfony\Component\Console\Input\InputOption;
2525
use Symfony\Component\Console\Output\OutputInterface;
26-
use Doctrine\DBAL\Connection;
2726
use Doctrine\Persistence\ManagerRegistry;
2827
use App\Service\Locker;
2928
use Predis\Client;

src/Command/MigrateDataTypesCommand.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,10 @@
1212

1313
namespace App\Command;
1414

15-
use App\Entity\Dist;
16-
use App\Entity\DistType;
17-
use App\Entity\Version;
18-
use App\Service\FallbackGitHubAuthProvider;
19-
use Composer\Util\HttpDownloader;
20-
use Doctrine\DBAL\ArrayParameterType;
2115
use Doctrine\Persistence\ManagerRegistry;
22-
use App\Entity\Package;
23-
use App\Package\V2Dumper;
24-
use App\Service\Locker;
25-
use Psr\Log\LoggerInterface;
26-
use Seld\Signal\SignalHandler;
2716
use Symfony\Component\Console\Command\Command;
2817
use Symfony\Component\Console\Input\InputInterface;
29-
use Symfony\Component\Console\Input\InputOption;
3018
use Symfony\Component\Console\Output\OutputInterface;
31-
use Symfony\Component\HttpClient\Exception\TimeoutException;
32-
use Symfony\Component\HttpClient\Exception\TransportException;
33-
use Symfony\Component\HttpClient\NoPrivateNetworkHttpClient;
34-
use ZipArchive;
3519

3620
class MigrateDataTypesCommand extends Command
3721
{

src/Command/RunWorkersCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8787
try {
8888
// force destructor as that will trigger another lock release attempt
8989
$this->lock = null;
90-
} catch (LockReleasingException) {}
90+
} catch (LockReleasingException) {
91+
}
9192
}
9293
}
9394

src/Command/UnfreezePackageCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5555
$package = $this->getEM()->getRepository(Package::class)->findOneBy(['name' => $name]);
5656
if ($package === null) {
5757
$output->writeln('<error>Package '.$name.' not found</error>');
58+
5859
return 1;
5960
}
6061

src/Command/UploadMetadataToCdnCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function configure(): void
4444

4545
protected function execute(InputInterface $input, OutputInterface $output): int
4646
{
47-
$verbose = (bool)$input->getOption('verbose');
47+
$verbose = (bool) $input->getOption('verbose');
4848

4949
$finder = Finder::create()
5050
->in($this->webDir.'p2')

src/Controller/ApiController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
use Symfony\Component\Validator\Validator\ValidatorInterface;
3939
use Symfony\Contracts\HttpClient\HttpClientInterface;
4040

41-
enum ApiType {
41+
enum ApiType
42+
{
4243
case Safe;
4344
case Unsafe;
4445
}
@@ -49,8 +50,8 @@ enum ApiType {
4950
class ApiController extends Controller
5051
{
5152
private const REGEXES = [
52-
'gitlab' => '{^(?:ssh://git@|https?://|git://|git@)?(?P<host>[a-z0-9.-]+)(?::[0-9]+/|[:/])(?P<path>[\w.-]+(?:/[\w.-]+?)+)(?:\.git|/)?$}i',
53-
'any' => '{^(?:ssh://git@|https?://|git://|git@)?(?P<host>[a-z0-9.-]+)(?::[0-9]+/|[:/])(?P<path>[\w.-]+(?:/[\w.-]+?)*)(?:\.git|/)?$}i',
53+
'gitlab' => '{^(?:ssh://git@|https?://|git://|git@)?(?P<host>[a-z0-9.-]+)(?::[0-9]+/|[:/])(?P<path>[\w.-]+(?:/[\w.-]+?)+)(?:\.git|/)?$}i',
54+
'any' => '{^(?:ssh://git@|https?://|git://|git@)?(?P<host>[a-z0-9.-]+)(?::[0-9]+/|[:/])(?P<path>[\w.-]+(?:/[\w.-]+?)*)(?:\.git|/)?$}i',
5455
'bitbucket_push' => '{^(?:https?://|git://|git@)?(?:api\.)?(?P<host>bitbucket\.org)[/:](?P<path>[\w.-]+/[\w.-]+?)(?:\.git)?/?$}i',
5556
'bitbucket_hook' => '{^(?:https?://|git://|git@)?(?P<host>bitbucket\.org)[/:](?P<path>[\w.-]+/[\w.-]+?)(?:\.git)?/?$}i',
5657
];

src/Controller/ExtensionController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use App\Entity\Package;
1616
use App\Model\DownloadManager;
1717
use App\Model\FavoriteManager;
18-
use Pagerfanta\Adapter\FixedAdapter;
1918
use Pagerfanta\Doctrine\ORM\QueryAdapter;
2019
use Pagerfanta\Pagerfanta;
2120
use Predis\Client as RedisClient;

src/Controller/PackageController.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
use Composer\Semver\Constraint\Constraint;
2828
use Composer\Semver\Constraint\MatchNoneConstraint;
2929
use Composer\Semver\Constraint\MultiConstraint;
30-
use DateTime;
3130
use DateTimeImmutable;
3231
use Doctrine\ORM\NoResultException;
3332
use App\Entity\Download;
@@ -99,12 +98,12 @@ public function allAction(): RedirectResponse
9998
}
10099

101100
#[Route(path: '/packages/list.json', name: 'list', defaults: ['_format' => 'json'], methods: ['GET'])]
102-
public function listAction(Request $req,
101+
public function listAction(
102+
Request $req,
103103
PackageRepository $repo,
104-
#[MapQueryParameter] ?string $type=null,
105-
#[MapQueryParameter] ?string $vendor=null,
106-
): JsonResponse
107-
{
104+
#[MapQueryParameter] ?string $type = null,
105+
#[MapQueryParameter] ?string $vendor = null,
106+
): JsonResponse {
108107
$queryParams = $req->query->all();
109108
$fields = (array) ($queryParams['fields'] ?? []); // support single or multiple fields
110109
$fields = array_intersect($fields, ['repository', 'type', 'abandoned']);
@@ -113,7 +112,7 @@ public function listAction(Request $req,
113112
$filters = array_filter([
114113
'type' => $type,
115114
'vendor' => $vendor,
116-
], fn ($val) => $val !== null);
115+
], static fn ($val) => $val !== null);
117116

118117
$response = new JsonResponse(['packages' => $repo->getPackagesWithFields($filters, $fields)]);
119118
$response->setSharedMaxAge(300);
@@ -458,7 +457,7 @@ public function viewSpamAction(Request $req, CsrfTokenManagerInterface $csrfToke
458457
public function markSafeAction(Request $req): RedirectResponse
459458
{
460459
/** @var string[] $vendors */
461-
$vendors = array_filter($req->request->all('vendor'), fn ($vendor) => $vendor !== '' && $vendor !== null);
460+
$vendors = array_filter($req->request->all('vendor'), static fn ($vendor) => $vendor !== '' && $vendor !== null);
462461
if (!$this->isCsrfTokenValid('mark_safe', (string) $req->request->get('token'))) {
463462
throw new BadRequestHttpException('Invalid CSRF token');
464463
}
@@ -1443,7 +1442,7 @@ public function versionStatsAction(Request $req, #[MapEntity] Package $package,
14431442
$normalizer = new VersionParser;
14441443
try {
14451444
$normVersion = $normalizer->normalize($version);
1446-
} catch (\UnexpectedValueException $e) {
1445+
} catch (UnexpectedValueException $e) {
14471446
return new JsonResponse(['error' => $e->getMessage()], Response::HTTP_BAD_REQUEST);
14481447
}
14491448

src/Controller/ProfileController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ public function tokenRotateAction(Request $request, #[CurrentUser] User $user, U
161161
{
162162
if (!$this->isCsrfTokenValid('rotate_api', (string) $request->request->get('token'))) {
163163
$this->addFlash('error', 'Invalid csrf token, try again.');
164+
164165
return $this->redirectToRoute('my_profile');
165166
}
166167

0 commit comments

Comments
 (0)