DX: apply rector rules up to php8.0

This commit is contained in:
2023-04-15 01:05:37 +02:00
parent d8870e906f
commit dde3002100
714 changed files with 2348 additions and 9263 deletions

View File

@@ -131,25 +131,14 @@ class EntityPersonCRUDController extends CRUDController
return $this->getActionConfig($action)['template'];
}
switch ($action) {
case 'new':
return '@ChillPerson/CRUD/new.html.twig';
case 'edit':
return '@ChillPerson/CRUD/edit.html.twig';
case 'view':
return '@ChillPerson/CRUD/view.html.twig';
case 'delete':
return '@ChillPerson/CRUD/delete.html.twig';
case 'index':
return '@ChillPerson/CRUD/index.html.twig';
default:
return parent::getTemplateFor($action, $entity, $request);
}
return match ($action) {
'new' => '@ChillPerson/CRUD/new.html.twig',
'edit' => '@ChillPerson/CRUD/edit.html.twig',
'view' => '@ChillPerson/CRUD/view.html.twig',
'delete' => '@ChillPerson/CRUD/delete.html.twig',
'index' => '@ChillPerson/CRUD/index.html.twig',
default => parent::getTemplateFor($action, $entity, $request),
};
}
/**
@@ -161,28 +150,21 @@ class EntityPersonCRUDController extends CRUDController
{
$next = $request->request->get('submit', 'save-and-close');
switch ($next) {
case 'save-and-close':
return $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_index', [
'person_id' => $this->getPerson($request)->getId(),
]);
case 'save-and-new':
return $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_new', [
'person_id' => $this->getPerson($request)->getId(),
]);
case 'new':
return $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_view', [
'id' => $entity->getId(),
'person_id' => $this->getPerson($request)->getId(),
]);
default:
return $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_view', [
'id' => $entity->getId(),
'person_id' => $this->getPerson($request)->getId(),
]);
}
return match ($next) {
'save-and-close' => $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_index', [
'person_id' => $this->getPerson($request)->getId(),
]),
'save-and-new' => $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_new', [
'person_id' => $this->getPerson($request)->getId(),
]),
'new' => $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_view', [
'id' => $entity->getId(),
'person_id' => $this->getPerson($request)->getId(),
]),
default => $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_view', [
'id' => $entity->getId(),
'person_id' => $this->getPerson($request)->getId(),
]),
};
}
}

View File

@@ -50,21 +50,14 @@ class OneToOneEntityPersonCRUDController extends CRUDController
return $this->crudConfig[$action]['template'];
}
switch ($action) {
case 'new':
return '@ChillPerson/CRUD/new.html.twig';
case 'edit':
return '@ChillPerson/CRUD/edit.html.twig';
case 'index':
return '@ChillPerson/CRUD/index.html.twig';
default:
throw new LogicException("the view for action {$action} is not "
. 'defined. You should override ' . __METHOD__ . ' to add this '
. 'action');
}
return match ($action) {
'new' => '@ChillPerson/CRUD/new.html.twig',
'edit' => '@ChillPerson/CRUD/edit.html.twig',
'index' => '@ChillPerson/CRUD/index.html.twig',
default => throw new LogicException("the view for action {$action} is not "
. 'defined. You should override ' . __METHOD__ . ' to add this '
. 'action'),
};
}
protected function onPostFetchEntity($action, Request $request, $entity): ?Response