cs: Enable a couple of risky rules.

This commit is contained in:
Pol Dellaiera
2021-11-24 12:38:18 +01:00
parent acc4647346
commit f531cdc0ec
51 changed files with 130 additions and 132 deletions

View File

@@ -99,11 +99,11 @@ class LoadAndUpdateLanguagesCommand extends Command
$excludeCode = (
(
!$input->getOption(self::INCLUDE_REGIONAL_VERSION)
and strpos($code, '_')
and !in_array($code, $this->regionalVersionToInclude)
) or (
&& strpos($code, '_')
&& !in_array($code, $this->regionalVersionToInclude)
) || (
!$input->getOption(self::INCLUDE_ANCIENT)
and in_array($code, $this->ancientToExclude)
&& in_array($code, $this->ancientToExclude)
)
);

View File

@@ -222,20 +222,20 @@ class ExportController extends AbstractController
'csrf_protection' => $isGenerate ? false : true,
]);
if ('centers' === $step or 'generate_centers' === $step) {
if ('centers' === $step || 'generate_centers' === $step) {
$builder->add('centers', PickCenterType::class, [
'export_alias' => $alias,
]);
}
if ('export' === $step or 'generate_export' === $step) {
if ('export' === $step || 'generate_export' === $step) {
$builder->add('export', ExportType::class, [
'export_alias' => $alias,
'picked_centers' => $exportManager->getPickedCenters($data['centers']),
]);
}
if ('formatter' === $step or 'generate_formatter' === $step) {
if ('formatter' === $step || 'generate_formatter' === $step) {
$builder->add('formatter', FormatterType::class, [
'formatter_alias' => $exportManager
->getFormatterAlias($data['export']),
@@ -388,7 +388,7 @@ class ExportController extends AbstractController
$dataFormatter = $this->session->get('formatter_step_raw', null);
$dataExport = $this->session->get('export_step_raw', null);
if (null === $dataFormatter and $export instanceof \Chill\MainBundle\Export\ExportInterface) {
if (null === $dataFormatter && $export instanceof \Chill\MainBundle\Export\ExportInterface) {
return $this->redirectToRoute('chill_main_export_new', [
'alias' => $alias, 'step' => $this->getNextStep('generate', $export, true),
]);

View File

@@ -57,7 +57,7 @@ class LoadPostalCodes extends AbstractFixture implements OrderedFixtureInterface
1315,INCOURT,BE
1315,INCOURT,BE
1315,INCOURT,BE
1320,BEAUVECHAIN,BE
1320,BEAUVECHAIN,BE
EOF;
private static $postalCodeFrance = <<<'EOF'
@@ -322,7 +322,7 @@ class LoadPostalCodes extends AbstractFixture implements OrderedFixtureInterface
85770,L ILE D ELLE,FR,85111,46.3334258655,-0.919100677098,INSEE
85800,ST GILLES CROIX DE VIE,FR,85222,46.6904708814,-1.91946363327,INSEE
85800,LE FENOUILLER,FR,85088,46.7161264566,-1.89206667498,INSEE
85800,GIVRAND,FR,85100,46.6822701061,-1.8787272243,INSEE
85800,GIVRAND,FR,85100,46.6822701061,-1.8787272243,INSEE
EOF;
public function getOrder()

View File

@@ -353,8 +353,8 @@ class User implements AdvancedUserInterface
public function removeGroupCenter(GroupCenter $groupCenter)
{
if ($this->groupCenters->removeElement($groupCenter) === false) {
throw new RuntimeException(sprintf('The groupCenter could not be removed, '
. 'it seems not to be associated with the user. Aborting.'));
throw new RuntimeException('The groupCenter could not be removed, '
. 'it seems not to be associated with the user. Aborting.');
}
}

View File

@@ -346,7 +346,7 @@ class ExportManager
foreach ($this->exports as $export) {
if (!in_array($export->getType(), $existingTypes)) {
array_push($existingTypes, $export->getType());
$existingTypes[] = $export->getType();
}
}
@@ -675,7 +675,7 @@ class ExportManager
foreach ($this->retrieveUsedAggregators($data) as $alias => $aggregator) {
if (!in_array($aggregator->applyOn(), $usedTypes)) {
array_push($usedTypes, $aggregator->applyOn());
$usedTypes[] = $aggregator->applyOn();
}
}
@@ -718,7 +718,7 @@ class ExportManager
$filter = $this->getFilter($alias);
if (!in_array($filter->applyOn(), $usedTypes)) {
array_push($usedTypes, $filter->applyOn());
$usedTypes[] = $filter->applyOn();
}
}
}

View File

@@ -210,7 +210,7 @@ class Paginator implements PaginatorInterface
public function hasPage($number)
{
return 0 < $number
and $this->countPages() >= $number;
&& $this->countPages() >= $number;
}
/**

View File

@@ -42,7 +42,7 @@ class UserProvider implements UserProviderInterface
->getSingleResult();
} catch (NoResultException $e) {
throw new UsernameNotFoundException(
sprintf('Bad credentials.'),
'Bad credentials.',
0,
$e
);

View File

@@ -57,7 +57,7 @@ class DiscriminatedObjectDenormalizer implements ContextAwareDenormalizerInterfa
}
if (0 === count($context[self::ALLOWED_TYPES] ?? [])) {
throw new LogicException('The context should contains a list of
throw new LogicException('The context should contains a list of
allowed types');
}

View File

@@ -109,7 +109,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase
$this->assertGreaterThanOrEqual(
$nbOfFrom,
$query->getDQLPart('from') !== null ? count($query->getDQLPart('from')) : 0,
"Test that there are equal or more 'from' clause after that the filter has
"Test that there are equal or more 'from' clause after that the filter has
altered the query"
);
$this->assertGreaterThanOrEqual(

View File

@@ -99,7 +99,7 @@ abstract class AbstractFilterTest extends KernelTestCase
$this->assertGreaterThanOrEqual(
$nbOfFrom,
$query->getDQLPart('from') !== null ? count($query->getDQLPart('from')) : 0,
"Test that there are equal or more 'from' clause after that the filter has
"Test that there are equal or more 'from' clause after that the filter has
altered the query"
);
$this->assertGreaterThanOrEqual(

View File

@@ -68,7 +68,7 @@ final class Version20180709181423 extends AbstractMigration
CREATE TRIGGER canonicalize_user_on_update
AFTER UPDATE
ON users
FOR EACH ROW
FOR EACH ROW
EXECUTE PROCEDURE canonicalize_user_on_update();
SQL
);
@@ -91,7 +91,7 @@ final class Version20180709181423 extends AbstractMigration
CREATE TRIGGER canonicalize_user_on_insert
AFTER INSERT
ON users
FOR EACH ROW
FOR EACH ROW
EXECUTE PROCEDURE canonicalize_user_on_insert();
SQL
);

View File

@@ -28,7 +28,7 @@ final class Version20180911093642 extends AbstractMigration
CREATE TRIGGER canonicalize_user_on_update
AFTER UPDATE
ON users
FOR EACH ROW
FOR EACH ROW
EXECUTE PROCEDURE canonicalize_user_on_update();
SQL
);
@@ -43,7 +43,7 @@ final class Version20180911093642 extends AbstractMigration
CREATE TRIGGER canonicalize_user_on_update
AFTER UPDATE
ON users
FOR EACH ROW
FOR EACH ROW
WHEN (pg_trigger_depth() = 0)
EXECUTE PROCEDURE canonicalize_user_on_update();
SQL