Upgrade code from 146 to new standards

This commit is contained in:
2023-10-16 18:04:40 +02:00
parent 8523f14214
commit 6b8d6b76ba
38 changed files with 56 additions and 62 deletions

View File

@@ -66,7 +66,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface
*
* @return User[]
*/
public function findUsersReaching(string $role, array|\Chill\MainBundle\Entity\Center $center, array|\Chill\MainBundle\Entity\Scope|null $scope = null, bool $onlyEnabled = true): array
public function findUsersReaching(string $role, array|\Chill\MainBundle\Entity\Center $center, null|array|\Chill\MainBundle\Entity\Scope $scope = null, bool $onlyEnabled = true): array
{
return $this->userACLAwareRepository
->findUsersByReachedACL($role, $center, $scope, $onlyEnabled);
@@ -130,7 +130,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface
* @param Center|Center[] $center
* @return Scope[]
*/
public function getReachableCircles(UserInterface $user, string $role, \Chill\MainBundle\Entity\Center|array $center)
public function getReachableCircles(UserInterface $user, string $role, array|\Chill\MainBundle\Entity\Center $center)
{
$scopes = [];
@@ -162,7 +162,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface
/**
* Return all reachable scope for a given user, center and role.
*/
public function getReachableScopes(UserInterface $user, string $role, Center|array $center): array
public function getReachableScopes(UserInterface $user, string $role, array|Center $center): array
{
return $this->getReachableCircles($user, $role, $center);
}
@@ -172,7 +172,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface
*
* @param Center|Center[] $center May be an array of center
*/
public function userCanReachCenter(User $user, \Chill\MainBundle\Entity\Center|array $center): bool
public function userCanReachCenter(User $user, array|\Chill\MainBundle\Entity\Center $center): bool
{
if ($center instanceof Traversable) {
foreach ($center as $c) {

View File

@@ -29,5 +29,5 @@ interface AuthorizationHelperInterface
* @param Center|array<Center> $center
* @return list<Scope>
*/
public function getReachableScopes(UserInterface $user, string $role, Center|array $center): array;
public function getReachableScopes(UserInterface $user, string $role, array|Center $center): array;
}

View File

@@ -33,11 +33,10 @@ final readonly class ScopeResolverDispatcher
}
/**
* @param mixed $entity
* @param array|null $options
* @return iterable<Scope>|Scope|null
*/
public function resolveScope(mixed $entity, ?array $options = []): iterable|\Chill\MainBundle\Entity\Scope|null
public function resolveScope(mixed $entity, ?array $options = []): null|\Chill\MainBundle\Entity\Scope|iterable
{
foreach ($this->resolvers as $resolver) {
if ($resolver->supports($entity, $options)) {