Skip to content

Commit c23a334

Browse files
committed
wip
1 parent fd57c2f commit c23a334

4 files changed

Lines changed: 12 additions & 24 deletions

File tree

phpstan-baseline.neon

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ parameters:
77

88
-
99
message: "#^Offset 'host' does not exist on array\\{scheme\\: 'http'\\|'https', host\\?\\: string, port\\?\\: int\\<0, 65535\\>, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\.$#"
10-
count: 1
10+
count: 2
1111
path: src/Dsn.php
1212

1313
-
@@ -200,6 +200,11 @@ parameters:
200200
count: 1
201201
path: src/Options.php
202202

203+
-
204+
message: "#^Method Sentry\\\\Options\\:\\:getOrgId\\(\\) should return int\\|null but returns mixed\\.$#"
205+
count: 1
206+
path: src/Options.php
207+
203208
-
204209
message: "#^Method Sentry\\\\Options\\:\\:getPrefixes\\(\\) should return array\\<string\\> but returns mixed\\.$#"
205210
count: 1

src/Dsn.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
*/
1313
final class Dsn implements \Stringable
1414
{
15-
1615
/**
1716
* @var string Regex to match the organization ID in the host.
1817
* This only applies to Sentry SaaS DSNs that contain the organization ID.
@@ -50,7 +49,7 @@ final class Dsn implements \Stringable
5049
private $path;
5150

5251
/**
53-
* @var int
52+
* @var int|null
5453
*/
5554
private $orgId;
5655

@@ -63,7 +62,7 @@ final class Dsn implements \Stringable
6362
* @param string $projectId The ID of the resource to access
6463
* @param string $path The specific resource that the web client wants to access
6564
* @param string $publicKey The public key to authenticate the SDK
66-
* @param int $orgId
65+
* @param ?int $orgId The org ID
6766
*/
6867
private function __construct(string $scheme, string $host, int $port, string $projectId, string $path, string $publicKey, ?int $orgId = null)
6968
{
@@ -110,7 +109,7 @@ public static function createFromString(string $value): self
110109

111110
$orgId = null;
112111
if (preg_match(self::SENTRY_ORG_ID_REGEX, $parsedDsn['host'], $matches) == 1) {
113-
$orgId = $matches[1];
112+
$orgId = (int) $matches[1];
114113
}
115114

116115
return new self(

src/Options.php

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -436,12 +436,12 @@ public function getDsn(): ?Dsn
436436
return $this->options['dsn'];
437437
}
438438

439-
public function getOrg(): ?int
439+
public function getOrgId(): ?int
440440
{
441441
return $this->options['org_id'];
442442
}
443443

444-
public function setOrg(int $orgId): self
444+
public function setOrgId(int $orgId): self
445445
{
446446
$options = array_merge($this->options, ['org_id' => $orgId]);
447447

@@ -662,20 +662,6 @@ public function setTracePropagationTargets(array $tracePropagationTargets): self
662662
return $this;
663663
}
664664

665-
public function isStrictTracePropagationEnabled(): bool
666-
{
667-
return $this->options['strict_trace_propagation'];
668-
}
669-
670-
public function setStrictTracePropagationEnabled(bool $enabled): self
671-
{
672-
$options = array_merge($this->options, ['strict_trace_propagation' => $enabled]);
673-
674-
$this->options = $this->resolver->resolve($options);
675-
676-
return $this;
677-
}
678-
679665
/**
680666
* Gets a list of default tags for events.
681667
*
@@ -1194,7 +1180,6 @@ private function configureOptions(OptionsResolver $resolver): void
11941180
return null;
11951181
},
11961182
'trace_propagation_targets' => null,
1197-
'strict_trace_propagation' => false,
11981183
'tags' => [],
11991184
'error_types' => null,
12001185
'max_breadcrumbs' => self::DEFAULT_MAX_BREADCRUMBS,
@@ -1243,7 +1228,6 @@ private function configureOptions(OptionsResolver $resolver): void
12431228
$resolver->setAllowedTypes('ignore_exceptions', 'string[]');
12441229
$resolver->setAllowedTypes('ignore_transactions', 'string[]');
12451230
$resolver->setAllowedTypes('trace_propagation_targets', ['null', 'string[]']);
1246-
$resolver->setAllowedTypes('strict_trace_propagation', ['null', 'bool']);
12471231
$resolver->setAllowedTypes('tags', 'string[]');
12481232
$resolver->setAllowedTypes('error_types', ['null', 'int']);
12491233
$resolver->setAllowedTypes('max_breadcrumbs', 'int');

src/Tracing/DynamicSamplingContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public static function fromTransaction(Transaction $transaction, HubInterface $h
173173
$samplingContext->set('public_key', $options->getDsn()->getPublicKey());
174174
}
175175
if ($options->getDsn() !== null && $options->getDsn()->getOrgId() !== null) {
176-
$samplingContext->set('org_id', $options->getDsn()->getOrgId());
176+
$samplingContext->set('org_id', (string) $options->getDsn()->getOrgId());
177177
}
178178

179179
if ($options->getRelease() !== null) {

0 commit comments

Comments
 (0)