Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-8138: [Rector] Applied rules from Symfony 5 Rector set lists #118

Merged
merged 11 commits into from
Jul 24, 2024
Merged
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
parameters:
ignoreErrors:
-
message: "#^Method Ibexa\\\\Bundle\\\\Behat\\\\Cache\\\\JsRoutingDirectoryCacheDirectoryCreator\\:\\:warmUp\\(\\) should return array\\<string\\> but return statement is missing\\.$#"
count: 1
path: src/bundle/Cache/JsRoutingDirectoryCacheDirectoryCreator.php

-
message: "#^Method Ibexa\\\\Bundle\\\\Behat\\\\Command\\\\CreateExampleDataCommand\\:\\:configure\\(\\) has no return type specified\\.$#"
count: 1
Expand Down
8 changes: 5 additions & 3 deletions src/bundle/Cache/JsRoutingDirectoryCacheDirectoryCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@

class JsRoutingDirectoryCacheDirectoryCreator implements CacheWarmerInterface
{
private const FOS_JS_ROUTING_CACHE_DIR = 'fosJsRouting';
private const string FOS_JS_ROUTING_CACHE_DIR = 'fosJsRouting';

public function isOptional()
public function isOptional(): bool
{
return true;
}

public function warmUp(string $cacheDir)
public function warmUp(string $cacheDir): array
{
// Workaround for https://github.com/FriendsOfSymfony/FOSJsRoutingBundle/pull/434
$cachePath = $cacheDir . \DIRECTORY_SEPARATOR . self::FOS_JS_ROUTING_CACHE_DIR;
if (!file_exists($cachePath) && !mkdir($cachePath) && !is_dir($cachePath)) {
throw new \RuntimeException('Unable to create JsRoutingBundle cache directory ' . $cachePath);
}

return [];
}
}
4 changes: 2 additions & 2 deletions src/bundle/Command/CreateExampleDataCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected function configure()
->addArgument('serializedTransitionData', InputArgument::REQUIRED);
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$iterations = $input->getArgument('iterations');
$initialData = $this->parseInputData($input->getArgument('serializedTransitionData'));
Expand All @@ -77,7 +77,7 @@ public function execute(InputInterface $input, OutputInterface $output)
$this->logger->log(LogLevel::INFO, $statsEnd);
$output->writeln($statsEnd);

return 0;
return Command::SUCCESS;
}

private function parseInputData(string $serializedTransitionEvent): InitialEvent
Expand Down
4 changes: 2 additions & 2 deletions src/bundle/Command/CreateExampleDataManagerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct(string $env, string $projectDir)
$this->stopwatch = new Stopwatch();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$data = $this->getData();
$this->stopwatch->start('timer');
Expand All @@ -62,7 +62,7 @@ public function execute(InputInterface $input, OutputInterface $output)
$event = $this->stopwatch->stop('timer');
$output->writeln(sprintf('Duration: %d s, memory: %s MB', $event->getDuration() / 1000, $event->getMemory() / 1024 / 1024));

return 0;
return Command::SUCCESS;
}

private function executeCommand(OutputInterface $output, $cmd, float $timeout = 1200)
Expand Down
2 changes: 1 addition & 1 deletion src/bundle/Command/CreateLanguageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$this->languageService->createLanguage($languageCreateStruct);

return 0;
return Command::SUCCESS;
}
}
2 changes: 1 addition & 1 deletion src/bundle/Command/TestSiteaccessCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
{
$output->writeln($this->siteaccess->name);

return 0;
return Command::SUCCESS;
}
}
2 changes: 1 addition & 1 deletion src/bundle/Subscriber/EndScenarioSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class EndScenarioSubscriber implements EventSubscriberInterface
{
private const PRIORITY = -1000;

public static function getSubscribedEvents()
public static function getSubscribedEvents(): array
{
return [
ScenarioTested::AFTER => ['resetLogProvider', self::PRIORITY],
Expand Down
2 changes: 1 addition & 1 deletion src/bundle/Subscriber/StartScenarioSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(KernelInterface $kernel, int $width, int $height)
$this->height = $height;
}

public static function getSubscribedEvents()
public static function getSubscribedEvents(): array
{
return [
ScenarioTested::BEFORE => ['resizeWindow', self::PRIORITY],
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Core/Debug/Command/GoBackCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ protected function configure()
->setHelp('');
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->session->back();

$output->writeln("The last page from browser's history has been visited.");

return 0;
return self::SUCCESS;
}
}
4 changes: 2 additions & 2 deletions src/lib/Core/Debug/Command/RefreshPageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ protected function configure()
->setHelp('');
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->session->reload();

$output->writeln('Page has been refreshed.');

return 0;
return self::SUCCESS;
}
}
4 changes: 2 additions & 2 deletions src/lib/Core/Debug/Command/ShowHTMLCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ protected function configure()
->setHelp('');
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$output->writeln($this->session->getPage()->getOuterHtml());

return 0;
return self::SUCCESS;
}
}
4 changes: 2 additions & 2 deletions src/lib/Core/Debug/Command/ShowURLCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ protected function configure()
->setHelp('');
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$output->writeln($this->session->getCurrentUrl());

return 0;
return self::SUCCESS;
}
}
4 changes: 2 additions & 2 deletions src/lib/Core/Debug/Command/TakeScreenshotCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected function configure()
->setHelp('');
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$image = $this->session->getScreenshot();
$filePath = sys_get_temp_dir() . \DIRECTORY_SEPARATOR . uniqid('debug') . '.png';
Expand All @@ -54,7 +54,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$response = Uploader::unsigned_upload($filePath, self::PRESET);
$output->writeln(sprintf('Open image at %s', $response['secure_url']));

return 0;
return self::SUCCESS;
} catch (Exception $e) {
$output->writeln(sprintf('Error while uploading image. %s', $e->getMessage()));

Expand Down
2 changes: 1 addition & 1 deletion src/lib/Subscriber/CreateContentDraft.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class CreateContentDraft extends AbstractProcessStage implements EventSubscriber
/** @var \Ibexa\Workflow\Behat\Facade\WorkflowFacade */
private $workflowFacade;

public static function getSubscribedEvents()
public static function getSubscribedEvents(): array
{
return [
Events::START_TO_DRAFT => ['execute', 0],
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Subscriber/EditContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected function getTransitions(): array
];
}

public static function getSubscribedEvents()
public static function getSubscribedEvents(): array
{
return [
Events::PUBLISH_TO_EDIT => 'execute',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Subscriber/InitialStage.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected function getTransitions(): array
];
}

public static function getSubscribedEvents()
public static function getSubscribedEvents(): array
{
return [
Events::START => 'onStart',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Subscriber/PublishDraft.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected function getTransitions(): array
];
}

public static function getSubscribedEvents()
public static function getSubscribedEvents(): array
{
return [
Events::REVIEW_TO_PUBLISH => 'execute',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Subscriber/PublishInTheFuture.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected function doExecute(TransitionEvent $event): void
$this->dateBasedPublisherService->schedulePublish($event->content->versionInfo, $this->randomDataGenerator->getRandomDateInTheFuture());
}

public static function getSubscribedEvents()
public static function getSubscribedEvents(): array
{
return [
Events::REVIEW_TO_PUBLISH_LATER => 'execute',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Subscriber/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected function getTransitions(): array
];
}

public static function getSubscribedEvents()
public static function getSubscribedEvents(): array
{
return [
Events::DRAFT_TO_REVIEW => 'execute',
Expand Down
Loading