apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -15,10 +15,6 @@ use Chill\CustomFieldsBundle\Entity\CustomField;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\Form\DataTransformerInterface;
use function array_key_exists;
use const JSON_THROW_ON_ERROR;
/**
* Not in use ? Deprecated ?
*/
@@ -58,22 +54,22 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
echo "<br> - - 9 - <br>";
*/
//var_dump($customFieldsArray);
// var_dump($customFieldsArray);
$customFieldsArrayRet = [];
foreach ($customFieldsArray as $key => $value) {
$traited = false;
if (array_key_exists($key, $this->customField)) {
if (\array_key_exists($key, $this->customField)) {
$type = $this->customField[$key]->getType();
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;
// $entityClass = substr($type, 10, -1);
// echo $entityClasss;
if (str_starts_with((string) $type, 'ManyToOnePersist')) {
// PEUT ETRE A FAIRE SI SEULEMENT $value->getId() ne renvoie rien...
//
@@ -100,9 +96,9 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
}
}
//echo json_encode($customFieldsArrayRet);
// echo json_encode($customFieldsArrayRet);
return json_encode($customFieldsArrayRet, JSON_THROW_ON_ERROR);
return json_encode($customFieldsArrayRet, \JSON_THROW_ON_ERROR);
}
public function transform($customFieldsJSON)
@@ -112,7 +108,7 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
if (null === $customFieldsJSON) {
$customFieldsArray = [];
} else {
$customFieldsArray = json_decode((string) $customFieldsJSON, true, 512, JSON_THROW_ON_ERROR);
$customFieldsArray = json_decode((string) $customFieldsJSON, true, 512, \JSON_THROW_ON_ERROR);
}
$customFieldsArrayRet = [];
@@ -120,7 +116,7 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
foreach ($customFieldsArray as $key => $value) {
$traited = false;
if (array_key_exists($key, $this->customField)) {
if (\array_key_exists($key, $this->customField)) {
$type = $this->customField[$key]->getType();
if (str_starts_with((string) $type, 'ManyToOne')) {
@@ -131,7 +127,7 @@ class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
}
$customFieldsArrayRet[$key] = $this->om
->getRepository('ChillCustomFieldsBundle:' . $entityClass)
->getRepository('ChillCustomFieldsBundle:'.$entityClass)
->findOneById($value);
$traited = true;
} elseif ('ManyToMany(Adress)' === $type) {