Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"symfony/form": "^7.3"
},
"require-dev": {
"ibexa/code-style": "~2.0.0",
"ibexa/code-style": "~2.3.0",
"ibexa/doctrine-schema": "~5.0.0@dev",
"ibexa/rector": "~5.0.x-dev",
"mikey179/vfsstream": "^1.6",
Expand Down
8 changes: 0 additions & 8 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@ parameters:
count: 1
path: src/bundle/Controller/RenderController.php

-
message: '#^Method Ibexa\\Bundle\\Behat\\DependencyInjection\\IbexaBehatExtension\:\:load\(\) has no return type specified\.$#'
identifier: missingType.return
count: 1
path: src/bundle/DependencyInjection/IbexaBehatExtension.php

-
message: '#^Method Ibexa\\Bundle\\Behat\\DependencyInjection\\IbexaBehatExtension\:\:shouldLoadDxpServices\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -1986,7 +1980,6 @@ parameters:
count: 1
path: src/lib/Browser/FileUpload/FileUploadHelper.php


-
message: '#^Method Ibexa\\Behat\\Browser\\Filter\\BrowserLogFilter\:\:filter\(\) has parameter \$logEntries with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -2551,7 +2544,6 @@ parameters:
count: 1
path: src/lib/Core/Log/LogFileReader.php


-
message: '#^Method Ibexa\\Behat\\Core\\Log\\TestLogProvider\:\:cacheLogs\(\) has parameter \$logs with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down
6 changes: 4 additions & 2 deletions src/bundle/Cache/JsRoutingDirectoryCacheDirectoryCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ public function isOptional(): bool
return true;
}

public function warmUp(string $cacheDir, ?string $buildDir = null): array
{
public function warmUp(
string $cacheDir,
?string $buildDir = null
): 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)) {
Expand Down
20 changes: 12 additions & 8 deletions src/bundle/Command/CreateExampleDataCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,22 @@ class CreateExampleDataCommand extends Command
{
public const string NAME = 'ibexa:behat:create-data';

/** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */
/** @var EventDispatcherInterface */
private $eventDispatcher;

/** @var \Psr\Log\LoggerInterface */
/** @var LoggerInterface */
private $logger;

/** @var \Symfony\Component\Serializer\Serializer */
/** @var Serializer */
private $serializer;

/** @var \Symfony\Component\Stopwatch\Stopwatch */
/** @var Stopwatch */
private $stopwatch;

public function __construct(EventDispatcherInterface $eventDispatcher, LoggerInterface $logger)
{
public function __construct(
EventDispatcherInterface $eventDispatcher,
LoggerInterface $logger
) {
parent::__construct();
$encoders = [new JsonEncoder()];
$normalizers = [new ObjectNormalizer()];
Expand All @@ -58,8 +60,10 @@ protected function configure()
->addArgument('serializedTransitionData', InputArgument::REQUIRED);
}

public function execute(InputInterface $input, OutputInterface $output): int
{
public function execute(
InputInterface $input,
OutputInterface $output
): int {
$iterations = $input->getArgument('iterations');
$initialData = $this->parseInputData($input->getArgument('serializedTransitionData'));

Expand Down
29 changes: 19 additions & 10 deletions src/bundle/Command/CreateExampleDataManagerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{
private const BATCH_SIZE = 100;

/** @var \Symfony\Component\Stopwatch\Stopwatch */
/** @var Stopwatch */
private $stopwatch;

/** @var string */
Expand All @@ -39,11 +39,13 @@
/** @var array */
private $processes;

/** @var \Symfony\Component\Serializer\Serializer */
/** @var Serializer */
private $serializer;

public function __construct(string $env, string $projectDir)
{
public function __construct(
string $env,
string $projectDir
) {
parent::__construct();

$encoders = [new JsonEncoder()];
Expand All @@ -54,8 +56,10 @@
$this->stopwatch = new Stopwatch();
}

public function execute(InputInterface $input, OutputInterface $output): int
{
public function execute(
InputInterface $input,
OutputInterface $output
): int {
$data = $this->getData();
$this->stopwatch->start('timer');

Expand All @@ -67,8 +71,11 @@
return self::SUCCESS;
}

private function executeCommand(OutputInterface $output, $cmd, float $timeout = 1200)
{
private function executeCommand(
OutputInterface $output,
$cmd,
float $timeout = 1200
) {
$phpFinder = new PhpExecutableFinder();
if (!$phpPath = $phpFinder->find(false)) {
throw new \RuntimeException('The php executable could not be found. Add it to your PATH environment variable and try again');
Expand Down Expand Up @@ -119,8 +126,10 @@
return $data['countries'];
}

private function createProcesses(OutputInterface $output, $data)
{
private function createProcesses(

Check failure on line 129 in src/bundle/Command/CreateExampleDataManagerCommand.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=ibexa_behat&issues=AZ4lWRysOzRbrIzahnr_&open=AZ4lWRysOzRbrIzahnr_&pullRequest=183
OutputInterface $output,
$data
) {
foreach ($data as $row) {
$eventData = $this->parseData($row);
$command = sprintf('%s %d %s', CreateExampleDataCommand::NAME, self::BATCH_SIZE, $this->serialize($eventData));
Expand Down
12 changes: 7 additions & 5 deletions src/bundle/Command/CreateLanguageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
#[AsCommand(name: 'ibexa:behat:create-language', description: 'Create a Language')]
class CreateLanguageCommand extends Command
{
/** @var \Ibexa\Contracts\Core\Repository\LanguageService */
/** @var LanguageService */
private $languageService;

/** @var \Ibexa\Contracts\Core\Repository\UserService */
/** @var UserService */
private $userService;

/** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */
/** @var PermissionResolver */
private $permissionResolver;

public function __construct(
Expand Down Expand Up @@ -55,8 +55,10 @@ protected function configure()
;
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
protected function execute(
InputInterface $input,
OutputInterface $output
): int {
// set user with proper permissions to create language (content / translations)
$this->permissionResolver->setCurrentUserReference(
$this->userService->loadUserByLogin(
Expand Down
12 changes: 6 additions & 6 deletions src/bundle/Command/TestSiteaccessCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#[AsCommand(name: 'ibexa:behat:test-siteaccess', description: 'Outputs the name of the active siteaccess')]
class TestSiteaccessCommand extends Command
{
/** @var \Ibexa\Core\MVC\Symfony\SiteAccess */
/** @var SiteAccess */
private $siteaccess;

public function __construct(SiteAccess $siteaccess)
Expand All @@ -27,12 +27,12 @@ public function __construct(SiteAccess $siteaccess)
parent::__construct();
}

protected function configure()
{
}
protected function configure() {}

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

return self::SUCCESS;
Expand Down
10 changes: 6 additions & 4 deletions src/bundle/Controller/CurrentUserDataController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@
class CurrentUserDataController extends AbstractController
{
/**
* @var \Ibexa\Contracts\Core\Repository\PermissionResolver
* @var PermissionResolver
*/
private $permissionResolver;

/**
* @var \Ibexa\Contracts\Core\Repository\UserService
* @var UserService
*/
private $userService;

public function __construct(PermissionResolver $permissionResolver, UserService $userService)
{
public function __construct(
PermissionResolver $permissionResolver,
UserService $userService
) {
$this->permissionResolver = $permissionResolver;
$this->userService = $userService;
}
Expand Down
7 changes: 5 additions & 2 deletions src/bundle/Controller/ExceptionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@

class ExceptionController
{
public function throwRepositoryUnauthorizedAction($module = 'foo', $function = 'bar', $properties = [])
{
public function throwRepositoryUnauthorizedAction(
$module = 'foo',
$function = 'bar',
$properties = []
) {
throw new UnauthorizedException($module, $function, $properties);
}
}
6 changes: 4 additions & 2 deletions src/bundle/DependencyInjection/IbexaBehatExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ public function prepend(ContainerBuilder $container)
$container->setParameter(self::BROWSER_DEBUG_INTERACTIVE_ENABLED, false);
}

public function load(array $config, ContainerBuilder $container)
{
public function load(
array $config,
ContainerBuilder $container
) {
$loader = new Loader\YamlFileLoader(
$container,
new FileLocator(__DIR__ . '/../Resources/config')
Expand Down
8 changes: 4 additions & 4 deletions src/bundle/Form/RetryChoiceListFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct(ChoiceListFactoryInterface $choiceListFactory)
/**
* @param iterable<string, mixed> $choices
*
* @throws \ErrorException
* @throws ErrorException
*/
public function createListFromChoices(
iterable $choices,
Expand All @@ -41,7 +41,7 @@ public function createListFromChoices(
}

/**
* @throws \ErrorException
* @throws ErrorException
*/
public function createListFromLoader(
ChoiceLoaderInterface $loader,
Expand All @@ -58,7 +58,7 @@ public function createListFromLoader(
* @param array<string, mixed>|callable|null $attr
* @param array<string, mixed>|callable $labelTranslationParameters
*
* @throws \ErrorException
* @throws ErrorException
*/
public function createView(
ChoiceListInterface $list,
Expand Down Expand Up @@ -92,7 +92,7 @@ function () use ($list, $preferredChoices, $label, $index, $groupBy, $attr, $lab
*
* @return T
*
* @throws \ErrorException
* @throws ErrorException
*/
private function executeWithRetry(callable $fn)
{
Expand Down
22 changes: 13 additions & 9 deletions src/bundle/IbexaExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ public function process(ContainerBuilder $container): void
}
}

public function initialize(ExtensionManager $extensionManager)
{
}
public function initialize(ExtensionManager $extensionManager) {}

public function configure(ArrayNodeDefinition $builder)
{
Expand All @@ -60,8 +58,10 @@ public function configure(ArrayNodeDefinition $builder)
->end();
}

public function load(ContainerBuilder $container, array $config)
{
public function load(
ContainerBuilder $container,
array $config
) {
$this->loadSiteAccessInitializer($container);
$this->loadStartScenarioSubscriber($container);
$this->setMinkParameters($container, $config);
Expand All @@ -80,8 +80,10 @@ private function loadSiteAccessInitializer(ContainerBuilder $container): void
$container->setDefinition(BehatSiteAccessInitializer::class, $definition);
}

private function setMinkParameters(ContainerBuilder $container, array $config): void
{
private function setMinkParameters(
ContainerBuilder $container,
array $config
): void {
if (!array_key_exists('mink', $config)) {
return;
}
Expand All @@ -101,8 +103,10 @@ private function setMinkParameters(ContainerBuilder $container, array $config):
$container->setParameter(self::HEIGHT_PARAMETER, (int) $config['mink']['height']);
}

private function setDefaultJavascriptSession(ContainerBuilder $container, string $defaultJavascriptSession): void
{
private function setDefaultJavascriptSession(
ContainerBuilder $container,
string $defaultJavascriptSession
): void {
$container->setParameter('mink.javascript_session', $defaultJavascriptSession);
}

Expand Down
2 changes: 1 addition & 1 deletion src/bundle/Initializer/BehatSiteAccessInitializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class BehatSiteAccessInitializer implements EventSubscriberInterface
private const DEFAULT_SITEACCESS_PARAMETER = 'ibexa.site_access.default';
private const EVENT_DISPATCHER_SERVICE_ID = 'event_dispatcher';

/** @var \Symfony\Component\HttpKernel\KernelInterface */
/** @var KernelInterface */
private $kernel;

public function __construct(KernelInterface $kernel)
Expand Down
7 changes: 5 additions & 2 deletions src/bundle/Subscriber/StartScenarioSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ class StartScenarioSubscriber implements EventSubscriberInterface

private int $height;

public function __construct(KernelInterface $kernel, int $width, int $height)
{
public function __construct(
KernelInterface $kernel,
int $width,
int $height
) {
$this->kernel = $kernel;
$this->width = $width;
$this->height = $height;
Expand Down
Loading
Loading