Skip to content

Commit

Permalink
Remove symfony/polyfill-php80
Browse files Browse the repository at this point in the history
  • Loading branch information
cleptric committed Oct 17, 2023
1 parent 0a8b1e7 commit c23a0aa
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
"psr/http-factory": "^1.0",
"psr/http-factory-implementation": "^1.0",
"psr/log": "^1.0|^2.0|^3.0",
"symfony/options-resolver": "^3.4.43|^4.4.30|^5.0.11|^6.0",
"symfony/polyfill-php80": "^1.17"
"symfony/options-resolver": "^3.4.43|^4.4.30|^5.0.11|^6.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.19|3.4.*",
Expand Down
8 changes: 4 additions & 4 deletions src/FrameBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function buildFromBacktraceFrame(string $file, int $line, array $backtrac
if (isset($backtraceFrame['class']) && isset($backtraceFrame['function'])) {
$functionName = $backtraceFrame['class'];

if (str_starts_with($functionName, Frame::ANONYMOUS_CLASS_PREFIX)) {
if (Frame::ANONYMOUS_CLASS_PREFIX === mb_substr($functionName, 0, mb_strlen(Frame::ANONYMOUS_CLASS_PREFIX))) {
$functionName = Frame::ANONYMOUS_CLASS_PREFIX . $this->stripPrefixFromFilePath($this->options, substr($backtraceFrame['class'], \strlen(Frame::ANONYMOUS_CLASS_PREFIX)));
}

Expand Down Expand Up @@ -107,7 +107,7 @@ private function isFrameInApp(string $file, ?string $functionName): bool
return false;
}

if (null !== $functionName && str_starts_with($functionName, 'Sentry\\')) {
if (null !== $functionName && 'Sentry\\' === substr($functionName, 0, \strlen('Sentry\\'))) {
return false;
}

Expand All @@ -117,15 +117,15 @@ private function isFrameInApp(string $file, ?string $functionName): bool
$isInApp = true;

foreach ($excludedAppPaths as $excludedAppPath) {
if (str_starts_with($absoluteFilePath, $excludedAppPath)) {
if (mb_substr($absoluteFilePath, 0, mb_strlen($excludedAppPath)) === $excludedAppPath) {
$isInApp = false;

break;
}
}

foreach ($includedAppPaths as $includedAppPath) {
if (str_starts_with($absoluteFilePath, $includedAppPath)) {
if (mb_substr($absoluteFilePath, 0, mb_strlen($includedAppPath)) === $includedAppPath) {
$isInApp = true;

break;
Expand Down
2 changes: 1 addition & 1 deletion src/Tracing/DynamicSamplingContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public static function fromHeader(string $header): self

[$key, $value] = explode('=', $keyValue, 2);

if (str_starts_with($key, self::SENTRY_ENTRY_PREFIX)) {
if (self::SENTRY_ENTRY_PREFIX === mb_substr($key, 0, mb_strlen(self::SENTRY_ENTRY_PREFIX))) {
$samplingContext->set(rawurldecode(mb_substr($key, mb_strlen(self::SENTRY_ENTRY_PREFIX))), rawurldecode($value));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Util/PrefixStripper.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected function stripPrefixFromFilePath(?Options $options, string $filePath):
}

foreach ($options->getPrefixes() as $prefix) {
if (str_starts_with($filePath, $prefix)) {
if (mb_substr($filePath, 0, mb_strlen($prefix)) === $prefix) {
return mb_substr($filePath, mb_strlen($prefix));
}
}
Expand Down

0 comments on commit c23a0aa

Please sign in to comment.