mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-11-23 20:37:45 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -12,10 +12,6 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Security\Resolver;
|
||||
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use UnexpectedValueException;
|
||||
|
||||
use function get_class;
|
||||
use function is_array;
|
||||
|
||||
final readonly class CenterResolverManager implements CenterResolverManagerInterface
|
||||
{
|
||||
@@ -38,16 +34,11 @@ final readonly class CenterResolverManager implements CenterResolverManagerInter
|
||||
return [$resolved];
|
||||
}
|
||||
|
||||
if (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,
|
||||
$resolver::class
|
||||
));
|
||||
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, $resolver::class));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace Chill\MainBundle\Security\Resolver;
|
||||
|
||||
use Chill\MainBundle\Entity\HasCenterInterface;
|
||||
use Chill\MainBundle\Entity\HasCentersInterface;
|
||||
use UnexpectedValueException;
|
||||
|
||||
class DefaultCenterResolver implements CenterResolverInterface
|
||||
{
|
||||
@@ -24,7 +23,6 @@ class DefaultCenterResolver implements CenterResolverInterface
|
||||
|
||||
/**
|
||||
* @param HasCenterInterface $entity
|
||||
* @param array $options
|
||||
*/
|
||||
public function resolveCenter($entity, ?array $options = [])
|
||||
{
|
||||
@@ -36,7 +34,7 @@ class DefaultCenterResolver implements CenterResolverInterface
|
||||
return $entity->getCenters();
|
||||
}
|
||||
|
||||
throw new UnexpectedValueException('should be an instanceof');
|
||||
throw new \UnexpectedValueException('should be an instanceof');
|
||||
}
|
||||
|
||||
public function supports($entity, ?array $options = []): bool
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace Chill\MainBundle\Security\Resolver;
|
||||
|
||||
use Chill\MainBundle\Entity\HasScopeInterface;
|
||||
use Chill\MainBundle\Entity\HasScopesInterface;
|
||||
use UnexpectedValueException;
|
||||
|
||||
class DefaultScopeResolver implements ScopeResolverInterface
|
||||
{
|
||||
@@ -40,13 +39,7 @@ class DefaultScopeResolver implements ScopeResolverInterface
|
||||
return $entity->getScopes();
|
||||
}
|
||||
|
||||
throw new UnexpectedValueException(
|
||||
sprintf(
|
||||
'should be an instanceof %s or %s',
|
||||
HasScopesInterface::class,
|
||||
HasScopeInterface::class
|
||||
)
|
||||
);
|
||||
throw new \UnexpectedValueException(sprintf('should be an instanceof %s or %s', HasScopesInterface::class, HasScopeInterface::class));
|
||||
}
|
||||
|
||||
public function supports($entity, ?array $options = []): bool
|
||||
|
||||
@@ -27,8 +27,6 @@ final class ResolverTwigExtension extends \Twig\Extension\AbstractExtension
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $entity
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isScopeConcerned($entity, ?array $options = [])
|
||||
@@ -45,8 +43,6 @@ final class ResolverTwigExtension extends \Twig\Extension\AbstractExtension
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $entity
|
||||
*
|
||||
* @return array|\Chill\MainBundle\Entity\Scope|\Chill\MainBundle\Entity\Scope[]
|
||||
*/
|
||||
public function resolveScope($entity, ?array $options = []): array|\Chill\MainBundle\Entity\Scope
|
||||
|
||||
@@ -33,7 +33,6 @@ final readonly class ScopeResolverDispatcher
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $options
|
||||
* @return Scope|iterable<Scope>|Scope|null
|
||||
*/
|
||||
public function resolveScope(mixed $entity, ?array $options = []): null|\Chill\MainBundle\Entity\Scope|iterable
|
||||
|
||||
@@ -26,24 +26,18 @@ interface ScopeResolverInterface
|
||||
|
||||
/**
|
||||
* Return true if the entity is concerned by scope, false otherwise.
|
||||
*
|
||||
* @param mixed $entity
|
||||
*/
|
||||
public function isConcerned($entity, ?array $options = []): bool;
|
||||
|
||||
/**
|
||||
* Will return the scope for the entity.
|
||||
*
|
||||
* @param mixed $entity
|
||||
*
|
||||
* @return array|Scope|Scope[]
|
||||
*/
|
||||
public function resolveScope($entity, ?array $options = []);
|
||||
|
||||
/**
|
||||
* Return true if this resolve is able to decide "something" on this entity.
|
||||
*
|
||||
* @param mixed $entity
|
||||
*/
|
||||
public function supports($entity, ?array $options = []): bool;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user