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

@@ -14,12 +14,13 @@ namespace Chill\MainBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use RuntimeException;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
/**
* @ORM\Entity
*
* @ORM\Table(name="permission_groups")
*
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="acl_cache_region")
*/
class PermissionsGroup
@@ -33,6 +34,7 @@ class PermissionsGroup
/**
* @var Collection<GroupCenter>
*
* @ORM\OneToMany(
* targetEntity="Chill\MainBundle\Entity\GroupCenter",
* mappedBy="permissionsGroup"
@@ -41,27 +43,27 @@ class PermissionsGroup
private Collection $groupCenters;
/**
* @var int
*
* @ORM\Id
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null;
/**
* @var string
*
* @ORM\Column(type="string", length=255, nullable=false, options={"default": ""})
*/
private string $name = '';
/**
* @var Collection<RoleScope>
*
* @ORM\ManyToMany(
* targetEntity="Chill\MainBundle\Entity\RoleScope",
* inversedBy="permissionsGroups",
* cascade={ "persist" })
*
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
*/
private Collection $roleScopes;
@@ -104,10 +106,7 @@ class PermissionsGroup
return $this->name;
}
/**
* @return ArrayCollection|Collection
*/
public function getRoleScopes(): \Doctrine\Common\Collections\ArrayCollection|\Doctrine\Common\Collections\Collection
public function getRoleScopes(): ArrayCollection|Collection
{
return $this->roleScopes;
}
@@ -127,22 +126,21 @@ class PermissionsGroup
foreach ($countedIds as $id => $nb) {
if (1 < $nb) {
$context->buildViolation('A permission is already present '
. 'for the same role and scope')
.'for the same role and scope')
->addViolation();
}
}
}
/**
* @throws RuntimeException if the roleScope could not be removed.
* @throws \RuntimeException if the roleScope could not be removed
*/
public function removeRoleScope(RoleScope $roleScope)
{
$result = $this->roleScopes->removeElement($roleScope);
if (false === $result) {
throw new RuntimeException(sprintf("The roleScope '%s' could not be removed, "
. 'aborting.', spl_object_hash($roleScope)));
throw new \RuntimeException(sprintf("The roleScope '%s' could not be removed, ".'aborting.', spl_object_hash($roleScope)));
}
}
@@ -157,8 +155,6 @@ class PermissionsGroup
}
/**
* @param $name
*
* @return $this
*/
public function setName($name)