DX: fix cs

This commit is contained in:
2023-02-06 17:47:54 +01:00
parent 4b2c330d22
commit 70871176fc
29 changed files with 100 additions and 74 deletions

View File

@@ -50,8 +50,8 @@ class LoadLanguages extends AbstractFixture implements ContainerAwareInterface,
foreach (Intl::getLanguageBundle()->getLanguageNames() as $code => $language) {
if (
!in_array($code, $this->regionalVersionToInclude, true)
&& !in_array($code, $this->ancientToExclude, true)
!in_array($code, $this->regionalVersionToInclude, true)
&& !in_array($code, $this->ancientToExclude, true)
) {
$lang = (new Language())
->setId($code)

View File

@@ -274,7 +274,7 @@ class Configuration implements ConfigurationInterface
->end()
->end() // end of root/children
->end() // end of root
;
;
$rootNode->children()
->arrayNode('add_address')->addDefaultsIfNotSet()->children()

View File

@@ -42,7 +42,9 @@ class IdToEntityDataTransformer implements DataTransformerInterface
{
$this->repository = $repository;
$this->multiple = $multiple;
$this->getId = $getId ?? static function (object $o) { return $o->getId(); };
$this->getId = $getId ?? static function (object $o) {
return $o->getId();
};
}
/**

View File

@@ -137,8 +137,8 @@ class WorkflowStepType extends AbstractType
$meta = $workflow->getMetadataStore()->getPlaceMetadata($to);
if (
!array_key_exists('isFinal', $meta) || false === $meta['isFinal']
) {
!array_key_exists('isFinal', $meta) || false === $meta['isFinal']
) {
$toFinal = false;
}
}

View File

@@ -124,12 +124,12 @@ class PaginatorFactory
return array_merge(
$this->router->getContext()->getParameters(),
// get the route parameters
$this->requestStack
->getCurrentRequest()
->attributes->get('_route_params'),
$this->requestStack
->getCurrentRequest()
->attributes->get('_route_params'),
// get the query parameters
$this->requestStack
->getCurrentRequest()->query->all()
$this->requestStack
->getCurrentRequest()->query->all()
);
}
}

View File

@@ -267,15 +267,15 @@ final class ExportManagerTest extends KernelTestCase
)
->willReturn(static function ($value) {
switch ($value) {
case 0:
case 1:
return $value;
case 0:
case 1:
return $value;
case '_header':
return 'export';
case '_header':
return 'export';
default: throw new RuntimeException(sprintf('The value %s is not valid', $value));
}
default: throw new RuntimeException(sprintf('The value %s is not valid', $value));
}
});
$export->getQueryKeys(Argument::Type('array'))->willReturn(['export']);
@@ -307,15 +307,15 @@ final class ExportManagerTest extends KernelTestCase
)
->willReturn(static function ($value) {
switch ($value) {
case '_header': return 'foo_header';
case '_header': return 'foo_header';
case 'cat a': return 'label cat a';
case 'cat a': return 'label cat a';
case 'cat b': return 'label cat b';
case 'cat b': return 'label cat b';
default:
throw new RuntimeException(sprintf('This value (%s) is not valid', $value));
}
default:
throw new RuntimeException(sprintf('This value (%s) is not valid', $value));
}
});
$aggregator->addRole()->willReturn(null);
//$aggregator->addRole()->shouldBeCalled();

View File

@@ -77,13 +77,13 @@ final class IdToEntityDataTransformerTest extends TestCase
public function testTransformMulti()
{
$o1 = new class() {
$o1 = new class () {
public function getId()
{
return 1;
}
};
$o2 = new class() {
$o2 = new class () {
public function getId()
{
return 2;
@@ -104,7 +104,7 @@ final class IdToEntityDataTransformerTest extends TestCase
public function testTransformSingle()
{
$o = new class() {
$o = new class () {
public function getId()
{
return 1;

View File

@@ -33,7 +33,7 @@ final class DefaultScopeResolverTest extends TestCase
public function testHasScopeInterface()
{
$scope = new Scope();
$entity = new class($scope) implements HasScopeInterface {
$entity = new class ($scope) implements HasScopeInterface {
public function __construct(Scope $scope)
{
$this->scope = $scope;
@@ -52,7 +52,7 @@ final class DefaultScopeResolverTest extends TestCase
public function testHasScopesInterface()
{
$entity = new class($scopeA = new Scope(), $scopeB = new Scope()) implements HasScopesInterface {
$entity = new class ($scopeA = new Scope(), $scopeB = new Scope()) implements HasScopesInterface {
public function __construct(Scope $scopeA, Scope $scopeB)
{
$this->scopes = [$scopeA, $scopeB];

View File

@@ -34,7 +34,7 @@ final class ScopeResolverDispatcherTest extends TestCase
public function testHasScopeInterface()
{
$scope = new Scope();
$entity = new class($scope) implements HasScopeInterface {
$entity = new class ($scope) implements HasScopeInterface {
public function __construct(Scope $scope)
{
$this->scope = $scope;
@@ -52,7 +52,7 @@ final class ScopeResolverDispatcherTest extends TestCase
public function testHasScopesInterface()
{
$entity = new class($scopeA = new Scope(), $scopeB = new Scope()) implements HasScopesInterface {
$entity = new class ($scopeA = new Scope(), $scopeB = new Scope()) implements HasScopesInterface {
public function __construct(Scope $scopeA, Scope $scopeB)
{
$this->scopes = [$scopeA, $scopeB];

View File

@@ -63,18 +63,18 @@ class RoleScopeScopePresence extends ConstraintValidator
//if the role scope should have a scope
if (
!in_array($value->getRole(), $this->roleProvider->getRolesWithoutScopes(), true)
&& $value->getScope() === null
) {
!in_array($value->getRole(), $this->roleProvider->getRolesWithoutScopes(), true)
&& $value->getScope() === null
) {
$this->context->buildViolation($constraint->messagePresenceRequired)
->setParameter('%role%', $this->translator->trans($value->getRole()))
->addViolation();
$this->logger->debug('the role scope should have a scope, but scope is null. Violation build.');
} elseif // if the scope should be null
(
in_array($value->getRole(), $this->roleProvider->getRolesWithoutScopes(), true)
&& null !== $value->getScope()
) {
(
in_array($value->getRole(), $this->roleProvider->getRolesWithoutScopes(), true)
&& null !== $value->getScope()
) {
$this->context->buildViolation($constraint->messageNullRequired)
->setParameter('%role%', $this->translator->trans($value->getRole()))
->addViolation();