Skip to content

Commit 6b5b394

Browse files
committed
PHP5 Compliance
1 parent f56b261 commit 6b5b394

File tree

6 files changed

+49
-23
lines changed

6 files changed

+49
-23
lines changed

src/Bridge/DebugListener.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<?php
2-
declare(strict_types=1);
3-
42
namespace Jaeger\Symfony\Bridge;
53

64
use Jaeger\Symfony\Debug\Extractor\DebugExtractorInterface;
@@ -37,13 +35,19 @@ public static function getSubscribedEvents()
3735
];
3836
}
3937

38+
/**
39+
* @return DebugListener
40+
*/
4041
public function onTerminate()
4142
{
4243
$this->debuggable->disable();
4344

4445
return $this;
4546
}
4647

48+
/**
49+
* @return DebugListener
50+
*/
4751
public function onStart()
4852
{
4953
if ('' === ($debugId = $this->extractor->getDebug())) {

src/Debug/Extractor/CookieDebugExtractor.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<?php
2-
declare(strict_types=1);
3-
42
namespace Jaeger\Symfony\Debug\Extractor;
53

64
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -14,9 +12,14 @@ class CookieDebugExtractor implements DebugExtractorInterface, EventSubscriberIn
1412

1513
private $cookieName;
1614

17-
public function __construct(string $cookieName)
15+
/**
16+
* CookieDebugExtractor constructor.
17+
*
18+
* @param string $cookieName
19+
*/
20+
public function __construct($cookieName)
1821
{
19-
$this->cookieName = $cookieName;
22+
$this->cookieName = (string)$cookieName;
2023
}
2124

2225
public function onRequest(GetResponseEvent $event)
@@ -42,9 +45,12 @@ public function onTerminate()
4245
return $this;
4346
}
4447

45-
public function getDebug(): string
48+
/**
49+
* @return string
50+
*/
51+
public function getDebug()
4652
{
47-
return $this->debugId;
53+
return (string)$this->debugId;
4854
}
4955

5056
public static function getSubscribedEvents()

src/Debug/Extractor/DebugExtractorChain.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
11
<?php
2-
declare(strict_types=1);
3-
42
namespace Jaeger\Symfony\Debug\Extractor;
53

64
class DebugExtractorChain implements DebugExtractorInterface
75
{
86
private $queue;
97

8+
/**
9+
* DebugExtractorChain constructor.
10+
*
11+
* @param \SplPriorityQueue $queue
12+
*/
1013
public function __construct(\SplPriorityQueue $queue)
1114
{
1215
$this->queue = $queue;
1316
}
1417

15-
public function add(DebugExtractorInterface $extractor, int $priority = 0): DebugExtractorChain
18+
/**
19+
* @param DebugExtractorInterface $extractor
20+
* @param int $priority
21+
*
22+
* @return DebugExtractorChain
23+
*/
24+
public function add(DebugExtractorInterface $extractor, $priority = 0)
1625
{
17-
$this->queue->insert($extractor, $priority);
26+
$this->queue->insert($extractor, (int)$priority);
1827

1928
return $this;
2029
}
2130

22-
public function getDebug(): string
31+
/**
32+
* @return string
33+
*/
34+
public function getDebug()
2335
{
2436
$queue = clone $this->queue;
2537
while (false === $queue->isEmpty()) {
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
<?php
2-
declare(strict_types=1);
3-
42
namespace Jaeger\Symfony\Debug\Extractor;
53

64
interface DebugExtractorInterface
75
{
86
/**
97
* @return string
108
*/
11-
public function getDebug() : string;
9+
public function getDebug();
1210
}

src/Debug/Extractor/EnvDebugExtractor.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
declare(strict_types=1);
32

43
namespace Jaeger\Symfony\Debug\Extractor;
54

@@ -12,7 +11,12 @@ class EnvDebugExtractor implements DebugExtractorInterface, EventSubscriberInter
1211

1312
private $debugId = '';
1413

15-
public function __construct(string $envName)
14+
/**
15+
* EnvDebugExtractor constructor.
16+
*
17+
* @param string $envName
18+
*/
19+
public function __construct($envName)
1620
{
1721
$this->envName = $envName;
1822
}
@@ -32,14 +36,17 @@ public function onTerminate()
3236
return $this;
3337
}
3438

35-
public function getDebug(): string
39+
/**
40+
* @return string
41+
*/
42+
public function getDebug()
3643
{
37-
return $this->debugId;
44+
return (string)$this->debugId;
3845
}
3946

4047
public function onCommand()
4148
{
42-
if (null === ($data = $_ENV[$this->envName] ?? null)) {
49+
if (false === array_key_exists($this->envName, $_ENV)) {
4350
return $this;
4451
}
4552
$this->debugId = (string)$_ENV[$this->envName];

src/Resources/DependencyInjection/DebugExtractorChainCompilerPass.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
declare(strict_types=1);
32

43
namespace Jaeger\Symfony\Resources\DependencyInjection;
54

@@ -20,7 +19,7 @@ public function process(ContainerBuilder $container)
2019
$definition = $container->getDefinition('jaeger.debug.extractor.chain');
2120
foreach ($container->findTaggedServiceIds('jaeger.debug.extractor') as $id => $tags) {
2221
foreach ($tags as $tag) {
23-
$priority = $tag['priority'] ?? 0;
22+
$priority = array_key_exists('priority', $tag) ? $tag['priority'] : 0;
2423
$definition->addMethodCall('add', [new Reference($id), $priority]);
2524
}
2625
}

0 commit comments

Comments
 (0)