cs: Enable more risky rules.

This commit is contained in:
Pol Dellaiera
2021-11-30 11:37:57 +01:00
parent c8195e6df5
commit a9188355c5
193 changed files with 306 additions and 63 deletions

View File

@@ -22,8 +22,11 @@ use LogicException;
use Symfony\Component\Security\Core\Security;
use UnexpectedValueException;
use function array_fill;
use function array_key_exists;
use function array_merge;
use function count;
use function implode;
use function in_array;
use function strtr;
/**
@@ -236,7 +239,7 @@ break;
$askedCenters = $args['centers'];
foreach ($reachableCenters as $center) {
if (false === \in_array($center, $askedCenters)) {
if (false === in_array($center, $askedCenters)) {
continue;
}
@@ -246,14 +249,14 @@ break;
$scopeIds = [];
foreach ($this->helper->getReachableScopes($this->security->getUser(), $role, $center) as $scope) {
if (\in_array($scope->getId(), $scopeIds)) {
if (in_array($scope->getId(), $scopeIds)) {
continue;
}
$scopeIds[] = $scope->getId();
}
$formattedClauses[] = strtr($centerScopesClause, [
'{scopes_ids}' => implode(', ', array_fill(0, \count($scopeIds), '?')),
'{scopes_ids}' => implode(', ', array_fill(0, count($scopeIds), '?')),
]);
// append $scopeIds to parameters
$parameters = array_merge($parameters, $scopeIds);
@@ -294,7 +297,7 @@ break;
$scopes = $this->helper->getReachableScopes($this->security->getUser(), $role, $args['person']->getCenter());
foreach ($scopes as $scope) {
if (\in_array($scope->getId(), $parameters)) {
if (in_array($scope->getId(), $parameters)) {
continue;
}
@@ -315,7 +318,7 @@ break;
'{scopes_id}' => $reportScopeId,
'{scopes_ids}' => implode(
', ',
array_fill(0, \count($parameters) - 1, '?')
array_fill(0, count($parameters) - 1, '?')
),
]
),