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

@@ -17,9 +17,6 @@ use Doctrine\Common\Collections\Collection;
use Symfony\Component\Form\DataMapperInterface;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use function array_key_exists;
use function is_array;
class PersonAltNameDataMapper implements DataMapperInterface
{
public function mapDataToForms($viewData, $forms)
@@ -35,12 +32,12 @@ class PersonAltNameDataMapper implements DataMapperInterface
$mapIndexToKey = [];
foreach ($viewData->getIterator() as $key => $altName) {
/** @var PersonAltName $altName */
/* @var PersonAltName $altName */
$mapIndexToKey[$altName->getKey()] = $key;
}
foreach ($forms as $key => $form) {
if (array_key_exists($key, $mapIndexToKey)) {
if (\array_key_exists($key, $mapIndexToKey)) {
$form->setData($viewData->get($mapIndexToKey[$key])->getLabel());
}
}
@@ -48,13 +45,13 @@ class PersonAltNameDataMapper implements DataMapperInterface
/**
* @param FormInterface[] $forms
* @param Collection $viewData
* @param Collection $viewData
*/
public function mapFormsToData($forms, &$viewData)
{
$mapIndexToKey = [];
if (is_array($viewData)) {
if (\is_array($viewData)) {
$dataIterator = $viewData;
} else {
$dataIterator = $viewData instanceof ArrayCollection ?
@@ -62,14 +59,14 @@ class PersonAltNameDataMapper implements DataMapperInterface
}
foreach ($dataIterator as $key => $altName) {
/** @var PersonAltName $altName */
/* @var PersonAltName $altName */
$mapIndexToKey[$altName->getKey()] = $key;
}
foreach ($forms as $key => $form) {
$isEmpty = empty($form->getData());
if (array_key_exists($key, $mapIndexToKey)) {
if (\array_key_exists($key, $mapIndexToKey)) {
if ($isEmpty) {
$viewData->remove($mapIndexToKey[$key]);
} else {
@@ -81,7 +78,7 @@ class PersonAltNameDataMapper implements DataMapperInterface
->setKey($key)
->setLabel($form->getData());
if (is_array($viewData)) {
if (\is_array($viewData)) {
$viewData[] = $altName;
} else {
$viewData->add($altName);