mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-27 18:13:48 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -13,14 +13,9 @@ namespace Chill\PersonBundle\Form\ChoiceLoader;
|
||||
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Repository\PersonRepository;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
|
||||
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
|
||||
|
||||
use function call_user_func;
|
||||
use function count;
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
* Allow to load a list of person.
|
||||
*/
|
||||
@@ -32,7 +27,7 @@ class PersonChoiceLoader implements ChoiceLoaderInterface
|
||||
|
||||
public function __construct(
|
||||
protected PersonRepository $personRepository,
|
||||
?array $centers = null
|
||||
array $centers = null
|
||||
) {
|
||||
if (null !== $centers) {
|
||||
$this->centers = $centers;
|
||||
@@ -46,7 +41,7 @@ class PersonChoiceLoader implements ChoiceLoaderInterface
|
||||
{
|
||||
return new \Symfony\Component\Form\ChoiceList\ArrayChoiceList(
|
||||
$this->lazyLoadedPersons,
|
||||
static fn (Person $p) => call_user_func($value, $p)
|
||||
static fn (Person $p) => \call_user_func($value, $p)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -68,9 +63,9 @@ class PersonChoiceLoader implements ChoiceLoaderInterface
|
||||
|
||||
if (
|
||||
$this->hasCenterFilter()
|
||||
&& !in_array($person->getCenter(), $this->centers, true)
|
||||
&& !\in_array($person->getCenter(), $this->centers, true)
|
||||
) {
|
||||
throw new RuntimeException('chosen a person not in correct center');
|
||||
throw new \RuntimeException('chosen a person not in correct center');
|
||||
}
|
||||
|
||||
$choices[] = $person;
|
||||
@@ -95,7 +90,7 @@ class PersonChoiceLoader implements ChoiceLoaderInterface
|
||||
continue;
|
||||
}
|
||||
|
||||
$id = call_user_func($value, $choice);
|
||||
$id = \call_user_func($value, $choice);
|
||||
$values[] = $id;
|
||||
$this->lazyLoadedPersons[$id] = $choice;
|
||||
}
|
||||
@@ -108,6 +103,6 @@ class PersonChoiceLoader implements ChoiceLoaderInterface
|
||||
*/
|
||||
protected function hasCenterFilter()
|
||||
{
|
||||
return count($this->centers) > 0;
|
||||
return \count($this->centers) > 0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user