mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 11:03:50 +00:00
apply rector rules: php up to php82
This commit is contained in:
@@ -14,7 +14,7 @@ namespace Chill\DocGeneratorBundle\Context;
|
||||
use Chill\DocGeneratorBundle\Context\Exception\ContextNotFoundException;
|
||||
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
||||
|
||||
final class ContextManager implements ContextManagerInterface
|
||||
final readonly class ContextManager implements ContextManagerInterface
|
||||
{
|
||||
/**
|
||||
* @param \Chill\DocGeneratorBundle\Context\DocGeneratorContextInterface[] $contexts
|
||||
|
@@ -22,7 +22,7 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class AdminDocGeneratorTemplateController extends CRUDController
|
||||
{
|
||||
public function __construct(private ContextManager $contextManager)
|
||||
public function __construct(private readonly ContextManager $contextManager)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -43,7 +43,7 @@ use const JSON_PRETTY_PRINT;
|
||||
|
||||
final class DocGeneratorTemplateController extends AbstractController
|
||||
{
|
||||
public function __construct(private ContextManager $contextManager, private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private GeneratorInterface $generator, private MessageBusInterface $messageBus, private PaginatorFactory $paginatorFactory, private EntityManagerInterface $entityManager)
|
||||
public function __construct(private readonly ContextManager $contextManager, private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly GeneratorInterface $generator, private readonly MessageBusInterface $messageBus, private readonly PaginatorFactory $paginatorFactory, private readonly EntityManagerInterface $entityManager)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -24,7 +24,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class DocGeneratorTemplateType extends AbstractType
|
||||
{
|
||||
public function __construct(private ContextManager $contextManager)
|
||||
public function __construct(private readonly ContextManager $contextManager)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@ use Throwable;
|
||||
*/
|
||||
class TemplateException extends RuntimeException
|
||||
{
|
||||
public function __construct(private array $errors, $code = 0, ?Throwable $previous = null)
|
||||
public function __construct(private readonly array $errors, $code = 0, ?Throwable $previous = null)
|
||||
{
|
||||
parent::__construct('Error while generating document from template', $code, $previous);
|
||||
}
|
||||
|
@@ -24,12 +24,12 @@ use Throwable;
|
||||
|
||||
final class RelatorioDriver implements DriverInterface
|
||||
{
|
||||
private string $url;
|
||||
private readonly string $url;
|
||||
|
||||
public function __construct(
|
||||
private HttpClientInterface $client,
|
||||
private readonly HttpClientInterface $client,
|
||||
ParameterBagInterface $parameterBag,
|
||||
private LoggerInterface $logger
|
||||
private readonly LoggerInterface $logger
|
||||
) {
|
||||
$this->url = $parameterBag->get('chill_doc_generator')['driver']['relatorio']['url'];
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
public function __construct(private TranslatorInterface $translator, private Security $security)
|
||||
public function __construct(private readonly TranslatorInterface $translator, private readonly Security $security)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -19,9 +19,9 @@ use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
||||
final class DocGeneratorTemplateRepository implements ObjectRepository
|
||||
{
|
||||
private EntityRepository $repository;
|
||||
private readonly EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager, private RequestStack $requestStack)
|
||||
public function __construct(EntityManagerInterface $entityManager, private readonly RequestStack $requestStack)
|
||||
{
|
||||
$this->repository = $entityManager->getRepository(DocGeneratorTemplate::class);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ use function is_array;
|
||||
|
||||
class NormalizeNullValueHelper
|
||||
{
|
||||
public function __construct(private NormalizerInterface $normalizer, private ?string $discriminatorType = null, private ?string $discriminatorValue = null)
|
||||
public function __construct(private readonly NormalizerInterface $normalizer, private ?string $discriminatorType = null, private readonly ?string $discriminatorValue = null)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -41,11 +41,11 @@ class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInte
|
||||
{
|
||||
use NormalizerAwareTrait;
|
||||
|
||||
private PropertyAccessor $propertyAccess;
|
||||
private readonly PropertyAccessor $propertyAccess;
|
||||
|
||||
public function __construct(
|
||||
private ClassMetadataFactoryInterface $classMetadataFactory,
|
||||
private TranslatableStringHelperInterface $translatableStringHelper
|
||||
private readonly ClassMetadataFactoryInterface $classMetadataFactory,
|
||||
private readonly TranslatableStringHelperInterface $translatableStringHelper
|
||||
) {
|
||||
$this->propertyAccess = PropertyAccess::createPropertyAccessor();
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
|
||||
class BaseContextData
|
||||
{
|
||||
public function __construct(private NormalizerInterface $normalizer)
|
||||
public function __construct(private readonly NormalizerInterface $normalizer)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,7 @@ class Generator implements GeneratorInterface
|
||||
{
|
||||
private const LOG_PREFIX = '[docgen generator] ';
|
||||
|
||||
public function __construct(private ContextManagerInterface $contextManager, private DriverInterface $driver, private EntityManagerInterface $entityManager, private LoggerInterface $logger, private StoredObjectManagerInterface $storedObjectManager)
|
||||
public function __construct(private readonly ContextManagerInterface $contextManager, private readonly DriverInterface $driver, private readonly EntityManagerInterface $entityManager, private readonly LoggerInterface $logger, private readonly StoredObjectManagerInterface $storedObjectManager)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@ class GeneratorException extends RuntimeException
|
||||
/**
|
||||
* @param string[] $errors
|
||||
*/
|
||||
public function __construct(private array $errors = [], ?Throwable $previous = null)
|
||||
public function __construct(private readonly array $errors = [], ?Throwable $previous = null)
|
||||
{
|
||||
parent::__construct(
|
||||
'Could not generate the document',
|
||||
|
@@ -24,7 +24,7 @@ use Symfony\Component\Mailer\MailerInterface;
|
||||
use Symfony\Component\Messenger\Event\WorkerMessageFailedEvent;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
final class OnGenerationFails implements EventSubscriberInterface
|
||||
final readonly class OnGenerationFails implements EventSubscriberInterface
|
||||
{
|
||||
public const LOG_PREFIX = '[docgen failed] ';
|
||||
|
||||
|
@@ -26,11 +26,11 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
|
||||
*/
|
||||
class RequestGenerationHandler implements MessageHandlerInterface
|
||||
{
|
||||
public const AUTHORIZED_TRIALS = 5;
|
||||
final public const AUTHORIZED_TRIALS = 5;
|
||||
|
||||
private const LOG_PREFIX = '[docgen message handler] ';
|
||||
|
||||
public function __construct(private DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private EntityManagerInterface $entityManager, private Generator $generator, private LoggerInterface $logger, private StoredObjectRepository $storedObjectRepository, private UserRepositoryInterface $userRepository)
|
||||
public function __construct(private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, private readonly EntityManagerInterface $entityManager, private readonly Generator $generator, private readonly LoggerInterface $logger, private readonly StoredObjectRepository $storedObjectRepository, private readonly UserRepositoryInterface $userRepository)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -17,20 +17,20 @@ use Chill\MainBundle\Entity\User;
|
||||
|
||||
class RequestGenerationMessage
|
||||
{
|
||||
private int $creatorId;
|
||||
private readonly int $creatorId;
|
||||
|
||||
private int $templateId;
|
||||
private readonly int $templateId;
|
||||
|
||||
private int $destinationStoredObjectId;
|
||||
private readonly int $destinationStoredObjectId;
|
||||
|
||||
private \DateTimeImmutable $createdAt;
|
||||
private readonly \DateTimeImmutable $createdAt;
|
||||
|
||||
public function __construct(
|
||||
User $creator,
|
||||
DocGeneratorTemplate $template,
|
||||
private int $entityId,
|
||||
private readonly int $entityId,
|
||||
StoredObject $destinationStoredObject,
|
||||
private array $contextGenerationData
|
||||
private readonly array $contextGenerationData
|
||||
) {
|
||||
$this->creatorId = $creator->getId();
|
||||
$this->templateId = $template->getId();
|
||||
|
@@ -135,7 +135,7 @@ final class DocGenObjectNormalizerTest extends KernelTestCase
|
||||
$this->assertEquals($expected, $actual, 'test normalization for a null scope');
|
||||
}
|
||||
|
||||
public function testNormalizeNullObjectWithObjectEmbedded()
|
||||
public function testNormalizeNullObjectWithObjectEmbedded(): never
|
||||
{
|
||||
$this->markTestIncomplete('test to implement');
|
||||
$normalized = $this->normalizer->normalize(null, 'docgen', [
|
||||
@@ -154,7 +154,7 @@ final class DocGenObjectNormalizerTest extends KernelTestCase
|
||||
$this->assertEquals($expected, $normalized, 'test normalization for a null user');
|
||||
}
|
||||
|
||||
public function testNormalizeWithNullValueEmbedded()
|
||||
public function testNormalizeWithNullValueEmbedded(): never
|
||||
{
|
||||
$this->markTestIncomplete('test to write');
|
||||
$user = new User();
|
||||
|
Reference in New Issue
Block a user