apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -19,16 +19,9 @@ use Chill\MainBundle\Timeline\TimelineProviderInterface;
use Chill\MainBundle\Timeline\TimelineSingleQuery;
use Chill\PersonBundle\Entity\Person;
use Doctrine\ORM\EntityManagerInterface;
use LogicException;
use RuntimeException;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Security\Core\User\UserInterface;
use function implode;
use function in_array;
use function strtr;
class TimelineActivityProvider implements TimelineProviderInterface
{
private const SUPPORTED_CONTEXTS = ['center', 'person'];
@@ -42,7 +35,7 @@ class TimelineActivityProvider implements TimelineProviderInterface
protected ActivityACLAwareRepository $aclAwareRepository
) {
if (!$storage->getToken()->getUser() instanceof User) {
throw new RuntimeException('A user should be authenticated !');
throw new \RuntimeException('A user should be authenticated !');
}
$this->user = $storage->getToken()->getUser();
@@ -61,10 +54,10 @@ class TimelineActivityProvider implements TimelineProviderInterface
return TimelineSingleQuery::fromArray([
'id' => $metadataActivity->getTableName()
. '.' . $metadataActivity->getColumnName('id'),
.'.'.$metadataActivity->getColumnName('id'),
'type' => 'activity',
'date' => $metadataActivity->getTableName()
. '.' . $metadataActivity->getColumnName('date'),
.'.'.$metadataActivity->getColumnName('date'),
'FROM' => $this->getFromClausePerson(),
'WHERE' => $where,
'parameters' => $parameters,
@@ -106,17 +99,12 @@ class TimelineActivityProvider implements TimelineProviderInterface
/**
* Check if the context is supported.
*
* @throws LogicException if the context is not supported
* @throws \LogicException if the context is not supported
*/
private function checkContext(string $context)
{
if (false === in_array($context, self::SUPPORTED_CONTEXTS, true)) {
throw new LogicException(
sprintf(
"The context '%s' is not supported. Currently only 'person' is supported",
$context
)
);
if (false === \in_array($context, self::SUPPORTED_CONTEXTS, true)) {
throw new \LogicException(sprintf("The context '%s' is not supported. Currently only 'person' is supported", $context));
}
}
@@ -151,8 +139,8 @@ class TimelineActivityProvider implements TimelineProviderInterface
// loop on reachable scopes
foreach ($reachableScopes as $scope) {
/** @phpstan-ignore-next-line */
if (in_array($scope->getId(), $scopes_ids, true)) {
/* @phpstan-ignore-next-line */
if (\in_array($scope->getId(), $scopes_ids, true)) {
continue;
}
$scopes_ids[] = '?';
@@ -160,13 +148,13 @@ class TimelineActivityProvider implements TimelineProviderInterface
}
return [
strtr(
\strtr(
$whereClause,
[
'{activity.person_id}' => $associationMapping['joinColumns'][0]['name'],
'{activity.scope_id}' => $metadataActivity->getTableName() . '.' .
'{activity.scope_id}' => $metadataActivity->getTableName().'.'.
$metadataActivity->getAssociationMapping('scope')['joinColumns'][0]['name'],
'{scopes_ids}' => implode(', ', $scopes_ids),
'{scopes_ids}' => \implode(', ', $scopes_ids),
]
),
$parameters,