cs: Fix code style (safe rules only).

This commit is contained in:
Pol Dellaiera
2021-11-23 14:06:38 +01:00
parent 149d7ce991
commit 8f96a1121d
1223 changed files with 65199 additions and 64625 deletions

View File

@@ -1,10 +1,19 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Security\Resolver;
use Chill\MainBundle\Entity\Center;
use UnexpectedValueException;
use function is_array;
final class CenterResolverManager implements CenterResolverManagerInterface
{
@@ -20,19 +29,28 @@ final class CenterResolverManager implements CenterResolverManagerInterface
public function resolveCenters($entity, ?array $options = []): array
{
foreach($this->resolvers as $resolver) {
foreach ($this->resolvers as $resolver) {
if ($resolver->supports($entity, $options)) {
$resolved = $resolver->resolveCenter($entity, $options);
if (null === $resolved) {
return [];
} elseif ($resolved instanceof Center) {
}
if ($resolved instanceof Center) {
return [$resolved];
} elseif (\is_array($resolved)) {
}
if (is_array($resolved)) {
return $resolved;
}
throw new \UnexpectedValueException(sprintf("the return type of a %s should be an instance of %s, an array or null. Resolver is %s",
CenterResolverInterface::class, Center::class, get_class($resolver)));
throw new UnexpectedValueException(sprintf(
'the return type of a %s should be an instance of %s, an array or null. Resolver is %s',
CenterResolverInterface::class,
Center::class,
get_class($resolver)
));
}
}