apply rules rector up to php82

This commit is contained in:
2023-05-01 21:39:45 +02:00
parent 81e8928344
commit 6d63177ff4
733 changed files with 1257 additions and 1322 deletions

View File

@@ -30,7 +30,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class CustomFieldType extends AbstractType
{
public function __construct(private CustomFieldProvider $customFieldProvider, private ObjectManager $om, private TranslatableStringHelper $translatableStringHelper)
public function __construct(private readonly CustomFieldProvider $customFieldProvider, private readonly ObjectManager $om, private readonly TranslatableStringHelper $translatableStringHelper)
{
}

View File

@@ -26,9 +26,9 @@ use function count;
class CustomFieldsGroupType extends AbstractType
{
public function __construct(
private array $customizableEntities,
private readonly array $customizableEntities,
//TODO : add comment about this variable
private TranslatorInterface $translator
private readonly TranslatorInterface $translator
) {
}

View File

@@ -17,7 +17,7 @@ use Symfony\Component\Form\DataTransformerInterface;
class CustomFieldDataTransformer implements DataTransformerInterface
{
public function __construct(private CustomFieldInterface $customFieldDefinition, private CustomField $customField)
public function __construct(private readonly CustomFieldInterface $customFieldDefinition, private readonly CustomField $customField)
{
}

View File

@@ -20,7 +20,7 @@ use function gettype;
class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
{
public function __construct(private ObjectManager $om)
public function __construct(private readonly ObjectManager $om)
{
}

View File

@@ -24,9 +24,9 @@ use const JSON_THROW_ON_ERROR;
*/
class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
{
private array $customField;
private readonly array $customField;
public function __construct(private ObjectManager $om)
public function __construct(private readonly ObjectManager $om)
{
$customFields = $this->om
->getRepository(CustomField::class)
@@ -68,13 +68,13 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
if (array_key_exists($key, $this->customField)) {
$type = $this->customField[$key]->getType();
if (str_starts_with($type, 'ManyToOne')) {
if (str_starts_with((string) $type, 'ManyToOne')) {
// pour le manytoone() faire
// un update du form en js ? : http://symfony.com/fr/doc/current/cookbook/form/form_collections.html
//
//$entityClass = substr($type, 10, -1);
//echo $entityClasss;
if (str_starts_with($type, 'ManyToOnePersist')) {
if (str_starts_with((string) $type, 'ManyToOnePersist')) {
// PEUT ETRE A FAIRE SI SEULEMENT $value->getId() ne renvoie rien...
//
//
@@ -112,7 +112,7 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
if (null === $customFieldsJSON) {
$customFieldsArray = [];
} else {
$customFieldsArray = json_decode($customFieldsJSON, true, 512, JSON_THROW_ON_ERROR);
$customFieldsArray = json_decode((string) $customFieldsJSON, true, 512, JSON_THROW_ON_ERROR);
}
$customFieldsArrayRet = [];
@@ -123,11 +123,11 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
if (array_key_exists($key, $this->customField)) {
$type = $this->customField[$key]->getType();
if (str_starts_with($type, 'ManyToOne')) {
if (str_starts_with($type, 'ManyToOnePersist')) {
$entityClass = substr($type, 17, -1);
if (str_starts_with((string) $type, 'ManyToOne')) {
if (str_starts_with((string) $type, 'ManyToOnePersist')) {
$entityClass = substr((string) $type, 17, -1);
} else {
$entityClass = substr($type, 10, -1);
$entityClass = substr((string) $type, 10, -1);
}
$customFieldsArrayRet[$key] = $this->om

View File

@@ -24,7 +24,7 @@ class CustomFieldType extends AbstractType
*/
private $customFieldCompiler;
public function __construct(private ObjectManager $om, CustomFieldProvider $compiler)
public function __construct(private readonly ObjectManager $om, CustomFieldProvider $compiler)
{
$this->customFieldCompiler = $compiler;
}

View File

@@ -46,7 +46,7 @@ class LinkedCustomFieldsType extends AbstractType
*/
private $options = [];
public function __construct(private TranslatableStringHelper $translatableStringHelper)
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper)
{
}
@@ -93,7 +93,7 @@ class LinkedCustomFieldsType extends AbstractType
$builder->addEventListener(
FormEvents::POST_SET_DATA,
[$this, 'appendChoice']
$this->appendChoice(...)
);
}