fix: SA: Fix many critical rules.

SA stands for Static Analysis.
This commit is contained in:
Pol Dellaiera
2021-11-16 17:13:39 +01:00
parent db2010082a
commit 5432242376
19 changed files with 345 additions and 655 deletions

View File

@@ -1,23 +1,5 @@
<?php
/*
* Chill is a suite of a modules, Chill is a software for social workers
* Copyright (C) 2014, 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/>.
*/
namespace Chill\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
@@ -28,38 +10,30 @@ use Doctrine\Common\Collections\ArrayCollection;
* @ORM\Entity
* @ORM\Table(name="role_scopes")
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region")
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class RoleScope
{
/**
* @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
private int $id;
/**
* @var string
*
* @ORM\Column(type="string", length=255)
*/
private $role;
private string $role;
/**
* @var Scope
*
* @ORM\ManyToOne(
* targetEntity="Chill\MainBundle\Entity\Scope",
* inversedBy="roleScopes")
* @ORM\JoinColumn(nullable=true, name="scope_id")
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
*/
private $scope;
private Scope $scope;
/**
* @var Collection
*
@@ -68,16 +42,14 @@ class RoleScope
* mappedBy="roleScopes")
*/
private $permissionsGroups;
/**
* RoleScope constructor.
*/
private bool $new;
public function __construct() {
$this->new = true;
$this->permissionsGroups = new ArrayCollection();
}
/**
* @return int
*/
@@ -101,7 +73,7 @@ class RoleScope
{
return $this->scope;
}
/**
* @param type $role
* @return RoleScope
@@ -120,7 +92,7 @@ class RoleScope
public function setScope(Scope $scope = null)
{
$this->scope = $scope;
return $this;
}
}