Skip to content

Commit c6cf532

Browse files
committed
Prepare for PHP 8.1 deprecations - add return types in phpdoc and #[\ReturnTypeWillChange]
Also Symfony deprecation messages: > 1x: Method "IteratorAggregate::getIterator()" might add "\Traversable" as a native return type declaration in the future. Do the same in implementation "Jaeger\Span\Context\SpanContext" now to avoid errors or add an explicit @return annotation to suppress this message. See also: https://wiki.php.net/rfc/internal_method_return_types
1 parent c23091b commit c6cf532

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

src/Codec/CodecRegistry.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,19 @@ class CodecRegistry implements \ArrayAccess
77
{
88
private $codecs = [];
99

10+
/**
11+
* @return bool
12+
*/
13+
#[\ReturnTypeWillChange]
1014
public function offsetExists($offset)
1115
{
1216
return array_key_exists($offset, $this->codecs);
1317
}
1418

19+
/**
20+
* @return mixed
21+
*/
22+
#[\ReturnTypeWillChange]
1523
public function offsetGet($offset)
1624
{
1725
if (false === array_key_exists($offset, $this->codecs)) {
@@ -21,13 +29,21 @@ public function offsetGet($offset)
2129
return $this->codecs[$offset];
2230
}
2331

32+
/**
33+
* @return $this
34+
*/
35+
#[\ReturnTypeWillChange]
2436
public function offsetSet($offset, $value)
2537
{
2638
$this->codecs[$offset] = $value;
2739

2840
return $this;
2941
}
3042

43+
/**
44+
* @return $this
45+
*/
46+
#[\ReturnTypeWillChange]
3147
public function offsetUnset($offset)
3248
{
3349
if (false === array_key_exists($offset, $this->codecs)) {

src/Span/Context/SpanContext.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ public function getBaggage(): array
6464
return $this->baggage;
6565
}
6666

67+
/**
68+
* @return \Traversable
69+
*/
70+
#[\ReturnTypeWillChange]
6771
public function getIterator()
6872
{
6973
return new \ArrayIterator($this->baggage);

0 commit comments

Comments
 (0)