mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 23:53:50 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -18,26 +18,24 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Form\DataTransformer;
|
||||
|
||||
use Closure;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
use Symfony\Component\Form\DataTransformerInterface;
|
||||
use Symfony\Component\Form\Exception\TransformationFailedException;
|
||||
use function call_user_func;
|
||||
|
||||
/**
|
||||
* @template T
|
||||
*/
|
||||
class IdToEntityDataTransformer implements DataTransformerInterface
|
||||
{
|
||||
private readonly Closure $getId;
|
||||
private readonly \Closure $getId;
|
||||
|
||||
/**
|
||||
* @param Closure $getId
|
||||
* @param \Closure $getId
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly ObjectRepository $repository,
|
||||
private readonly bool $multiple = false,
|
||||
?callable $getId = null
|
||||
callable $getId = null
|
||||
) {
|
||||
$this->getId = $getId ?? static fn (object $o) => $o->getId();
|
||||
}
|
||||
@@ -82,7 +80,7 @@ class IdToEntityDataTransformer implements DataTransformerInterface
|
||||
$ids = [];
|
||||
|
||||
foreach ($value as $v) {
|
||||
$ids[] = $id = call_user_func($this->getId, $v);
|
||||
$ids[] = $id = \call_user_func($this->getId, $v);
|
||||
|
||||
if (null === $id) {
|
||||
throw new TransformationFailedException('id is null');
|
||||
@@ -96,7 +94,7 @@ class IdToEntityDataTransformer implements DataTransformerInterface
|
||||
return '';
|
||||
}
|
||||
|
||||
$id = call_user_func($this->getId, $value);
|
||||
$id = \call_user_func($this->getId, $value);
|
||||
|
||||
if (null === $id) {
|
||||
throw new TransformationFailedException('id is null');
|
||||
|
Reference in New Issue
Block a user