mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 19:13:49 +00:00
fix: SA: Fix "Call to sprintf" rule.
SA stands for Static Analysis.
This commit is contained in:
@@ -33,12 +33,12 @@ class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
|
||||
if (null === $customFieldsGroup) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
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),
|
||||
. '%s given (value : %s)', gettype($customFieldsGroup),
|
||||
$customFieldsGroup));
|
||||
}
|
||||
|
||||
@@ -57,26 +57,31 @@ class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
|
||||
if (!$id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if ($id instanceof CustomFieldsGroup) {
|
||||
throw new TransformationFailedException(sprintf(
|
||||
throw new TransformationFailedException(
|
||||
sprintf(
|
||||
'The transformation failed: the expected argument on '
|
||||
. 'reverseTransform is an object of type int,'
|
||||
. 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup, '
|
||||
. 'given', gettype($id)));
|
||||
. 'given'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$customFieldsGroup = $this->om
|
||||
->getRepository('ChillCustomFieldsBundle:customFieldsGroup')->find($id)
|
||||
->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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user