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

@@ -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