Skip to content

Commit f1294bb

Browse files
authored
fixing some psalm 5 complaints (#1110)
Whilst investigating upgrading to psalm 5, I notice that it generates a lot of new complaints. This fixes the ones that looked legit and require an API change, or were trivial. Does not upgrade to psalm 5 yet, though. That's a bigger job for another day.
1 parent ed65f22 commit f1294bb

File tree

3 files changed

+3
-40
lines changed

3 files changed

+3
-40
lines changed

Signals.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44

55
namespace OpenTelemetry\API;
66

7-
use InvalidArgumentException;
8-
9-
class Signals
7+
interface Signals
108
{
119
/** @var string */
1210
public const TRACE = 'trace';
@@ -20,11 +18,4 @@ class Signals
2018
self::METRICS,
2119
self::LOGS,
2220
];
23-
24-
public static function validate(string $signal): void
25-
{
26-
if (!in_array($signal, self::SIGNALS)) {
27-
throw new InvalidArgumentException('Unknown signal: ' . $signal);
28-
}
29-
}
3021
}

Trace/SpanKind.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,11 @@
77
/**
88
* @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.6.1/specification/trace/api.md#spankind
99
*/
10-
final class SpanKind
10+
interface SpanKind
1111
{
1212
public const KIND_INTERNAL = 0;
1313
public const KIND_CLIENT = 1;
1414
public const KIND_SERVER = 2;
1515
public const KIND_PRODUCER = 3;
1616
public const KIND_CONSUMER = 4;
17-
18-
public static function getChoices(): array
19-
{
20-
return [
21-
self::KIND_INTERNAL,
22-
self::KIND_CLIENT,
23-
self::KIND_SERVER,
24-
self::KIND_PRODUCER,
25-
self::KIND_CONSUMER,
26-
];
27-
}
28-
29-
private function __construct()
30-
{
31-
}
3217
}

Trace/StatusCode.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,9 @@
77
/**
88
* @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.6.1/specification/trace/api.md#set-status
99
*/
10-
final class StatusCode
10+
interface StatusCode
1111
{
1212
public const STATUS_UNSET = 'Unset';
1313
public const STATUS_OK = 'Ok';
1414
public const STATUS_ERROR = 'Error';
15-
16-
public function getChoices(): array
17-
{
18-
return [
19-
self::STATUS_UNSET,
20-
self::STATUS_OK,
21-
self::STATUS_ERROR,
22-
];
23-
}
24-
25-
private function __construct()
26-
{
27-
}
2815
}

0 commit comments

Comments
 (0)