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

@@ -16,8 +16,6 @@ use Doctrine\Persistence\ObjectManager;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use function gettype;
class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
{
public function __construct(private readonly ObjectManager $om) {}
@@ -25,35 +23,25 @@ class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
/**
* Transforms a string (id) to an object (CustomFieldsGroup).
*
* @param string $id
* @param string $id
*
* @throws TransformationFailedException if object (report) is not found.
* @throws TransformationFailedException if object (report) is not found
*/
public function reverseTransform($id): ?\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup
public function reverseTransform($id): ?CustomFieldsGroup
{
if (!$id) {
return null;
}
if ($id instanceof CustomFieldsGroup) {
throw new TransformationFailedException(
'The transformation failed: the expected argument on '
. 'reverseTransform is an object of type int,'
. 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup, '
. 'given'
);
throw new TransformationFailedException('The transformation failed: the expected argument on reverseTransform is an object of type int,Chill\CustomFieldsBundle\Entity\CustomFieldsGroup, given');
}
$customFieldsGroup = $this->om
->getRepository(CustomFieldsGroup::class)->find($id);
if (null === $customFieldsGroup) {
throw new TransformationFailedException(
sprintf(
'Le group avec le numéro "%s" ne peut pas être trouvé!',
$id
)
);
throw new TransformationFailedException(sprintf('Le group avec le numéro "%s" ne peut pas être trouvé!', $id));
}
return $customFieldsGroup;
@@ -62,7 +50,7 @@ class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
/**
* Transforms an custom_field_group to a string (id).
*
* @param CustomFieldsGroup|null $customFieldsGroup
* @param CustomFieldsGroup|null $customFieldsGroup
*
* @return string
*/
@@ -73,14 +61,7 @@ class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
}
if (!$customFieldsGroup instanceof CustomFieldsGroup) {
throw new TransformationFailedException(sprintf(
'Transformation failed: '
. 'the expected type of the transforme function is an '
. 'object of type Chill\CustomFieldsBundle\Entity\CustomFieldsGroup, '
. '%s given (value : %s)',
gettype($customFieldsGroup),
$customFieldsGroup
));
throw new TransformationFailedException(sprintf('Transformation failed: the expected type of the transforme function is an object of type Chill\CustomFieldsBundle\Entity\CustomFieldsGroup, %s given (value : %s)', \gettype($customFieldsGroup), $customFieldsGroup));
}
return $customFieldsGroup->getId();