mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-01 14:04:30 +02:00
Fixed some issues detected by PHPstan.
This commit is contained in:
parent
f2ff77a8b3
commit
dd1f806c4e
30 changed files with 310 additions and 45 deletions
|
@ -38,7 +38,6 @@ use Doctrine\ORM\Mapping\PreUpdate;
|
|||
use function get_class;
|
||||
use InvalidArgumentException;
|
||||
use ReflectionClass;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
/**
|
||||
|
@ -59,7 +58,7 @@ class ElementPermissionListener
|
|||
|
||||
protected $perm_cache;
|
||||
|
||||
public function __construct(Security $security, Reader $reader, EntityManagerInterface $em, KernelInterface $kernel)
|
||||
public function __construct(Security $security, Reader $reader, EntityManagerInterface $em)
|
||||
{
|
||||
$this->security = $security;
|
||||
$this->reader = $reader;
|
||||
|
|
|
@ -34,14 +34,17 @@ class AttachmentVoter extends ExtendedVoter
|
|||
* Similar to voteOnAttribute, but checking for the anonymous user is already done.
|
||||
* The current user (or the anonymous user) is passed by $user.
|
||||
*
|
||||
* @param $attribute
|
||||
* @param $subject
|
||||
* @param string $attribute
|
||||
* @param mixed $subject
|
||||
* @return bool
|
||||
*/
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
{
|
||||
if ($subject instanceof Attachment) {
|
||||
return $this->resolver->inherit($user, 'parts_attachments', $attribute) ?? false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -72,8 +72,9 @@ abstract class ExtendedVoter extends Voter
|
|||
* Similar to voteOnAttribute, but checking for the anonymous user is already done.
|
||||
* The current user (or the anonymous user) is passed by $user.
|
||||
*
|
||||
* @param $attribute
|
||||
* @param $subject
|
||||
* @param string $attribute
|
||||
* @param mixed $subject
|
||||
* @return bool
|
||||
*/
|
||||
abstract protected function voteOnUser($attribute, $subject, User $user): bool;
|
||||
}
|
||||
|
|
|
@ -33,8 +33,9 @@ class GroupVoter extends ExtendedVoter
|
|||
* Similar to voteOnAttribute, but checking for the anonymous user is already done.
|
||||
* The current user (or the anonymous user) is passed by $user.
|
||||
*
|
||||
* @param $attribute
|
||||
* @param $subject
|
||||
* @param string $attribute
|
||||
* @param mixed $subject
|
||||
* @return bool
|
||||
*/
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
{
|
||||
|
|
|
@ -37,8 +37,8 @@ class PermissionVoter extends ExtendedVoter
|
|||
* Similar to voteOnAttribute, but checking for the anonymous user is already done.
|
||||
* The current user (or the anonymous user) is passed by $user.
|
||||
*
|
||||
* @param $attribute
|
||||
* @param $subject
|
||||
* @param string $attribute
|
||||
* @param mixed $subject
|
||||
*/
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
{
|
||||
|
|
|
@ -54,6 +54,7 @@ class StructureVoter extends ExtendedVoter
|
|||
//If permission name is null, then the subject is not supported
|
||||
return (null !== $permission_name) && $this->resolver->isValidOperation($permission_name, $attribute);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,8 +95,9 @@ class StructureVoter extends ExtendedVoter
|
|||
* Similar to voteOnAttribute, but checking for the anonymous user is already done.
|
||||
* The current user (or the anonymous user) is passed by $user.
|
||||
*
|
||||
* @param $attribute
|
||||
* @param $subject
|
||||
* @param string $attribute
|
||||
* @param mixed $subject
|
||||
* @return bool
|
||||
*/
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
{
|
||||
|
|
|
@ -54,8 +54,9 @@ class UserVoter extends ExtendedVoter
|
|||
* Similar to voteOnAttribute, but checking for the anonymous user is already done.
|
||||
* The current user (or the anonymous user) is passed by $user.
|
||||
*
|
||||
* @param $attribute
|
||||
* @param $subject
|
||||
* @param string $attribute
|
||||
* @param mixed $subject
|
||||
* @return bool
|
||||
*/
|
||||
protected function voteOnUser($attribute, $subject, User $user): bool
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue