Skip to content

Commit 70dcc0b

Browse files
authored
ref: Use constant for the SDK version (#662)
1 parent f3fbf70 commit 70dcc0b

File tree

7 files changed

+31
-7
lines changed

7 files changed

+31
-7
lines changed

.craft.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ minVersion: 0.23.1
22
changelogPolicy: simple
33
artifactProvider:
44
name: none
5-
preReleaseCommand: ''
65
targets:
76
- name: github
87
- name: registry

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Add support for tracing of the Symfony HTTP client requests (#606)
66
- Support logging the impersonator user, if any (#647)
7+
- ref: Use constant for the SDK version (#662)
78

89
## 4.3.1 (2022-10-10)
910

scripts/bump-version.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
set -eux
3+
4+
# if [ "$(uname -s)" != "Linux" ]; then
5+
# echo "Please use the GitHub Action."
6+
# exit 1
7+
# fi
8+
9+
SCRIPT_DIR="$( dirname "$0" )"
10+
cd $SCRIPT_DIR/..
11+
12+
OLD_VERSION="${1}"
13+
NEW_VERSION="${2}"
14+
15+
echo "Current version: $OLD_VERSION"
16+
echo "Bumping version: $NEW_VERSION"
17+
18+
function replace() {
19+
! grep "$2" $3
20+
perl -i -pe "s/$1/$2/g" $3
21+
grep "$2" $3 # verify that replacement was successful
22+
}
23+
24+
replace "SDK_VERSION = '[0-9.]+'" "SDK_VERSION = '$NEW_VERSION'" ./src/SentryBundle.php

src/DependencyInjection/SentryExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Sentry\SentryBundle\DependencyInjection;
66

77
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
8-
use Jean85\PrettyVersions;
98
use LogicException;
109
use Psr\Log\NullLogger;
1110
use Sentry\Client;
@@ -140,7 +139,7 @@ private function registerConfiguration(ContainerBuilder $container, array $confi
140139
$clientBuilderDefinition = (new Definition(ClientBuilder::class))
141140
->setArgument(0, new Reference('sentry.client.options'))
142141
->addMethodCall('setSdkIdentifier', [SentryBundle::SDK_IDENTIFIER])
143-
->addMethodCall('setSdkVersion', [PrettyVersions::getVersion('sentry/sentry-symfony')->getPrettyVersion()])
142+
->addMethodCall('setSdkVersion', [SentryBundle::SDK_VERSION])
144143
->addMethodCall('setTransportFactory', [new Reference($config['transport_factory'])])
145144
->addMethodCall('setSerializer', [$serializer])
146145
->addMethodCall('setRepresentationSerializer', [$representationSerializerDefinition])

src/SentryBundle.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ final class SentryBundle extends Bundle
1414
{
1515
public const SDK_IDENTIFIER = 'sentry.php.symfony';
1616

17+
public const SDK_VERSION = '4.3.1';
18+
1719
public function build(ContainerBuilder $container): void
1820
{
1921
parent::build($container);

src/Transport/TransportFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66

77
use Http\Client\HttpAsyncClient as HttpAsyncClientInterface;
88
use Http\Discovery\Psr17FactoryDiscovery;
9-
use Jean85\PrettyVersions;
109
use Psr\Http\Message\RequestFactoryInterface;
1110
use Psr\Http\Message\ResponseFactoryInterface;
1211
use Psr\Http\Message\StreamFactoryInterface;
1312
use Psr\Http\Message\UriFactoryInterface;
1413
use Psr\Log\LoggerInterface;
1514
use Sentry\HttpClient\HttpClientFactory;
1615
use Sentry\Options;
16+
use Sentry\SentryBundle\SentryBundle;
1717
use Sentry\Transport\DefaultTransportFactory;
1818
use Sentry\Transport\TransportFactoryInterface;
1919
use Sentry\Transport\TransportInterface;
@@ -52,7 +52,7 @@ public function __construct(
5252
$streamFactory,
5353
$httpClient,
5454
'sentry.php.symfony',
55-
PrettyVersions::getVersion('sentry/sentry-symfony')->getPrettyVersion()
55+
SentryBundle::SDK_VERSION
5656
),
5757
$logger
5858
);

tests/DependencyInjection/SentryExtensionTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Sentry\SentryBundle\Tests\DependencyInjection;
66

77
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
8-
use Jean85\PrettyVersions;
98
use PHPUnit\Framework\TestCase;
109
use Psr\Log\NullLogger;
1110
use Sentry\ClientInterface;
@@ -244,7 +243,7 @@ public function testClientIsCreatedFromOptions(): void
244243

245244
$this->assertCount(6, $methodCalls);
246245
$this->assertDefinitionMethodCallAt($methodCalls[0], 'setSdkIdentifier', [SentryBundle::SDK_IDENTIFIER]);
247-
$this->assertDefinitionMethodCallAt($methodCalls[1], 'setSdkVersion', [PrettyVersions::getVersion('sentry/sentry-symfony')->getPrettyVersion()]);
246+
$this->assertDefinitionMethodCallAt($methodCalls[1], 'setSdkVersion', [SentryBundle::SDK_VERSION]);
248247
$this->assertDefinitionMethodCallAt($methodCalls[2], 'setTransportFactory', [new Reference('App\\Sentry\\Transport\\TransportFactory')]);
249248
$this->assertDefinitionMethodCallAt($methodCalls[5], 'setLogger', [new Reference('app.logger')]);
250249

0 commit comments

Comments
 (0)