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

@@ -22,7 +22,6 @@ use Chill\MainBundle\Pagination\PaginatorInterface;
use Chill\MainBundle\Repository\UserRepository;
use Chill\MainBundle\Templating\Listing\FilterOrderHelper;
use Psr\Log\LoggerInterface;
use RuntimeException;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Form;
@@ -63,11 +62,11 @@ class UserController extends CRUDController
);
$user->addGroupCenter($groupCenter);
if ($this->validator->validate($user)->count() === 0) {
if (0 === $this->validator->validate($user)->count()) {
$em->flush();
$this->addFlash('success', $this->get('translator')->trans('The '
. 'permissions have been successfully added to the user'));
.'permissions have been successfully added to the user'));
$returnPathParams = $request->query->has('returnPath') ?
['returnPath' => $request->query->get('returnPath')] : [];
@@ -115,7 +114,7 @@ class UserController extends CRUDController
try {
$user->removeGroupCenter($groupCenter);
} catch (RuntimeException $ex) {
} catch (\RuntimeException $ex) {
$this->addFlash('error', $this->get('translator')->trans($ex->getMessage()));
return $this->redirectToRoute('chill_crud_admin_user_edit', ['id' => $uid]);
@@ -135,13 +134,7 @@ class UserController extends CRUDController
$entity = $this->getEntity($action, $id, $request);
if (null === $entity) {
throw $this->createNotFoundException(
sprintf(
'The %s with id %s is not found',
$this->getCrudName(),
$id
)
);
throw $this->createNotFoundException(sprintf('The %s with id %s is not found', $this->getCrudName(), $id));
}
$response = $this->checkACL($action, $entity);
@@ -176,7 +169,7 @@ class UserController extends CRUDController
return $result;
}
return $this->redirectToRoute('chill_crud_' . $this->getCrudName() . '_index');
return $this->redirectToRoute('chill_crud_'.$this->getCrudName().'_index');
}
if ($form->isSubmitted()) {
@@ -272,7 +265,7 @@ class UserController extends CRUDController
->build();
}
protected function countEntities(string $action, Request $request, ?FilterOrderHelper $filterOrder = null): int
protected function countEntities(string $action, Request $request, FilterOrderHelper $filterOrder = null): int
{
if (!$filterOrder instanceof FilterOrderHelper) {
return parent::countEntities($action, $request, $filterOrder);
@@ -285,7 +278,7 @@ class UserController extends CRUDController
return $this->userRepository->countByUsernameOrEmail($filterOrder->getQueryString());
}
protected function createFormFor(string $action, $entity, ?string $formClass = null, array $formOptions = []): FormInterface
protected function createFormFor(string $action, $entity, string $formClass = null, array $formOptions = []): FormInterface
{
// for "new", add special config
if ('new' === $action) {
@@ -329,7 +322,7 @@ class UserController extends CRUDController
Request $request,
int $totalItems,
PaginatorInterface $paginator,
?FilterOrderHelper $filterOrder = null
FilterOrderHelper $filterOrder = null
) {
if (0 === $totalItems) {
return [];