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

FriendsOfOpenTelemetry / opentelemetry-bundle / 24346802740

13 Apr 2026 01:45PM UTC coverage: 91.791%. Remained the same
24346802740

push

github

web-flow
chore(deps): bump shivammathur/setup-php (#213)

Bumps [shivammathur/setup-php](https://github.com/shivammathur/setup-php) from <a class=hub.com/FriendsOfOpenTelemetry/opentelemetry-bundle/commit/fcafdd6392932010c2bd5094439b8e33be2a8a09">fcafdd639<a href="https://github.com/FriendsOfOpenTelemetry/opentelemetry-bundle/commit/75e6ad568b3c44fa3423a1071e1d9bb68c35b5ba"> to <a class=hub.com/FriendsOfOpenTelemetry/opentelemetry-bundle/commit/<a class="double-link" href="https://git"><a class=hub.com/FriendsOfOpenTelemetry/opentelemetry-bundle/commit/accd6127cb78bee3e8082180cb391013d204ef9f">accd6127c.
- [Release notes](https://github.com/shivammathur/setup-php/releases)
- [Commits](https://github.com/shivammathur/setup-php/compare/fcafdd6392932010c2bd5094439b8e33be2a8a09...accd6127cb78bee3e8082180cb391013d204ef9f)

---
updated-dependencies:
- dependency-name: shivammathur/setup-php
  dependency-version: accd6127cb78bee3e8082180cb391013d204ef9f
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

2281 of 2485 relevant lines covered (91.79%)

44.84 hits per line

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

85.29
/src/Instrumentation/Symfony/Framework/Routing/TraceableRouteLoader.php
1
<?php
2

3
namespace FriendsOfOpenTelemetry\OpenTelemetryBundle\Instrumentation\Symfony\Framework\Routing;
4

5
use FriendsOfOpenTelemetry\OpenTelemetryBundle\Instrumentation\Attribute\Traceable;
6
use Symfony\Component\Config\Loader\LoaderInterface;
7
use Symfony\Component\Config\Loader\LoaderResolverInterface;
8
use Symfony\Component\Routing\Route;
9
use Symfony\Component\Routing\RouteCollection;
10

11
class TraceableRouteLoader implements LoaderInterface
12
{
13
    public const DEFAULT_KEY = '_traceable';
14
    public const TRACER_KEY = '_tracer';
15
    public const OPTION_KEY = 'traceable';
16

17
    public function __construct(private LoaderInterface $loader)
18
    {
19
    }
24✔
20

21
    public function load(mixed $resource, ?string $type = null): RouteCollection
22
    {
23
        $routes = $this->loader->load($resource, $type);
24✔
24

25
        /** @var Route $route */
26
        foreach ($routes as $route) {
24✔
27
            self::parseAttribute($route);
24✔
28

29
            $traceable = $route->getOption(self::OPTION_KEY);
24✔
30
            if (null !== $traceable) {
24✔
31
                $route->addDefaults([
21✔
32
                    self::DEFAULT_KEY => $traceable,
21✔
33
                    self::TRACER_KEY => $route->getOption(self::TRACER_KEY),
21✔
34
                ]);
21✔
35
            }
36
        }
37

38
        return $routes;
24✔
39
    }
40

41
    public function supports(mixed $resource, ?string $type = null): bool
42
    {
43
        return $this->loader->supports($resource, $type);
×
44
    }
45

46
    public function getResolver(): LoaderResolverInterface
47
    {
48
        return $this->loader->getResolver();
×
49
    }
50

51
    public function setResolver(LoaderResolverInterface $resolver): void
52
    {
53
        $this->loader->setResolver($resolver);
×
54
    }
55

56
    private static function parseAttribute(Route $route): void
57
    {
58
        try {
59
            $controller = $route->getDefault('_controller');
24✔
60
            if (is_array($controller) && 2 === count($controller)) {
24✔
61
                $reflection = self::createReflectionMethod(sprintf('%s::%s', $controller[0], $controller[1]));
12✔
62
            } elseif (true === str_contains($controller, '::')) {
24✔
63
                $reflection = self::createReflectionMethod($controller);
18✔
64
            } else {
65
                $reflection = new \ReflectionClass($controller);
24✔
66
            }
67
        } catch (\ReflectionException) {
×
68
            return;
×
69
        }
70

71
        if ($reflection instanceof \ReflectionMethod) {
24✔
72
            $attribute = $reflection->getAttributes(Traceable::class)[0] ?? $reflection->getDeclaringClass()->getAttributes(Traceable::class)[0] ?? null;
18✔
73
        } else {
74
            $attribute = $reflection->getAttributes(Traceable::class)[0] ?? null;
18✔
75
        }
76

77
        if (null !== $attribute) {
24✔
78
            $traceable = $attribute->newInstance();
21✔
79
            $route->addOptions([
21✔
80
                self::OPTION_KEY => true,
21✔
81
                self::TRACER_KEY => $traceable->tracer ?? null,
21✔
82
            ]);
21✔
83
        }
84
    }
85

86
    private static function createReflectionMethod(string $method): \ReflectionMethod
87
    {
88
        if (\PHP_VERSION_ID >= 80400) {
18✔
89
            return \ReflectionMethod::createFromMethodName($method);
6✔
90
        }
91

92
        return new \ReflectionMethod($method);
12✔
93
    }
94
}
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