fix: SA: Fix "...does not call parent constructor... and ...Access to an undefined property..." rules.

SA stands for Static Analysis.
This commit is contained in:
Pol Dellaiera 2021-11-16 15:30:53 +01:00
parent a17c22c74f
commit 8879734ea2
No known key found for this signature in database
GPG Key ID: D476DFE9C67467CA
3 changed files with 21 additions and 60 deletions

View File

@ -35,11 +35,6 @@ parameters:
count: 2
path: src/Bundle/ChillMainBundle/CRUD/Controller/ApiController.php
-
message: "#^Chill\\\\MainBundle\\\\CRUD\\\\Routing\\\\CRUDRoutesLoader\\:\\:__construct\\(\\) does not call parent constructor from Symfony\\\\Component\\\\Config\\\\Loader\\\\Loader\\.$#"
count: 1
path: src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php
-
message: "#^Cannot unset offset '_token' on array\\{formatter\\: mixed, export\\: mixed, centers\\: mixed, alias\\: string\\}\\.$#"
count: 1

View File

@ -100,11 +100,6 @@ parameters:
count: 1
path: src/Bundle/ChillMainBundle/CRUD/Controller/AbstractCRUDController.php
-
message: "#^Access to an undefined property Chill\\\\MainBundle\\\\CRUD\\\\Routing\\\\CRUDRoutesLoader\\:\\:\\$apiConfig\\.$#"
count: 2
path: src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php
-
message: "#^Call to an undefined method Chill\\\\MainBundle\\\\Command\\\\ChillImportUsersCommand\\:\\:tempOutput\\(\\)\\.$#"
count: 1

View File

@ -1,22 +1,6 @@
<?php
/*
* Chill is a software for social workers
*
* Copyright (C) 2019, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Chill\MainBundle\CRUD\Routing;
@ -27,22 +11,13 @@ use Symfony\Component\HttpFoundation\Request;
use Chill\MainBundle\CRUD\Controller\ApiController;
use Chill\MainBundle\CRUD\Controller\CRUDController;
/**
* Class CRUDRoutesLoader
* Load the route for CRUD
*
* @package Chill\MainBundle\CRUD\Routing
*/
class CRUDRoutesLoader extends Loader
{
protected array $crudConfig = [];
protected array $apiCrudConfig = [];
/**
* @var bool
*/
private $isLoaded = false;
private bool $isLoaded = false;
private const ALL_SINGLE_METHODS = [
Request::METHOD_GET,
@ -53,16 +28,12 @@ class CRUDRoutesLoader extends Loader
private const ALL_INDEX_METHODS = [ Request::METHOD_GET, Request::METHOD_HEAD ];
/**
* CRUDRoutesLoader constructor.
*
* @param $crudConfig the config from cruds
* @param $apicrudConfig the config from api_crud
*/
public function __construct(array $crudConfig, array $apiConfig)
public function __construct(array $crudConfig, array $apiCrudConfig)
{
$this->crudConfig = $crudConfig;
$this->apiConfig = $apiConfig;
$this->apiCrudConfig = $apiCrudConfig;
parent::__construct();
}
/**
@ -89,7 +60,7 @@ class CRUDRoutesLoader extends Loader
foreach ($this->crudConfig as $crudConfig) {
$collection->addCollection($this->loadCrudConfig($crudConfig));
}
foreach ($this->apiConfig as $crudConfig) {
foreach ($this->apiCrudConfig as $crudConfig) {
$collection->addCollection($this->loadApi($crudConfig));
}