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

@@ -30,29 +30,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class CustomFieldType extends AbstractType
{
/**
* @var CustomFieldProvider
*/
private $customFieldProvider;
/**
* @var ObjectManager
*/
private $om;
/**
* @var TranslatableStringHelper
*/
private $translatableStringHelper;
public function __construct(
CustomFieldProvider $compiler,
ObjectManager $om,
TranslatableStringHelper $translatableStringHelper
) {
$this->customFieldProvider = $compiler;
$this->om = $om;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private CustomFieldProvider $customFieldProvider, private ObjectManager $om, private TranslatableStringHelper $translatableStringHelper)
{
}
public function buildForm(FormBuilderInterface $builder, array $options)

View File

@@ -25,17 +25,11 @@ use function count;
class CustomFieldsGroupType extends AbstractType
{
private $customizableEntities; //TODO : add comment about this variable
/**
* @var \Symfony\Component\Translation\TranslatorInterface
*/
private $translator;
public function __construct(array $customizableEntities, TranslatorInterface $translator)
{
$this->customizableEntities = $customizableEntities;
$this->translator = $translator;
public function __construct(
private array $customizableEntities,
//TODO : add comment about this variable
private TranslatorInterface $translator
) {
}
//TODO : details about the function

View File

@@ -17,19 +17,8 @@ use Symfony\Component\Form\DataTransformerInterface;
class CustomFieldDataTransformer implements DataTransformerInterface
{
/**
* @var \Chill\CustomFieldsBundle\Entity\CustomField
*/
private $customField;
private $customFieldDefinition;
public function __construct(
CustomFieldInterface $customFieldDefinition,
CustomField $customField
) {
$this->customFieldDefinition = $customFieldDefinition;
$this->customField = $customField;
public function __construct(private CustomFieldInterface $customFieldDefinition, private CustomField $customField)
{
}
public function reverseTransform($value)

View File

@@ -20,14 +20,8 @@ use function gettype;
class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
{
/**
* @var ObjectManager
*/
private $om;
public function __construct(ObjectManager $om)
public function __construct(private ObjectManager $om)
{
$this->om = $om;
}
/**
@@ -36,10 +30,8 @@ class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
* @param string $id
*
* @throws TransformationFailedException if object (report) is not found.
*
* @return CustomFieldsGroup|null
*/
public function reverseTransform($id)
public function reverseTransform($id): ?\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup
{
if (!$id) {
return null;

View File

@@ -26,12 +26,8 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
{
private array $customField;
private ObjectManager $om;
public function __construct(ObjectManager $om)
public function __construct(private ObjectManager $om)
{
$this->om = $om;
$customFields = $this->om
->getRepository(CustomField::class)
->findAll();
@@ -72,13 +68,13 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
if (array_key_exists($key, $this->customField)) {
$type = $this->customField[$key]->getType();
if (strpos($type, 'ManyToOne') === 0) {
if (str_starts_with($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 (strpos($type, 'ManyToOnePersist') === 0) {
if (str_starts_with($type, 'ManyToOnePersist')) {
// PEUT ETRE A FAIRE SI SEULEMENT $value->getId() ne renvoie rien...
//
//
@@ -127,8 +123,8 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
if (array_key_exists($key, $this->customField)) {
$type = $this->customField[$key]->getType();
if (strpos($type, 'ManyToOne') === 0) {
if (strpos($type, 'ManyToOnePersist') === 0) {
if (str_starts_with($type, 'ManyToOne')) {
if (str_starts_with($type, 'ManyToOnePersist')) {
$entityClass = substr($type, 17, -1);
} else {
$entityClass = substr($type, 10, -1);

View File

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

View File

@@ -46,14 +46,8 @@ class LinkedCustomFieldsType extends AbstractType
*/
private $options = [];
/**
* @var TranslatableStringHelper
*/
private $translatableStringHelper;
public function __construct(TranslatableStringHelper $helper)
public function __construct(private TranslatableStringHelper $translatableStringHelper)
{
$this->translatableStringHelper = $helper;
}
/**