Skip to content

Commit 05afe00

Browse files
committed
feat: bring changes
1 parent 3ce41e3 commit 05afe00

Some content is hidden

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

46 files changed

+8272
-343
lines changed

.github/workflows/close-pull-request.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.cache
2+
vendor/

.php-cs-fixer.php

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?php
2+
3+
$header = <<<'EOF'
4+
This file is part of Hyperf + OpenCodeCo
5+
6+
@link https://opencodeco.dev
7+
@document https://hyperf.wiki
8+
9+
@license https://github.com/opencodeco/hyperf-metric/blob/main/LICENSE
10+
EOF;
11+
12+
return (new PhpCsFixer\Config())
13+
->setRiskyAllowed(true)
14+
->setRules([
15+
'@PSR2' => true,
16+
'@Symfony' => true,
17+
'@DoctrineAnnotation' => true,
18+
'@PhpCsFixer' => true,
19+
'header_comment' => [
20+
'comment_type' => 'PHPDoc',
21+
'header' => $header,
22+
'separate' => 'none',
23+
'location' => 'after_declare_strict',
24+
],
25+
'array_syntax' => [
26+
'syntax' => 'short'
27+
],
28+
'list_syntax' => [
29+
'syntax' => 'short'
30+
],
31+
'concat_space' => [
32+
'spacing' => 'one'
33+
],
34+
'blank_line_before_statement' => [
35+
'statements' => [
36+
'declare',
37+
],
38+
],
39+
'general_phpdoc_annotation_remove' => [
40+
'annotations' => [
41+
'author'
42+
],
43+
],
44+
'ordered_imports' => [
45+
'imports_order' => [
46+
'class', 'function', 'const',
47+
],
48+
'sort_algorithm' => 'alpha',
49+
],
50+
'single_line_comment_style' => [
51+
'comment_types' => [
52+
],
53+
],
54+
'yoda_style' => [
55+
'always_move_variable' => false,
56+
'equal' => false,
57+
'identical' => false,
58+
],
59+
'phpdoc_align' => [
60+
'align' => 'left',
61+
],
62+
'multiline_whitespace_before_semicolons' => [
63+
'strategy' => 'no_multi_line',
64+
],
65+
'constant_case' => [
66+
'case' => 'lower',
67+
],
68+
'global_namespace_import' => [
69+
'import_classes' => true,
70+
'import_constants' => true,
71+
'import_functions' => true,
72+
],
73+
'class_attributes_separation' => true,
74+
'combine_consecutive_unsets' => true,
75+
'declare_strict_types' => true,
76+
'linebreak_after_opening_tag' => true,
77+
'lowercase_static_reference' => true,
78+
'no_useless_else' => true,
79+
'no_unused_imports' => true,
80+
'not_operator_with_successor_space' => true,
81+
'not_operator_with_space' => false,
82+
'ordered_class_elements' => true,
83+
'php_unit_strict' => false,
84+
'phpdoc_separation' => false,
85+
'single_quote' => true,
86+
'standardize_not_equals' => true,
87+
'multiline_comment_opening_closing' => true,
88+
'global_namespace_import' => [
89+
'import_classes' => true,
90+
'import_constants' => true,
91+
'import_functions' => true,
92+
],
93+
])
94+
->setFinder(
95+
PhpCsFixer\Finder::create()
96+
->exclude('vendor')
97+
->in(__DIR__)
98+
)
99+
->setUsingCache(true);

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) Hyperf
3+
Copyright (c) Hyperf & OpenCodeCo
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

class_map/Map.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
declare(strict_types=1);
44
/**
5-
* This file is part of Hyperf.
5+
* This file is part of Hyperf + OpenCodeCo
66
*
7-
* @link https://www.hyperf.io
7+
* @link https://opencodeco.dev
88
* @document https://hyperf.wiki
9-
* @contact [email protected]
10-
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
9+
* @contact [email protected]
10+
* @license https://github.com/opencodeco/hyperf-metric/blob/main/LICENSE
1111
*/
1212
namespace Zipkin\Propagation;
1313

@@ -56,7 +56,6 @@ public function get($carrier, string $key): ?string
5656
}
5757

5858
/**
59-
* {@inheritdoc}
6059
* @param array|ArrayAccess $carrier
6160
*/
6261
public function put(&$carrier, string $key, string $value): void

class_map/SpanContext.php

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file is part of Hyperf + OpenCodeCo
6+
*
7+
* @link https://opencodeco.dev
8+
* @document https://hyperf.wiki
9+
* @contact [email protected]
10+
* @license https://github.com/opencodeco/hyperf-metric/blob/main/LICENSE
11+
*/
12+
namespace Jaeger;
13+
14+
use ArrayIterator;
15+
use OpenTracing\SpanContext as OTSpanContext;
16+
use ReturnTypeWillChange;
17+
18+
class SpanContext implements OTSpanContext
19+
{
20+
private array $baggage;
21+
22+
public function __construct(
23+
private string $traceId,
24+
private string $spanId,
25+
private ?string $parentId = null,
26+
private ?int $flags = null,
27+
?array $baggage = null,
28+
private ?int $debugId = null,
29+
) {
30+
$this->baggage = $baggage ?? [];
31+
}
32+
33+
#[ReturnTypeWillChange]
34+
public function getIterator(): ArrayIterator|iterable
35+
{
36+
return new ArrayIterator($this->baggage);
37+
}
38+
39+
public function getBaggageItem(string $key): ?string
40+
{
41+
return $this->baggage[$key] ?? null;
42+
}
43+
44+
/**
45+
* @return SpanContext
46+
*/
47+
public function withBaggageItem(string $key, string $value): OTSpanContext
48+
{
49+
return new self(
50+
$this->traceId,
51+
$this->spanId,
52+
$this->parentId,
53+
$this->flags,
54+
[$key => $value] + $this->baggage
55+
);
56+
}
57+
58+
public function getTraceId(): string
59+
{
60+
return $this->traceId;
61+
}
62+
63+
public function setTraceId(string $traceId): self
64+
{
65+
$this->traceId = $traceId;
66+
return $this;
67+
}
68+
69+
public function getParentId(): ?string
70+
{
71+
return $this->parentId;
72+
}
73+
74+
public function getSpanId(): string
75+
{
76+
return $this->spanId;
77+
}
78+
79+
public function getFlags(): ?int
80+
{
81+
return $this->flags;
82+
}
83+
84+
public function getBaggage(): array
85+
{
86+
return $this->baggage;
87+
}
88+
89+
public function getDebugId(): ?int
90+
{
91+
return $this->debugId;
92+
}
93+
94+
public function isDebugIdContainerOnly(): bool
95+
{
96+
return ($this->traceId === null) && ($this->debugId !== null);
97+
}
98+
}

class_map/ThriftUdpTransport.php

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
declare(strict_types=1);
44
/**
5-
* This file is part of Hyperf.
5+
* This file is part of Hyperf + OpenCodeCo
66
*
7-
* @link https://www.hyperf.io
7+
* @link https://opencodeco.dev
88
* @document https://hyperf.wiki
9-
* @contact [email protected]
10-
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
9+
* @contact [email protected]
10+
* @license https://github.com/opencodeco/hyperf-metric/blob/main/LICENSE
1111
*/
1212
namespace Jaeger;
1313

@@ -26,35 +26,15 @@
2626

2727
class ThriftUdpTransport extends TTransport
2828
{
29-
/**
30-
* @var string
31-
*/
32-
private $host;
33-
34-
/**
35-
* @var int
36-
*/
37-
private $port;
38-
39-
/**
40-
* @var LoggerInterface
41-
*/
42-
private $logger;
29+
private null|resource|Socket $socket = null;
4330

44-
/**
45-
* @var null|resource|Socket
46-
*/
47-
private $socket;
31+
private ?Channel $chan = null;
4832

49-
/**
50-
* @var ?Channel
51-
*/
52-
private $chan;
53-
54-
public function __construct(string $host, int $port, LoggerInterface $logger = null)
55-
{
56-
$this->host = $host;
57-
$this->port = $port;
33+
public function __construct(
34+
private string $host,
35+
private int $port,
36+
private LoggerInterface $logger = null
37+
) {
5838
$this->logger = $logger ?? new NullLogger();
5939
}
6040

0 commit comments

Comments
 (0)