src/Acl/Voter/GenericVoter.php
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
    {
        $user = $token->getUser();

        if (!$user instanceof User) {
            return false;
        }

        $subject = $this->permissionCollection->get($subject);
        $permissions = $this->accessService->getPermissions($user);

        foreach ($permissions as $permission) {
            if (Permission::GENERIC !== $permission->getType()) {
                // Skip permissions that are not of type "generic".
                continue;
            }

            if (!fnmatch($permission->getValue(), $subject->getValue(), FNM_NOESCAPE)) {
                // Skip permissions that are not related to the subject.
                // The fnmatch function is used to match asterisk patterns.
                continue;
            }

            if (in_array($attribute, $permission->getAttributes(), true)) {
                return true;
            }
        }

        return false;
    }
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
    {
        $user = $token->getUser();

        if (!$user instanceof User) {
            return false;
        }

        $subject = $this->permissionCollection->get($subject);
        $permissions = $this->accessService->getPermissions($user);

        foreach ($permissions as $permission) {
            if (Permission::GENERIC !== $permission->getType()) {
                // Skip permissions that are not of type "generic".
                continue;
            }

            if (!fnmatch($permission->getValue(), $subject->getValue(), FNM_NOESCAPE)) {
                // Skip permissions that are not related to the subject.
                // The fnmatch function is used to match asterisk patterns.
                continue;
            }

            if (in_array($attribute, $permission->getAttributes(), true)) {
                return true;
            }
        }

        return false;
    }
{@inheritdoc}