Skip to content

Commit 0b0cc11

Browse files
fixing CI complaints (#1666)
* fixing psalm complaints use rector (and psalm) to add Override attributes, and add symfony polyfill to provide Override in earlier php versions * fixing more psalm complaints * more fixes * adding stubs for deptrac there are some things in our code that deptrac doesn't understand or are missing for some php versions. stub them to quieten all those violation warnings * why not cache invalid :( * display tools versions * fix tools cache key * changing cache key * dont complain about unused psalm suppressions * suppress invalid attribute * quieten phpstan php8.5 complaints * revert previous commit...now other php versions complain about an unused ignore :( * revert typecasting in metrics aggregators * Update src/Contrib/Otlp/ProtobufSerializer.php Co-authored-by: Chris Lightfoot-Wild <[email protected]> * remove override stub and use the polyfill from deptrac --------- Co-authored-by: Chris Lightfoot-Wild <[email protected]>
1 parent b3a9286 commit 0b0cc11

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+135
-1
lines changed

Baggage/Baggage.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,28 @@ final class Baggage implements BaggageInterface
1414
private static ?self $emptyBaggage = null;
1515

1616
/** @inheritDoc */
17+
#[\Override]
1718
public static function fromContext(ContextInterface $context): BaggageInterface
1819
{
1920
return $context->get(ContextKeys::baggage()) ?? self::getEmpty();
2021
}
2122

2223
/** @inheritDoc */
24+
#[\Override]
2325
public static function getBuilder(): BaggageBuilderInterface
2426
{
2527
return new BaggageBuilder();
2628
}
2729

2830
/** @inheritDoc */
31+
#[\Override]
2932
public static function getCurrent(): BaggageInterface
3033
{
3134
return self::fromContext(Context::getCurrent());
3235
}
3336

3437
/** @inheritDoc */
38+
#[\Override]
3539
public static function getEmpty(): BaggageInterface
3640
{
3741
if (null === self::$emptyBaggage) {
@@ -47,18 +51,21 @@ public function __construct(private readonly array $entries = [])
4751
}
4852

4953
/** @inheritDoc */
54+
#[\Override]
5055
public function activate(): ScopeInterface
5156
{
5257
return Context::getCurrent()->withContextValue($this)->activate();
5358
}
5459

5560
/** @inheritDoc */
61+
#[\Override]
5662
public function getEntry(string $key): ?Entry
5763
{
5864
return $this->entries[$key] ?? null;
5965
}
6066

6167
/** @inheritDoc */
68+
#[\Override]
6269
public function getValue(string $key)
6370
{
6471
if (($entry = $this->getEntry($key)) !== null) {
@@ -69,6 +76,7 @@ public function getValue(string $key)
6976
}
7077

7178
/** @inheritDoc */
79+
#[\Override]
7280
public function getAll(): iterable
7381
{
7482
foreach ($this->entries as $key => $entry) {
@@ -77,18 +85,21 @@ public function getAll(): iterable
7785
}
7886

7987
/** @inheritDoc */
88+
#[\Override]
8089
public function isEmpty(): bool
8190
{
8291
return $this->entries === [];
8392
}
8493

8594
/** @inheritDoc */
95+
#[\Override]
8696
public function toBuilder(): BaggageBuilderInterface
8797
{
8898
return new BaggageBuilder($this->entries);
8999
}
90100

91101
/** @inheritDoc */
102+
#[\Override]
92103
public function storeInContext(ContextInterface $context): ContextInterface
93104
{
94105
return $context->with(ContextKeys::baggage(), $this);

Baggage/BaggageBuilder.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public function __construct(private array $entries = [])
1212
}
1313

1414
/** @inheritDoc */
15+
#[\Override]
1516
public function remove(string $key): BaggageBuilderInterface
1617
{
1718
unset($this->entries[$key]);
@@ -20,6 +21,7 @@ public function remove(string $key): BaggageBuilderInterface
2021
}
2122

2223
/** @inheritDoc */
24+
#[\Override]
2325
public function set(string $key, $value, ?MetadataInterface $metadata = null): BaggageBuilderInterface
2426
{
2527
if ($key === '') {
@@ -32,6 +34,7 @@ public function set(string $key, $value, ?MetadataInterface $metadata = null): B
3234
return $this;
3335
}
3436

37+
#[\Override]
3538
public function build(): BaggageInterface
3639
{
3740
return new Baggage($this->entries);

Baggage/Metadata.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public function __construct(private readonly string $metadata)
1717
{
1818
}
1919

20+
#[\Override]
2021
public function getValue(): string
2122
{
2223
return $this->metadata;

Baggage/Propagation/BaggagePropagator.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ public static function getInstance(): self
3434
return self::$instance;
3535
}
3636

37+
#[\Override]
3738
public function fields(): array
3839
{
3940
return [self::BAGGAGE];
4041
}
4142

43+
#[\Override]
4244
public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?ContextInterface $context = null): void
4345
{
4446
$setter ??= ArrayAccessGetterSetter::getInstance();
@@ -70,6 +72,7 @@ public function inject(&$carrier, ?PropagationSetterInterface $setter = null, ?C
7072
}
7173
}
7274

75+
#[\Override]
7376
public function extract($carrier, ?PropagationGetterInterface $getter = null, ?ContextInterface $context = null): ContextInterface
7477
{
7578
$getter ??= ArrayAccessGetterSetter::getInstance();

Behavior/Internal/LogWriter/ErrorLogWriter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
class ErrorLogWriter implements LogWriterInterface
88
{
9+
#[\Override]
910
public function write($level, string $message, array $context): void
1011
{
1112
error_log(Formatter::format($level, $message, $context));

Behavior/Internal/LogWriter/NoopLogWriter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
class NoopLogWriter implements LogWriterInterface
88
{
9+
#[\Override]
910
public function write($level, string $message, array $context): void
1011
{
1112
//do nothing

Behavior/Internal/LogWriter/Psr3LogWriter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public function __construct(private readonly LoggerInterface $logger)
1212
{
1313
}
1414

15+
#[\Override]
1516
public function write($level, string $message, array $context): void
1617
{
1718
$this->logger->log($level, $message, $context);

Behavior/Internal/LogWriter/StreamLogWriter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public function __construct(string $destination)
1818
}
1919
}
2020

21+
#[\Override]
2122
public function write($level, string $message, array $context): void
2223
{
2324
fwrite($this->stream, Formatter::format($level, $message, $context));

Common/Time/SystemClock.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public static function create(): self
2525
}
2626

2727
/** @inheritDoc */
28+
#[\Override]
2829
public function now(): int
2930
{
3031
return self::$referenceTime + hrtime(true);
@@ -47,6 +48,6 @@ private static function init(): void
4748
*/
4849
private static function calculateReferenceTime(float $wallClockMicroTime, int $upTime): int
4950
{
50-
return ((int) ($wallClockMicroTime * ClockInterface::NANOS_PER_SECOND)) - $upTime;
51+
return ((int) ($wallClockMicroTime * (float) ClockInterface::NANOS_PER_SECOND)) - $upTime;
5152
}
5253
}

Common/Time/TestClock.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function setTime(int $nanoSeconds): void
3333
$this->currentEpochNanos = $nanoSeconds;
3434
}
3535

36+
#[\Override]
3637
public function now(): int
3738
{
3839
return $this->currentEpochNanos;

0 commit comments

Comments
 (0)