mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 07:33:50 +00:00
apply rector rules: php up to php82
This commit is contained in:
@@ -20,7 +20,7 @@ use Symfony\Component\Security\Core\Security;
|
||||
|
||||
class StoredObjectApiController
|
||||
{
|
||||
public function __construct(private Security $security)
|
||||
public function __construct(private readonly Security $security)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -36,9 +36,9 @@ use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
class StoredObject implements AsyncFileInterface, Document, TrackCreationInterface
|
||||
{
|
||||
use TrackCreationTrait;
|
||||
public const STATUS_READY = "ready";
|
||||
public const STATUS_PENDING = "pending";
|
||||
public const STATUS_FAILURE = "failure";
|
||||
final public const STATUS_READY = "ready";
|
||||
final public const STATUS_PENDING = "pending";
|
||||
final public const STATUS_FAILURE = "failure";
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json", name="datas")
|
||||
|
@@ -26,7 +26,7 @@ class DocumentCategoryType extends AbstractType
|
||||
{
|
||||
// TODO faire un service dans CHillMain
|
||||
foreach ($kernelBundles as $key => $value) {
|
||||
if (str_starts_with($key, 'Chill')) {
|
||||
if (str_starts_with((string) $key, 'Chill')) {
|
||||
$this->chillBundlesFlipped[$value] = $key;
|
||||
}
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class PersonDocumentType extends AbstractType
|
||||
{
|
||||
public function __construct(private TranslatableStringHelperInterface $translatableStringHelper, private ScopeResolverDispatcher $scopeResolverDispatcher, private ParameterBagInterface $parameterBag, private CenterResolverDispatcher $centerResolverDispatcher)
|
||||
public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly ScopeResolverDispatcher $scopeResolverDispatcher, private readonly ParameterBagInterface $parameterBag, private readonly CenterResolverDispatcher $centerResolverDispatcher)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -57,20 +57,20 @@ class StoredObjectType extends AbstractType
|
||||
$builder
|
||||
->get('keyInfos')
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
[$this, 'transform'],
|
||||
[$this, 'reverseTransform']
|
||||
$this->transform(...),
|
||||
$this->reverseTransform(...)
|
||||
));
|
||||
$builder
|
||||
->get('iv')
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
[$this, 'transform'],
|
||||
[$this, 'reverseTransform']
|
||||
$this->transform(...),
|
||||
$this->reverseTransform(...)
|
||||
));
|
||||
|
||||
$builder
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
[$this, 'transformObject'],
|
||||
[$this, 'reverseTransformObject']
|
||||
$this->transformObject(...),
|
||||
$this->reverseTransformObject(...)
|
||||
));
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ class StoredObjectType extends AbstractType
|
||||
return null;
|
||||
}
|
||||
|
||||
return json_decode($value, true, 512, JSON_THROW_ON_ERROR);
|
||||
return json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR);
|
||||
}
|
||||
|
||||
public function reverseTransformObject($object)
|
||||
|
@@ -118,7 +118,7 @@ final readonly class Manager
|
||||
foreach ($this->connection->iterateAssociative($runSql, $runParams, $runTypes) as $row) {
|
||||
yield new GenericDocDTO(
|
||||
$row['key'],
|
||||
json_decode($row['identifiers'], true, 512, JSON_THROW_ON_ERROR),
|
||||
json_decode((string) $row['identifiers'], true, 512, JSON_THROW_ON_ERROR),
|
||||
new \DateTimeImmutable($row['doc_date']),
|
||||
$linked,
|
||||
);
|
||||
|
@@ -19,7 +19,7 @@ use LogicException;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
final class MenuBuilder implements LocalMenuBuilderInterface
|
||||
final readonly class MenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
public function __construct(private Security $security, private TranslatorInterface $translator)
|
||||
{
|
||||
|
@@ -20,9 +20,9 @@ use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
class AccompanyingCourseDocumentRepository implements ObjectRepository
|
||||
{
|
||||
private EntityRepository $repository;
|
||||
private readonly EntityRepository $repository;
|
||||
|
||||
public function __construct(private EntityManagerInterface $em)
|
||||
public function __construct(private readonly EntityManagerInterface $em)
|
||||
{
|
||||
$this->repository = $em->getRepository(AccompanyingCourseDocument::class);
|
||||
}
|
||||
|
@@ -21,9 +21,9 @@ use Doctrine\Persistence\ObjectRepository;
|
||||
*/
|
||||
class DocumentCategoryRepository implements ObjectRepository
|
||||
{
|
||||
private EntityRepository $repository;
|
||||
private readonly EntityRepository $repository;
|
||||
|
||||
public function __construct(private EntityManagerInterface $em)
|
||||
public function __construct(private readonly EntityManagerInterface $em)
|
||||
{
|
||||
$this->repository = $em->getRepository(DocumentCategory::class);
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ use Doctrine\Persistence\ObjectRepository;
|
||||
|
||||
final class StoredObjectRepository implements ObjectRepository
|
||||
{
|
||||
private EntityRepository $repository;
|
||||
private readonly EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
@@ -27,15 +27,15 @@ use function in_array;
|
||||
|
||||
class AccompanyingCourseDocumentVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
|
||||
{
|
||||
public const CREATE = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_CREATE';
|
||||
final public const CREATE = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_CREATE';
|
||||
|
||||
public const DELETE = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_DELETE';
|
||||
final public const DELETE = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_DELETE';
|
||||
|
||||
public const SEE = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE';
|
||||
final public const SEE = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE';
|
||||
|
||||
public const SEE_DETAILS = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE_DETAILS';
|
||||
final public const SEE_DETAILS = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_SEE_DETAILS';
|
||||
|
||||
public const UPDATE = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE';
|
||||
final public const UPDATE = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_UPDATE';
|
||||
|
||||
protected VoterHelperInterface $voterHelper;
|
||||
|
||||
|
@@ -25,15 +25,15 @@ use Symfony\Component\Security\Core\Security;
|
||||
|
||||
class PersonDocumentVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
|
||||
{
|
||||
public const CREATE = 'CHILL_PERSON_DOCUMENT_CREATE';
|
||||
final public const CREATE = 'CHILL_PERSON_DOCUMENT_CREATE';
|
||||
|
||||
public const DELETE = 'CHILL_PERSON_DOCUMENT_DELETE';
|
||||
final public const DELETE = 'CHILL_PERSON_DOCUMENT_DELETE';
|
||||
|
||||
public const SEE = 'CHILL_PERSON_DOCUMENT_SEE';
|
||||
final public const SEE = 'CHILL_PERSON_DOCUMENT_SEE';
|
||||
|
||||
public const SEE_DETAILS = 'CHILL_PERSON_DOCUMENT_SEE_DETAILS';
|
||||
final public const SEE_DETAILS = 'CHILL_PERSON_DOCUMENT_SEE_DETAILS';
|
||||
|
||||
public const UPDATE = 'CHILL_PERSON_DOCUMENT_UPDATE';
|
||||
final public const UPDATE = 'CHILL_PERSON_DOCUMENT_UPDATE';
|
||||
|
||||
protected VoterHelperInterface $voterHelper;
|
||||
|
||||
|
@@ -22,7 +22,7 @@ class StoredObjectDenormalizer implements DenormalizerInterface
|
||||
{
|
||||
use ObjectToPopulateTrait;
|
||||
|
||||
public function __construct(private StoredObjectRepository $storedObjectRepository)
|
||||
public function __construct(private readonly StoredObjectRepository $storedObjectRepository)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -35,7 +35,7 @@ final class StoredObjectManager implements StoredObjectManagerInterface
|
||||
|
||||
private array $inMemory = [];
|
||||
|
||||
public function __construct(private HttpClientInterface $client, private TempUrlGeneratorInterface $tempUrlGenerator)
|
||||
public function __construct(private readonly HttpClientInterface $client, private readonly TempUrlGeneratorInterface $tempUrlGenerator)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@ use Twig\Extension\RuntimeExtensionInterface;
|
||||
|
||||
use function in_array;
|
||||
|
||||
final class WopiEditTwigExtensionRuntime implements RuntimeExtensionInterface
|
||||
final readonly class WopiEditTwigExtensionRuntime implements RuntimeExtensionInterface
|
||||
{
|
||||
public const SUPPORTED_MIMES = [
|
||||
'image/svg+xml',
|
||||
@@ -151,7 +151,7 @@ final class WopiEditTwigExtensionRuntime implements RuntimeExtensionInterface
|
||||
'document_json' => $this->normalizer->normalize($document, 'json', [AbstractNormalizer::GROUPS => ['read']]),
|
||||
'title' => $title,
|
||||
'can_edit' => $canEdit,
|
||||
'options' => array_merge(self::DEFAULT_OPTIONS_TEMPLATE_BUTTON_GROUP, $options),
|
||||
'options' => [...self::DEFAULT_OPTIONS_TEMPLATE_BUTTON_GROUP, ...$options],
|
||||
]);
|
||||
}
|
||||
|
||||
|
@@ -22,14 +22,14 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandlerInterface
|
||||
{
|
||||
private EntityRepository $repository;
|
||||
private readonly EntityRepository $repository;
|
||||
|
||||
/**
|
||||
* TODO: injecter le repository directement.
|
||||
*/
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
private TranslatorInterface $translator
|
||||
private readonly TranslatorInterface $translator
|
||||
) {
|
||||
$this->repository = $em->getRepository(AccompanyingCourseDocument::class);
|
||||
}
|
||||
|
Reference in New Issue
Block a user