fix: SA: Fix "...invoked with..." rule.

SA stands for Static Analysis.
This commit is contained in:
Pol Dellaiera
2021-11-16 12:16:02 +01:00
parent a3eb23478a
commit c68bda5c9b
11 changed files with 183 additions and 355 deletions

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Chill\DocStoreBundle\Controller;
use Chill\DocStoreBundle\Entity\DocumentCategory;
@@ -9,11 +11,9 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Chill\DocStoreBundle\ChillDocStoreBundle;
/**
* Class DocumentCategoryController
*
* @package Chill\DocStoreBundle\Controller
* @Route("/{_locale}/admin/document/category")
*/
class DocumentCategoryController extends AbstractController
@@ -24,11 +24,14 @@ class DocumentCategoryController extends AbstractController
public function index(): Response
{
$em = $this->getDoctrine()->getManager();
$categories = $em->getRepository("ChillDocStoreBundle:DocumentCategory")->findAll();
$categories = $em->getRepository(DocumentCategory::class)->findAll();
return $this->render(
'ChillDocStoreBundle:DocumentCategory:index.html.twig',
['document_categories' => $categories]);
[
'document_categories' => $categories,
]
);
}
/**
@@ -37,13 +40,10 @@ class DocumentCategoryController extends AbstractController
public function new(Request $request): Response
{
$em = $this->getDoctrine()->getManager();
$documentCategory = new DocumentCategory();
$documentCategory
->setBundleId('Chill\DocStoreBundle\ChillDocStoreBundle');
$documentCategory
->setIdInsideBundle(
$em->getRepository("ChillDocStoreBundle:DocumentCategory")
->nextIdInsideBundle());
$documentCategory = new DocumentCategory(
ChillDocStoreBundle::class,
$em->getRepository(DocumentCategory::class)->nextIdInsideBundle()
);
$documentCategory
->setDocumentClass(PersonDocument::class);
@@ -56,11 +56,10 @@ class DocumentCategoryController extends AbstractController
$em->flush();
return $this->redirectToRoute('document_category_index');
} else {
$documentCategory->setBundleId(
'Chill\DocStoreBundle\ChillDocStoreBundle');
}
$documentCategory->setBundleId(ChillDocStoreBundle::class);
return $this->render('ChillDocStoreBundle:DocumentCategory:new.html.twig', [
'document_category' => $documentCategory,
'form' => $form->createView(),