Skip to content

Commit 6eb4c3f

Browse files
authored
ref: remove polyfill (#1922)
1 parent 018bd69 commit 6eb4c3f

24 files changed

Lines changed: 111 additions & 24 deletions

phpstan-baseline.neon

Lines changed: 3 additions & 0 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

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/CheckInStatus.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* This enum represents all the possible status of a check in.
99
*/
10-
final class CheckInStatus implements \Stringable
10+
final class CheckInStatus
1111
{
1212
/**
1313
* @var string The value of the enum instance

src/Dsn.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @author Stefano Arlandini <sarlandini@alice.it>
1212
*/
13-
final class Dsn implements \Stringable
13+
final class Dsn
1414
{
1515
/**
1616
* @var string Regex to match the organization ID in the host.

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, get_debug_type($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, get_debug_type($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, get_debug_type($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, get_debug_type($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".', get_debug_type($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/EventId.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
* @author Stefano Arlandini <sarlandini@alice.it>
1313
*/
14-
final class EventId implements \Stringable
14+
final class EventId
1515
{
1616
/**
1717
* @var string The ID

src/EventType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @author Stefano Arlandini <sarlandini@alice.it>
1212
*/
13-
final class EventType implements \Stringable
13+
final class EventType
1414
{
1515
/**
1616
* @var string The value of the enum instance

src/FrameBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ private function getFunctionArguments(array $backtraceFrame): array
179179
} else {
180180
$reflectionFunction = new \ReflectionMethod($backtraceFrame['class'], '__call');
181181
}
182-
} elseif ($backtraceFrame['function'] !== '__lambda_func' && !str_starts_with($backtraceFrame['function'], '{closure') && \function_exists($backtraceFrame['function'])) {
182+
} elseif ($backtraceFrame['function'] !== '__lambda_func' && strpos($backtraceFrame['function'], '{closure') !== 0 && \function_exists($backtraceFrame['function'])) {
183183
$reflectionFunction = new \ReflectionFunction($backtraceFrame['function']);
184184
}
185185
} catch (\ReflectionException $e) {

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".', get_debug_type($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

0 commit comments

Comments
 (0)