Skip to content

Commit 531869d

Browse files
committed
Merge branch '5.x' into martinl/options-resolver
# Conflicts: # src/Event.php # src/EventHint.php # src/Integration/IntegrationRegistry.php # src/Options.php # src/Stacktrace.php # src/State/Scope.php # src/UserDataBag.php
2 parents 189f11e + 6eb4c3f commit 531869d

23 files changed

Lines changed: 269 additions & 92 deletions

.github/pull_request_template.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### Description
2+
<!-- What changed and why? -->
3+
4+
#### Issues
5+
<!--
6+
* resolves: #1234
7+
* resolves: LIN-1234
8+
-->
9+
10+
#### Reminders
11+
- Add GH Issue ID _&_ Linear ID
12+
- PR title should use [conventional commit](https://develop.sentry.dev/engineering-practices/commit-messages/#type) style (`feat:`, `fix:`, `ref:`, `meta:`)
13+
- For external contributors: [CONTRIBUTING.md](https://github.com/getsentry/sentry-php/blob/master/CONTRIBUTING.md), [Sentry SDK development docs](https://develop.sentry.dev/sdk/), [Discord community](https://discord.gg/Ww9hbqr)

.github/workflows/publish-release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
steps:
2525
- name: Get auth token
2626
id: token
27-
uses: actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b # v2.1.1
27+
uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
2828
with:
2929
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
3030
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}

CHANGELOG.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# CHANGELOG
22

3+
## 4.16.0
4+
5+
The Sentry SDK team is happy to announce the immediate availability of Sentry PHP SDK v4.16.0.
6+
7+
### Features
8+
9+
- Remove `max_breadcrumbs` limit. [(#1890)](https://github.com/getsentry/sentry-php/pull/1890)
10+
- Implement `__destruct` in `LogsHandler` to make sure logs are always flushed. [(#1916)](https://github.com/getsentry/sentry-php/pull/1916)
11+
12+
### Bug Fixes
13+
14+
- Use PSR log level when logging messages using the PSR-3 logger within the SDK. [(#1907)](https://github.com/getsentry/sentry-php/pull/1907)
15+
- Remove `@internal` annotation from `Sentry\Transport\Result`. [(#1904)](https://github.com/getsentry/sentry-php/pull/1904)
16+
17+
### Misc
18+
19+
- Add `sentry.origin` attribute to `LogsHandler`. [(#1917)](https://github.com/getsentry/sentry-php/pull/1917)
20+
321
## 4.15.2
422

523
The Sentry SDK team is happy to announce the immediate availability of Sentry PHP SDK v4.15.2.
@@ -30,26 +48,26 @@ The Sentry SDK team is happy to announce the immediate availability of Sentry PH
3048
use Monolog\Logger;
3149
use Sentry\Monolog\LogsHandler;
3250
use Sentry\Logs\LogLevel;
33-
51+
3452
// Initialize Sentry SDK first (make sure 'enable_logs' is set to true)
3553
\Sentry\init([
3654
'dsn' => '__YOUR_DSN__',
3755
'enable_logs' => true,
3856
]);
39-
57+
4058
// Create a Monolog logger
4159
$logger = new Logger('my-app');
42-
60+
4361
// Add the Sentry logs handler
4462
// Optional: specify minimum log level (defaults to LogLevel::debug())
4563
$handler = new LogsHandler(LogLevel::info());
4664
$logger->pushHandler($handler);
47-
65+
4866
// Now your logs will be sent to Sentry
4967
$logger->info('User logged in', ['user_id' => 123]);
5068
$logger->error('Payment failed', ['order_id' => 456]);
5169
```
52-
70+
5371
Note: The handler will not collect logs for exceptions (they should be handled separately via `captureException`).
5472

5573
### Bug Fixes

phpstan-baseline.neon

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
parameters:
22
ignoreErrors:
3+
-
4+
message: "#.*#"
5+
path: src/Util/DebugType.php
36
-
47
message: "#^Method Sentry\\\\Client\\:\\:getIntegration\\(\\) should return \\(T of Sentry\\\\Integration\\\\IntegrationInterface\\)\\|null but returns \\(T of Sentry\\\\Integration\\\\IntegrationInterface\\)\\|null\\.$#"
58
count: 1
@@ -165,11 +168,6 @@ parameters:
165168
count: 1
166169
path: src/Options.php
167170

168-
-
169-
message: "#^Method Sentry\\\\Options\\:\\:getMaxValueLength\\(\\) should return int but returns mixed\\.$#"
170-
count: 1
171-
path: src/Options.php
172-
173171
-
174172
message: "#^Method Sentry\\\\Options\\:\\:getOrgId\\(\\) should return int\\|null but returns mixed\\.$#"
175173
count: 1

psalm.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<directory name="src" />
1111
<ignoreFiles>
1212
<directory name="vendor" />
13+
<file name="src/Util/DebugType.php" />
1314
</ignoreFiles>
1415
</projectFiles>
1516

src/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Client implements ClientInterface
3232
/**
3333
* The version of the SDK.
3434
*/
35-
public const SDK_VERSION = '4.15.2';
35+
public const SDK_VERSION = '4.16.0';
3636

3737
/**
3838
* Regex pattern to detect if a string is a regex pattern (starts and ends with / optionally followed by flags).

src/Event.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Sentry\Logs\Log;
1010
use Sentry\Profiling\Profile;
1111
use Sentry\Tracing\Span;
12+
use Sentry\Util\DebugType;
1213

1314
/**
1415
* This is the base class for classes containing event data.
@@ -802,7 +803,7 @@ public function setExceptions(array $exceptions): self
802803
{
803804
foreach ($exceptions as $exception) {
804805
if (!$exception instanceof ExceptionDataBag) {
805-
throw new \UnexpectedValueException(\sprintf('Expected an instance of the "%s" class. Got: "%s".', ExceptionDataBag::class, \gettype($exception)));
806+
throw new \UnexpectedValueException(\sprintf('Expected an instance of the "%s" class. Got: "%s".', ExceptionDataBag::class, DebugType::getDebugType($exception)));
806807
}
807808
}
808809

src/EventHint.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Sentry;
66

7+
use Sentry\Util\DebugType;
8+
79
/**
810
* This class represents hints on how to process an event.
911
*/
@@ -56,19 +58,19 @@ public static function fromArray(array $hintData): self
5658
$extra = $hintData['extra'] ?? [];
5759

5860
if ($exception !== null && !$exception instanceof \Throwable) {
59-
throw new \InvalidArgumentException(\sprintf('The value of the "exception" field must be an instance of a class implementing the "%s" interface. Got: "%s".', \Throwable::class, \gettype($exception)));
61+
throw new \InvalidArgumentException(\sprintf('The value of the "exception" field must be an instance of a class implementing the "%s" interface. Got: "%s".', \Throwable::class, DebugType::getDebugType($exception)));
6062
}
6163

6264
if ($mechanism !== null && !$mechanism instanceof ExceptionMechanism) {
63-
throw new \InvalidArgumentException(\sprintf('The value of the "mechanism" field must be an instance of the "%s" class. Got: "%s".', ExceptionMechanism::class, \gettype($mechanism)));
65+
throw new \InvalidArgumentException(\sprintf('The value of the "mechanism" field must be an instance of the "%s" class. Got: "%s".', ExceptionMechanism::class, DebugType::getDebugType($mechanism)));
6466
}
6567

6668
if ($stacktrace !== null && !$stacktrace instanceof Stacktrace) {
67-
throw new \InvalidArgumentException(\sprintf('The value of the "stacktrace" field must be an instance of the "%s" class. Got: "%s".', Stacktrace::class, \gettype($stacktrace)));
69+
throw new \InvalidArgumentException(\sprintf('The value of the "stacktrace" field must be an instance of the "%s" class. Got: "%s".', Stacktrace::class, DebugType::getDebugType($stacktrace)));
6870
}
6971

7072
if (!\is_array($extra)) {
71-
throw new \InvalidArgumentException(\sprintf('The value of the "extra" field must be an array. Got: "%s".', \gettype($extra)));
73+
throw new \InvalidArgumentException(\sprintf('The value of the "extra" field must be an array. Got: "%s".', DebugType::getDebugType($extra)));
7274
}
7375

7476
$hint->exception = $exception;

src/Integration/IntegrationRegistry.php

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

77
use Psr\Log\LoggerInterface;
88
use Sentry\Options;
9+
use Sentry\Util\DebugType;
910

1011
/**
1112
* @internal
@@ -123,7 +124,7 @@ private function getIntegrationsToSetup(Options $options): array
123124
$integrations = $userIntegrations($defaultIntegrations);
124125

125126
if (!\is_array($integrations)) {
126-
throw new \UnexpectedValueException(\sprintf('Expected the callback set for the "integrations" option to return a list of integrations. Got: "%s".', \gettype($integrations)));
127+
throw new \UnexpectedValueException(\sprintf('Expected the callback set for the "integrations" option to return a list of integrations. Got: "%s".', DebugType::getDebugType($integrations)));
127128
}
128129
}
129130

src/Logs/Log.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ public function setLevel(LogLevel $level): self
8282
return $this;
8383
}
8484

85+
public function getPsrLevel(): string
86+
{
87+
return $this->level->toPsrLevel();
88+
}
89+
8590
public function getBody(): string
8691
{
8792
return $this->body;

0 commit comments

Comments
 (0)