DX: apply rector rules up to php8.0

This commit is contained in:
2023-04-15 01:05:37 +02:00
parent d8870e906f
commit dde3002100
714 changed files with 2348 additions and 9263 deletions

View File

@@ -14,13 +14,10 @@ namespace Chill\MainBundle\Security\Resolver;
final class CenterResolverDispatcher implements CenterResolverDispatcherInterface
{
/**
* @var CenterResolverInterface[]
* @param \Chill\MainBundle\Security\Resolver\CenterResolverInterface[] $resolvers
*/
private iterable $resolvers;
public function __construct(iterable $resolvers = [])
public function __construct(private iterable $resolvers = [])
{
$this->resolvers = $resolvers;
}
public function resolveCenter($entity, ?array $options = [])

View File

@@ -20,13 +20,10 @@ use function is_array;
final class CenterResolverManager implements CenterResolverManagerInterface
{
/**
* @var CenterResolverInterface[]
* @param \Chill\MainBundle\Security\Resolver\CenterResolverInterface[] $resolvers
*/
private iterable $resolvers;
public function __construct(iterable $resolvers = [])
public function __construct(private iterable $resolvers = [])
{
$this->resolvers = $resolvers;
}
public function resolveCenters($entity, ?array $options = []): array
@@ -51,7 +48,7 @@ final class CenterResolverManager implements CenterResolverManagerInterface
'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)
$resolver::class
));
}
}

View File

@@ -15,14 +15,8 @@ use Twig\TwigFilter;
final class ResolverTwigExtension extends \Twig\Extension\AbstractExtension
{
private CenterResolverManagerInterface $centerResolverDispatcher;
private ScopeResolverDispatcher $scopeResolverDispatcher;
public function __construct(CenterResolverManagerInterface $centerResolverDispatcher, ScopeResolverDispatcher $scopeResolverDispatcher)
public function __construct(private CenterResolverManagerInterface $centerResolverDispatcher, private ScopeResolverDispatcher $scopeResolverDispatcher)
{
$this->centerResolverDispatcher = $centerResolverDispatcher;
$this->scopeResolverDispatcher = $scopeResolverDispatcher;
}
public function getFilters()
@@ -45,11 +39,9 @@ final class ResolverTwigExtension extends \Twig\Extension\AbstractExtension
}
/**
* @param mixed $entity
*
* @return Center|Center[]|null
*/
public function resolveCenter($entity, ?array $options = [])
public function resolveCenter(mixed $entity, ?array $options = [])
{
return $this->centerResolverDispatcher->resolveCenters($entity, $options);
}
@@ -59,7 +51,7 @@ final class ResolverTwigExtension extends \Twig\Extension\AbstractExtension
*
* @return array|\Chill\MainBundle\Entity\Scope|\Chill\MainBundle\Entity\Scope[]
*/
public function resolveScope($entity, ?array $options = [])
public function resolveScope($entity, ?array $options = []): array|\Chill\MainBundle\Entity\Scope
{
return $this->scopeResolverDispatcher->resolveScope();
}

View File

@@ -17,13 +17,10 @@ use Doctrine\Common\Collections\Collection;
final class ScopeResolverDispatcher
{
/**
* @var iterable|ScopeResolverInterface[]
* @param \Chill\MainBundle\Security\Resolver\ScopeResolverInterface[] $resolvers
*/
private iterable $resolvers;
public function __construct(iterable $resolvers)
public function __construct(private iterable $resolvers)
{
$this->resolvers = $resolvers;
}
public function isConcerned($entity, ?array $options = []): bool
@@ -42,7 +39,7 @@ final class ScopeResolverDispatcher
*
* @return iterable|Scope|Scope[]
*/
public function resolveScope($entity, ?array $options = [])
public function resolveScope($entity, ?array $options = []): iterable|\Chill\MainBundle\Entity\Scope|array
{
foreach ($this->resolvers as $resolver) {
if ($resolver->supports($entity, $options)) {