• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

overblog / GraphQLBundle / 21452238007

28 Jan 2026 07:19PM UTC coverage: 98.546% (-0.02%) from 98.563%
21452238007

push

github

web-flow
adding symfony8 to supported list (#1228)

* adding symfony8 to supported list

* one more exclude, monolog bump

* bump doctrine

* doctrine annotations also

* Revert "doctrine annotations also"

This reverts commit aa26b8191.

* annotations 2.0 once more

* opt-out from annotation if doctrine/orm >= 3

* fix: bridge

* eliminate phpstan concenrns

* trying to make validation tests pass

* Revert "trying to make validation tests pass"

This reverts commit 2553168d1.

* do not skip tests

* Revert "do not skip tests"

This reverts commit d100da0c3.

* monolog bump

* Revert "Revert "trying to make validation tests pass""

This reverts commit b987e43b9.

* Revert "Revert "Revert "trying to make validation tests pass"""

This reverts commit ef4fb3a3a.

* works for php8.4, sf8

* cq

* cleanup

* proper order is now, hmmm ...

* reduce tests scope

remove choice validation from tests as it was not consistent with other
validators in version symfony/validator:7.3.*

* cq

* exclude phps prior to 8.4 from testing with sf8

* apply sorting on responses before comparing

no need to expect same

* do not test sf7 with 8.1

* exclude 7.2 lowest deps as issue with sorting in tests

* sf8 one more exclude

* fix CI config

* handle parameters by name

* revert index.md

* fix cs and cleanup

* collect coverage information from 2 jobs

* fix cs

---------

Co-authored-by: Tobias Nyholm <tobias.nyholm@gmail.com>

16 of 18 new or added lines in 2 files covered. (88.89%)

53 existing lines in 9 files now uncovered.

4541 of 4608 relevant lines covered (98.55%)

76.57 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/Security/Security.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Overblog\GraphQLBundle\Security;
6

7
use LogicException;
8
use Symfony\Bundle\SecurityBundle\Security as BundleSecurity;
9
use Symfony\Component\HttpKernel\Kernel;
10
use Symfony\Component\Security\Core\Security as CoreSecurity;
11
use Symfony\Component\Security\Core\User\UserInterface;
12

13
use function array_reduce;
14

15
if (Kernel::VERSION_ID >= 60200) {
4✔
16
    final class Security extends BaseSecurity
17
    {
18
        public function __construct(?BundleSecurity $security)
19
        {
20
            parent::__construct($security);
37✔
21
        }
22
    }
23
} else {
24
    final class Security extends BaseSecurity
25
    {
26
        public function __construct(?CoreSecurity $security)
27
        {
UNCOV
28
            parent::__construct($security);
37✔
29
        }
30
    }
31
}
32

33
abstract class BaseSecurity
34
{
35
    /**
36
     * @var CoreSecurity|BundleSecurity
37
     */
38
    private $coreSecurity;
39

40
    /**
41
     * @param CoreSecurity|BundleSecurity $security
42
     */
43
    public function __construct($security)
44
    {
45
        // @phpstan-ignore-next-line
46
        $this->coreSecurity = $security ?? new class() {
74✔
47
            public function isGranted(): bool
48
            {
49
                throw new LogicException('The "symfony/security-core" component is required.');
2✔
50
            }
51

52
            public function getUser(): UserInterface
53
            {
54
                throw new LogicException('The "symfony/security-core" component is required.');
2✔
55
            }
56
        };
74✔
57
    }
58

59
    public function getUser(): ?UserInterface
60
    {
61
        return $this->coreSecurity->getUser();
12✔
62
    }
63

64
    /**
65
     * @param mixed $attributes
66
     * @param mixed $subject
67
     */
68
    public function isGranted($attributes, $subject = null): bool
69
    {
70
        return $this->coreSecurity->isGranted($attributes, $subject);
62✔
71
    }
72

73
    public function hasAnyPermission(object $object, array $permissions): bool
74
    {
75
        return array_reduce(
4✔
76
            $permissions,
4✔
77
            fn ($isGranted, $permission) => $isGranted || $this->isGranted($permission, $object),
4✔
78
            false
4✔
79
        );
4✔
80
    }
81

82
    public function hasAnyRole(array $roles): bool
83
    {
84
        return array_reduce(
8✔
85
            $roles,
8✔
86
            fn ($isGranted, $role) => $isGranted || $this->isGranted($role),
8✔
87
            false
8✔
88
        );
8✔
89
    }
90

91
    /**
92
     * @param mixed $object
93
     * @param mixed $permission
94
     */
95
    public function hasPermission($object, $permission): bool
96
    {
97
        return $this->isGranted($permission, $object);
4✔
98
    }
99

100
    public function hasRole(string $role): bool
101
    {
102
        return $this->isGranted($role);
16✔
103
    }
104

105
    public function isAnonymous(): bool
106
    {
107
        return $this->isGranted('IS_AUTHENTICATED_ANONYMOUSLY');
4✔
108
    }
109

110
    public function isAuthenticated(): bool
111
    {
112
        return $this->hasAnyRole(['IS_AUTHENTICATED_REMEMBERED', 'IS_AUTHENTICATED_FULLY']);
4✔
113
    }
114

115
    public function isFullyAuthenticated(): bool
116
    {
117
        return $this->isGranted('IS_AUTHENTICATED_FULLY');
12✔
118
    }
119

120
    public function isRememberMe(): bool
121
    {
122
        return $this->isGranted('IS_AUTHENTICATED_REMEMBERED');
4✔
123
    }
124
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc