mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-28 23:05:11 +02:00
Fixed further inspection issues
This commit is contained in:
parent
33e36f3d2b
commit
87533b6031
37 changed files with 46 additions and 71 deletions
|
@ -135,7 +135,7 @@ final class AttachmentVoter extends Voter
|
|||
*
|
||||
* @return bool True if the attribute and subject are supported, false otherwise
|
||||
*/
|
||||
protected function supports(string $attribute, $subject): bool
|
||||
protected function supports(string $attribute, mixed $subject): bool
|
||||
{
|
||||
if (is_a($subject, Attachment::class, true)) {
|
||||
//These are the allowed attributes
|
||||
|
|
|
@ -57,7 +57,7 @@ final class GroupVoter extends Voter
|
|||
*
|
||||
* @return bool True if the attribute and subject are supported, false otherwise
|
||||
*/
|
||||
protected function supports(string $attribute, $subject): bool
|
||||
protected function supports(string $attribute, mixed $subject): bool
|
||||
{
|
||||
if (is_a($subject, Group::class, true)) {
|
||||
return $this->helper->isValidOperation('groups', $attribute);
|
||||
|
|
|
@ -62,7 +62,7 @@ final class PermissionVoter extends Voter
|
|||
*
|
||||
* @return bool True if the attribute and subject are supported, false otherwise
|
||||
*/
|
||||
protected function supports(string $attribute, $subject): bool
|
||||
protected function supports(string $attribute, mixed $subject): bool
|
||||
{
|
||||
//Check if the attribute has the form @permission.operation
|
||||
if (preg_match('#^@\\w+\\.\\w+$#', $attribute)) {
|
||||
|
|
|
@ -68,7 +68,7 @@ final class StructureVoter extends Voter
|
|||
*
|
||||
* @return bool True if the attribute and subject are supported, false otherwise
|
||||
*/
|
||||
protected function supports(string $attribute, $subject): bool
|
||||
protected function supports(string $attribute, mixed $subject): bool
|
||||
{
|
||||
if (is_object($subject) || is_string($subject)) {
|
||||
$permission_name = $this->instanceToPermissionName($subject);
|
||||
|
@ -87,11 +87,11 @@ final class StructureVoter extends Voter
|
|||
/**
|
||||
* Maps an instance type to the permission name.
|
||||
*
|
||||
* @param object|string $subject The subject for which the permission name should be generated
|
||||
* @param object|string $subject The subject for which the permission name should be generated
|
||||
*
|
||||
* @return string|null the name of the permission for the subject's type or null, if the subject is not supported
|
||||
*/
|
||||
protected function instanceToPermissionName($subject): ?string
|
||||
protected function instanceToPermissionName(object|string $subject): ?string
|
||||
{
|
||||
$class_name = is_string($subject) ? $subject : $subject::class;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ final class UserVoter extends Voter
|
|||
*
|
||||
* @return bool True if the attribute and subject are supported, false otherwise
|
||||
*/
|
||||
protected function supports(string $attribute, $subject): bool
|
||||
protected function supports(string $attribute, mixed $subject): bool
|
||||
{
|
||||
if (is_a($subject, User::class, true)) {
|
||||
return in_array($attribute,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue