Skip to content

Commit

Permalink
FFWEB-2966: Fix SonarQube issues
Browse files Browse the repository at this point in the history
Fix SonarQube issues
  • Loading branch information
Rayn93 authored Jan 22, 2024
1 parent 6f1e16a commit 18494be
Show file tree
Hide file tree
Showing 32 changed files with 321 additions and 547 deletions.
40 changes: 20 additions & 20 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php

use PhpCsFixer\{
Config, Finder
};
declare(strict_types=1);

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$finder = Finder::create()
->in(__DIR__ . '/src')
->name('*.php')
->ignoreDotFiles(true)
->exclude(['bin','views','out','translations', 'metadata'])
->exclude(['bin', 'views', 'out', 'translations', 'metadata'])
->notPath(['src/metadata.php'])
->ignoreVCS(true);

Expand All @@ -27,23 +28,22 @@
'operators' => [
'=' => 'align',
'=>' => 'align',
]
],
],
'blank_line_after_opening_tag' => true,
'line_ending' => true,
'class_attributes_separation' => false,
'blank_line_before_statement' => ['statements' => ['break', 'continue', 'declare', 'throw', 'try']],
'concat_space' => ['spacing' => 'one'],
'declare_strict_types' => true,
'increment_style' => ['style' => 'post'],
'no_superfluous_phpdoc_tags' => false,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => ['imports_order' => ['class', 'function', 'const']],
'strict_comparison' => true,
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
'blank_line_after_opening_tag' => true,
'line_ending' => true,
'class_attributes_separation' => false,
'blank_line_before_statement' => ['statements' => ['break', 'continue', 'declare', 'throw', 'try']],
'concat_space' => ['spacing' => 'one'],
'declare_strict_types' => true,
'increment_style' => ['style' => 'post'],
'no_superfluous_phpdoc_tags' => false,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => ['imports_order' => ['class', 'function', 'const']],
'strict_comparison' => true,
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
'nullable_type_declaration_for_default_null_value' => false,
])
->setFinder($finder);

12 changes: 6 additions & 6 deletions spec/Config/CommunicationSpec.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
<?php

declare(strict_types=1);

namespace spec\Omikron\FactFinder\Shopware6\Config;

use PhpSpec\ObjectBehavior;
use Shopware\Core\System\SystemConfig\SystemConfigService;

class CommunicationSpec extends ObjectBehavior
{
function let(SystemConfigService $configService)
public function let(SystemConfigService $configService): void
{
$this->beConstructedWith($configService);
}

function it_should_cast_credentials_to_string()
public function it_should_cast_credentials_to_string(): void
{
$this->getCredentials()->shouldContainOnlyStrings();
}

function it_should_return_factfinder_channel_configured_for_specific_saleschannel(SystemConfigService $configService)
public function it_should_return_channel_for_specific_saleschannel(SystemConfigService $configService): void
{
$configService->get('OmikronFactFinder.config.channel', '1')->willReturn('channel_1');
$configService->get('OmikronFactFinder.config.channel', '2')->willReturn('channel_2');
Expand All @@ -29,9 +31,7 @@ function it_should_return_factfinder_channel_configured_for_specific_saleschanne
public function getMatchers(): array
{
return [
'containOnlyStrings' => function ($subject) {
return count(array_filter($subject, 'is_string')) === count($subject);
},
'containOnlyStrings' => fn ($subject) => count(array_filter($subject, 'is_string')) === count($subject),
];
}
}
7 changes: 4 additions & 3 deletions spec/Config/FtpConfigSpec.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
<?php

declare(strict_types=1);

namespace spec\Omikron\FactFinder\Shopware6\Config;

use PhpSpec\ObjectBehavior;
use Shopware\Core\System\SystemConfig\SystemConfigService;

class FtpConfigSpec extends ObjectBehavior
{
function let(SystemConfigService $configService)
public function let(SystemConfigService $configService): void
{
$this->beConstructedWith($configService);
}

function it_should_use_channel_name_as_part_of_uploaded_file_name(SystemConfigService $configService)
public function it_should_use_channel_name_as_part_of_uploaded_file_name(SystemConfigService $configService): void
{
$salesChannelId = '1';
$channel = 'ff_channel_name';
$configService->get('OmikronFactFinder.config.channel', $salesChannelId)->willReturn($channel);

$this->getUploadFileName($salesChannelId)->shouldContain($channel);
}
}
Loading

0 comments on commit 18494be

Please sign in to comment.