cs: Second part - ignore test/app subdirectory.

This commit is contained in:
Pol Dellaiera
2021-11-23 14:34:34 +01:00
parent 5f37304796
commit 3ea35682eb
72 changed files with 326 additions and 365 deletions

View File

@@ -50,7 +50,7 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface
foreach ($persons as $person) {
$activityNbr = rand(0, 3);
for ($i = 0; $i < $activityNbr; ++$i ) {
for ($i = 0; $i < $activityNbr; ++$i) {
$activity = $this->newRandomActivity($person);
if (null !== $activity) {

View File

@@ -56,8 +56,8 @@ class Configuration implements ConfigurationInterface
->cannotBeEmpty()
->validate()
->ifTrue(function ($data) {
return !is_int($data);
})->thenInvalid('The value %s is not a valid integer')
return !is_int($data);
})->thenInvalid('The value %s is not a valid integer')
->end()
->end()
->scalarNode('label')

View File

@@ -125,24 +125,24 @@ class ActivityType extends AbstractType
$builder->get('socialIssues')
->addModelTransformer(new CallbackTransformer(
function (iterable $socialIssuesAsIterable): string {
$socialIssueIds = [];
$socialIssueIds = [];
foreach ($socialIssuesAsIterable as $value) {
$socialIssueIds[] = $value->getId();
}
foreach ($socialIssuesAsIterable as $value) {
$socialIssueIds[] = $value->getId();
}
return implode(',', $socialIssueIds);
},
return implode(',', $socialIssueIds);
},
function (?string $socialIssuesAsString): array {
if (null === $socialIssuesAsString) {
return [];
}
if (null === $socialIssuesAsString) {
return [];
}
return array_map(
fn (string $id): ?SocialIssue => $this->om->getRepository(SocialIssue::class)->findOneBy(['id' => (int) $id]),
explode(',', $socialIssuesAsString)
);
}
return array_map(
fn (string $id): ?SocialIssue => $this->om->getRepository(SocialIssue::class)->findOneBy(['id' => (int) $id]),
explode(',', $socialIssuesAsString)
);
}
));
}
@@ -151,24 +151,24 @@ class ActivityType extends AbstractType
$builder->get('socialActions')
->addModelTransformer(new CallbackTransformer(
function (iterable $socialActionsAsIterable): string {
$socialActionIds = [];
$socialActionIds = [];
foreach ($socialActionsAsIterable as $value) {
$socialActionIds[] = $value->getId();
}
foreach ($socialActionsAsIterable as $value) {
$socialActionIds[] = $value->getId();
}
return implode(',', $socialActionIds);
},
return implode(',', $socialActionIds);
},
function (?string $socialActionsAsString): array {
if (null === $socialActionsAsString) {
return [];
}
if (null === $socialActionsAsString) {
return [];
}
return array_map(
fn (string $id): ?SocialAction => $this->om->getRepository(SocialAction::class)->findOneBy(['id' => (int) $id]),
explode(',', $socialActionsAsString)
);
}
return array_map(
fn (string $id): ?SocialAction => $this->om->getRepository(SocialAction::class)->findOneBy(['id' => (int) $id]),
explode(',', $socialActionsAsString)
);
}
));
}
@@ -248,20 +248,20 @@ class ActivityType extends AbstractType
$builder->get('persons')
->addModelTransformer(new CallbackTransformer(
function (iterable $personsAsIterable): string {
$personIds = [];
$personIds = [];
foreach ($personsAsIterable as $value) {
$personIds[] = $value->getId();
}
foreach ($personsAsIterable as $value) {
$personIds[] = $value->getId();
}
return implode(',', $personIds);
},
return implode(',', $personIds);
},
function (?string $personsAsString): array {
return array_map(
fn (string $id): ?Person => $this->om->getRepository(Person::class)->findOneBy(['id' => (int) $id]),
explode(',', $personsAsString)
);
}
return array_map(
fn (string $id): ?Person => $this->om->getRepository(Person::class)->findOneBy(['id' => (int) $id]),
explode(',', $personsAsString)
);
}
));
}
@@ -270,20 +270,20 @@ class ActivityType extends AbstractType
$builder->get('thirdParties')
->addModelTransformer(new CallbackTransformer(
function (iterable $thirdpartyAsIterable): string {
$thirdpartyIds = [];
$thirdpartyIds = [];
foreach ($thirdpartyAsIterable as $value) {
$thirdpartyIds[] = $value->getId();
}
foreach ($thirdpartyAsIterable as $value) {
$thirdpartyIds[] = $value->getId();
}
return implode(',', $thirdpartyIds);
},
return implode(',', $thirdpartyIds);
},
function (?string $thirdpartyAsString): array {
return array_map(
fn (string $id): ?ThirdParty => $this->om->getRepository(ThirdParty::class)->findOneBy(['id' => (int) $id]),
explode(',', $thirdpartyAsString)
);
}
return array_map(
fn (string $id): ?ThirdParty => $this->om->getRepository(ThirdParty::class)->findOneBy(['id' => (int) $id]),
explode(',', $thirdpartyAsString)
);
}
));
}
@@ -303,20 +303,20 @@ class ActivityType extends AbstractType
$builder->get('users')
->addModelTransformer(new CallbackTransformer(
function (iterable $usersAsIterable): string {
$userIds = [];
$userIds = [];
foreach ($usersAsIterable as $value) {
$userIds[] = $value->getId();
}
foreach ($usersAsIterable as $value) {
$userIds[] = $value->getId();
}
return implode(',', $userIds);
},
return implode(',', $userIds);
},
function (?string $usersAsString): array {
return array_map(
fn (string $id): ?User => $this->om->getRepository(User::class)->findOneBy(['id' => (int) $id]),
explode(',', $usersAsString)
);
}
return array_map(
fn (string $id): ?User => $this->om->getRepository(User::class)->findOneBy(['id' => (int) $id]),
explode(',', $usersAsString)
);
}
));
}

View File

@@ -30,8 +30,7 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface
public function __construct(
AuthorizationCheckerInterface $authorizationChecker,
TranslatorInterface $translator
)
{
) {
$this->translator = $translator;
$this->authorizationChecker = $authorizationChecker;
}

View File

@@ -71,8 +71,7 @@ class TranslatableActivityReasonTest extends TypeTestCase
protected function getTranslatableStringHelper(
$locale = 'en',
$fallbackLocale = 'en'
)
{
) {
$prophet = new \Prophecy\Prophet();
$requestStack = $prophet->prophesize();
$request = $prophet->prophesize();

View File

@@ -26,11 +26,11 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
*/
class ActivityVoterTest extends KernelTestCase
{
use PrepareUserTrait;
use PrepareCenterTrait;
use PrepareScopeTrait;
use PreparePersonTrait;
use PrepareActivityTrait;
use PrepareCenterTrait;
use PreparePersonTrait;
use PrepareScopeTrait;
use PrepareUserTrait;
/**
* @var \Prophecy\Prophet
@@ -132,8 +132,7 @@ class ActivityVoterTest extends KernelTestCase
Center $center,
$attribute,
$message
)
{
) {
$token = $this->prepareToken($user);
$activity = $this->prepareActivity($scope, $this->preparePerson($center));