Skip to content

Commit e6a6a8b

Browse files
committed
Merge branch 'develop'
2 parents 43cd505 + d3833ab commit e6a6a8b

File tree

69 files changed

+4404
-211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+4404
-211
lines changed

.github/workflows/static-analysis.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ jobs:
1818

1919
- name: Setup PHP
2020
uses: shivammathur/setup-php@v2
21-
with:
22-
php-version: '7.4'
2321

2422
- name: Install dependencies
2523
run: composer update --no-progress --no-interaction --prefer-dist

.github/workflows/tests.yaml

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ jobs:
1212
Tests:
1313
runs-on: ubuntu-latest
1414
continue-on-error: ${{ matrix.experimental == true }}
15+
env:
16+
SYMFONY_REQUIRE: ${{matrix.symfony_constraint}}
1517
strategy:
1618
fail-fast: false
1719
matrix:
@@ -21,7 +23,7 @@ jobs:
2123
- '7.3'
2224
- '7.2'
2325
sentry_constraint: [false]
24-
symfony_constraint: [false]
26+
symfony_constraint: ['']
2527
experimental: [false]
2628
include:
2729
# - description: 'sentry/sentry dev-develop'
@@ -55,9 +57,8 @@ jobs:
5557
with:
5658
php-version: ${{ matrix.php }}
5759
coverage: xdebug
58-
- run: |
59-
sed -ri '/symfony\/(monolog-bundle|phpunit-bridge|messenger|psr-http-message-bridge|polyfill-php80)/! s/"symfony\/(.+)": "(.+)"/"symfony\/\1": "'${{ matrix.symfony_constraint }}'"/' composer.json;
60-
if: matrix.symfony_constraint
60+
- name: Install Symfony Flex
61+
run: composer global require --no-progress --no-scripts --no-plugins symfony/flex
6162
- run: composer remove --dev symfony/messenger --no-update
6263
if: matrix.symfony_constraint == '3.4.*' || matrix.composer_option == '--prefer-lowest'
6364
- run: composer update --no-progress --ansi ${{ matrix.composer_option }}
@@ -68,3 +69,59 @@ jobs:
6869
with:
6970
file: './coverage.xml'
7071
fail_ci_if_error: true
72+
73+
missing-optional-packages-tests:
74+
name: Tests without optional packages
75+
runs-on: ubuntu-latest
76+
strategy:
77+
fail-fast: false
78+
matrix:
79+
php:
80+
- '7.2'
81+
- '8.0'
82+
dependencies:
83+
- lowest
84+
- highest
85+
86+
steps:
87+
- name: Checkout
88+
uses: actions/checkout@v2
89+
90+
- name: Setup PHP
91+
uses: shivammathur/setup-php@v2
92+
with:
93+
php-version: ${{ matrix.php }}
94+
coverage: xdebug
95+
96+
- name: Setup Problem Matchers for PHPUnit
97+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
98+
99+
- name: Determine Composer cache directory
100+
id: composer-cache
101+
run: echo "::set-output name=directory::$(composer config cache-dir)"
102+
103+
- name: Cache Composer dependencies
104+
uses: actions/cache@v2
105+
with:
106+
path: ${{ steps.composer-cache.outputs.directory }}
107+
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}
108+
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-${{ matrix.dependencies }}-
109+
110+
- name: Remove optional packages
111+
run: composer remove doctrine/dbal doctrine/doctrine-bundle symfony/messenger symfony/twig-bundle symfony/cache --dev --no-update
112+
113+
- name: Install highest dependencies
114+
run: composer update --no-progress --no-interaction --prefer-dist
115+
if: ${{ matrix.dependencies == 'highest' }}
116+
117+
- name: Install lowest dependencies
118+
run: composer update --no-progress --no-interaction --prefer-dist --prefer-lowest
119+
if: ${{ matrix.dependencies == 'lowest' }}
120+
121+
- name: Run tests
122+
run: vendor/bin/phpunit --coverage-clover=build/coverage-report.xml
123+
124+
- name: Upload code coverage
125+
uses: codecov/codecov-action@v1
126+
with:
127+
file: build/coverage-report.xml

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
## Unreleased
44
- Avoid failures when the `RequestFetcher` fails to translate the `Request` (#472)
55

6+
- Add support for distributed tracing of Symfony request events (#423)
7+
- Add support for distributed tracing of Twig template rendering (#430)
8+
- Add support for distributed tracing of SQL queries while using Doctrine DBAL (#426)
9+
- Add support for distributed tracing when running a console command (#455)
10+
- Add support for distributed tracing of cache pools (#)
11+
- Add `Full command` to extras for CLI commands, which includes command with all arguments
12+
- Deprecate the `Sentry\SentryBundle\EventListener\ConsoleCommandListener` class in favor of its parent class `Sentry\SentryBundle\EventListener\ConsoleListener` (#429)
13+
- Lower the required version of `symfony/psr-http-message-bridge` to allow installing it on a project that uses Symfony `3.4.x` components only (#480)
14+
615
## 4.0.3 (2021-03-03)
716
- Fix regression from #454 for `null` value on DSN not disabling Sentry (#457)
817

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ psalm:
1515
test:
1616
vendor/bin/phpunit
1717

18-
pre-commit-check: cs phpstan test
18+
pre-commit-check: cs phpstan psalm test
1919

2020
setup-git:
2121
git config branch.autosetuprebase always

composer.json

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,19 @@
2323
"jean85/pretty-package-versions": "^1.5 || ^2.0",
2424
"php-http/discovery": "^1.11",
2525
"sentry/sdk": "^3.1",
26-
"symfony/config": "^3.4.43||^4.4.11||^5.0.11",
27-
"symfony/console": "^3.4.43||^4.4.11||^5.0.11",
28-
"symfony/dependency-injection": "^3.4.43||^4.4.11||^5.0.11",
29-
"symfony/event-dispatcher": "^3.4.43||^4.4.11||^5.0.11",
30-
"symfony/http-kernel": "^3.4.43||^4.4.11||^5.0.11",
31-
"symfony/psr-http-message-bridge": "^2.0",
32-
"symfony/security-core": "^3.4.43||^4.4.11||^5.0.11"
26+
"symfony/config": "^3.4.44||^4.4.20||^5.0.11",
27+
"symfony/console": "^3.4.44||^4.4.20||^5.0.11",
28+
"symfony/dependency-injection": "^3.4.44||^4.4.20||^5.0.11",
29+
"symfony/event-dispatcher": "^3.4.44||^4.4.20||^5.0.11",
30+
"symfony/http-kernel": "^3.4.44||^4.4.20||^5.0.11",
31+
"symfony/polyfill-php80": "^1.22",
32+
"symfony/psr-http-message-bridge": "^1.2||^2.0",
33+
"symfony/security-core": "^3.4.44||^4.4.20||^5.0.11"
3334
},
3435
"require-dev": {
35-
"friendsofphp/php-cs-fixer": "^2.17",
36+
"doctrine/dbal": "^2.10||^3.0",
37+
"doctrine/doctrine-bundle": "^1.12||^2.0",
38+
"friendsofphp/php-cs-fixer": "^2.18",
3639
"jangregor/phpstan-prophecy": "^0.8",
3740
"monolog/monolog": "^1.3||^2.0",
3841
"phpspec/prophecy": "!=1.11.0",
@@ -41,17 +44,22 @@
4144
"phpstan/phpstan": "^0.12",
4245
"phpstan/phpstan-phpunit": "^0.12",
4346
"phpunit/phpunit": "^8.5||^9.0",
44-
"symfony/browser-kit": "^3.4.43||^4.4.11||^5.0.11",
45-
"symfony/framework-bundle": "^3.4.43||^4.4.11||^5.0.11",
46-
"symfony/messenger": "^4.4.11||^5.0.11",
47+
"symfony/browser-kit": "^3.4.44||^4.4.20||^5.0.11",
48+
"symfony/cache": "^3.4.44||^4.4.20||^5.0.11",
49+
"symfony/dom-crawler": "^3.4.44||^4.4.20||^5.0.11",
50+
"symfony/framework-bundle": "^3.4.44||^4.4.20||^5.0.11",
51+
"symfony/messenger": "^4.4.20||^5.0.11",
4752
"symfony/monolog-bundle": "^3.4",
48-
"symfony/phpunit-bridge": "^5.0",
49-
"symfony/polyfill-php80": "^1.22",
50-
"symfony/yaml": "^3.4.43||^4.4.11||^5.0.11",
53+
"symfony/phpunit-bridge": "^5.2.6",
54+
"symfony/twig-bundle": "^3.4.44||^4.4.20||^5.0.11",
55+
"symfony/yaml": "^3.4.44||^4.4.20||^5.0.11",
5156
"vimeo/psalm": "^4.3"
5257
},
5358
"suggest": {
54-
"monolog/monolog": "Allow sending log messages to Sentry by using the included Monolog handler."
59+
"monolog/monolog": "Allow sending log messages to Sentry by using the included Monolog handler.",
60+
"doctrine/doctrine-bundle": "Allow distributed tracing of database queries using Sentry.",
61+
"symfony/twig-bundle": "Allow distributed tracing of Twig template rendering using Sentry.",
62+
"symfony/cache": "Allow distributed tracing of cache pools using Sentry."
5563
},
5664
"autoload": {
5765
"files": [

phpstan-baseline.neon

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,81 @@ parameters:
1515
count: 1
1616
path: src/EventListener/ErrorListener.php
1717

18+
-
19+
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriver\\:\\:connect\\(\\) has parameter \\$driverOptions with no value type specified in iterable type array\\.$#"
20+
count: 1
21+
path: src/Tracing/Doctrine/DBAL/TracingDriver.php
22+
23+
-
24+
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriver\\:\\:connect\\(\\) has parameter \\$password with no typehint specified\\.$#"
25+
count: 1
26+
path: src/Tracing/Doctrine/DBAL/TracingDriver.php
27+
28+
-
29+
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriver\\:\\:connect\\(\\) has parameter \\$username with no typehint specified\\.$#"
30+
count: 1
31+
path: src/Tracing/Doctrine/DBAL/TracingDriver.php
32+
33+
-
34+
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Driver\\|Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\Compatibility\\\\ExceptionConverterDriverInterface\\:\\:connect\\(\\)\\.$#"
35+
count: 1
36+
path: src/Tracing/Doctrine/DBAL/TracingDriver.php
37+
38+
-
39+
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Driver\\|Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\Compatibility\\\\ExceptionConverterDriverInterface\\:\\:getDatabasePlatform\\(\\)\\.$#"
40+
count: 2
41+
path: src/Tracing/Doctrine/DBAL/TracingDriver.php
42+
43+
-
44+
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Driver\\|Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\Compatibility\\\\ExceptionConverterDriverInterface\\:\\:getSchemaManager\\(\\)\\.$#"
45+
count: 1
46+
path: src/Tracing/Doctrine/DBAL/TracingDriver.php
47+
48+
-
49+
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriver\\:\\:convertException\\(\\) has parameter \\$message with no typehint specified\\.$#"
50+
count: 1
51+
path: src/Tracing/Doctrine/DBAL/TracingDriver.php
52+
53+
-
54+
message: "#^Call to an undefined method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\Compatibility\\\\ExceptionConverterDriverInterface\\:\\:convertException\\(\\)\\.$#"
55+
count: 1
56+
path: src/Tracing/Doctrine/DBAL/TracingDriver.php
57+
58+
-
59+
message: "#^Parameter \\#2 \\$query of class Doctrine\\\\DBAL\\\\Exception\\\\DriverException constructor expects Doctrine\\\\DBAL\\\\Query\\|null, Doctrine\\\\DBAL\\\\Driver\\\\Exception given\\.$#"
60+
count: 1
61+
path: src/Tracing/Doctrine/DBAL/TracingDriver.php
62+
63+
-
64+
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnection\\:\\:prepare\\(\\) has parameter \\$sql with no typehint specified\\.$#"
65+
count: 1
66+
path: src/Tracing/Doctrine/DBAL/TracingDriverConnection.php
67+
68+
-
69+
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnection\\:\\:query\\(\\) has parameter \\$args with no typehint specified\\.$#"
70+
count: 1
71+
path: src/Tracing/Doctrine/DBAL/TracingDriverConnection.php
72+
73+
-
74+
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnection\\:\\:exec\\(\\) has parameter \\$sql with no typehint specified\\.$#"
75+
count: 1
76+
path: src/Tracing/Doctrine/DBAL/TracingDriverConnection.php
77+
78+
-
79+
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnection\\:\\:errorCode\\(\\) has no return typehint specified\\.$#"
80+
count: 1
81+
path: src/Tracing/Doctrine/DBAL/TracingDriverConnection.php
82+
83+
-
84+
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Driver\\\\Connection\\:\\:errorCode\\(\\)\\.$#"
85+
count: 1
86+
path: src/Tracing/Doctrine/DBAL/TracingDriverConnection.php
87+
88+
-
89+
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnection\\:\\:errorInfo\\(\\) has no return typehint specified\\.$#"
90+
count: 1
91+
path: src/Tracing/Doctrine/DBAL/TracingDriverConnection.php
92+
1893
-
1994
message: "#^Class Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\GetResponseForExceptionEvent not found\\.$#"
2095
count: 1
@@ -25,6 +100,16 @@ parameters:
25100
count: 2
26101
path: src/aliases.php
27102

103+
-
104+
message: "#^Class Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\FilterResponseEvent not found\\.$#"
105+
count: 1
106+
path: src/aliases.php
107+
108+
-
109+
message: "#^Class Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\PostResponseEvent not found\\.$#"
110+
count: 1
111+
path: src/aliases.php
112+
28113
-
29114
message: "#^Class Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\FilterControllerEvent not found\\.$#"
30115
count: 1
@@ -115,3 +200,27 @@ parameters:
115200
count: 2
116201
path: tests/EventListener/SubRequestListenerTest.php
117202

203+
-
204+
message: "#^Trying to mock an undefined method getName\\(\\) on class Doctrine\\\\DBAL\\\\Driver\\.$#"
205+
count: 1
206+
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php
207+
208+
-
209+
message: "#^Trying to mock an undefined method getDatabase\\(\\) on class Doctrine\\\\DBAL\\\\Driver\\.$#"
210+
count: 1
211+
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php
212+
213+
-
214+
message: "#^Parameter \\#1 \\$driverException of class Doctrine\\\\DBAL\\\\Exception\\\\DriverException constructor expects Doctrine\\\\DBAL\\\\Driver\\\\Exception, string given\\.$#"
215+
count: 1
216+
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php
217+
218+
-
219+
message: "#^Parameter \\#2 \\$query of class Doctrine\\\\DBAL\\\\Exception\\\\DriverException constructor expects Doctrine\\\\DBAL\\\\Query\\|null, Doctrine\\\\DBAL\\\\Driver\\\\Exception&PHPUnit\\\\Framework\\\\MockObject\\\\MockObject given\\.$#"
220+
count: 1
221+
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php
222+
223+
-
224+
message: "#^Trying to mock an undefined method convertException\\(\\) on class Sentry\\\\SentryBundle\\\\Tests\\\\Tracing\\\\Doctrine\\\\DBAL\\\\StubExceptionConverterDriverInterface\\.$#"
225+
count: 1
226+
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php

phpstan.neon

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ parameters:
1010
- tests/End2End/App
1111
dynamicConstantNames:
1212
- Symfony\Component\HttpKernel\Kernel::VERSION
13+
- Doctrine\DBAL\Version::VERSION
14+
stubFiles:
15+
- tests/Stubs/Profile.phpstub

phpunit.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/schema/8.5.xsd"
44
colors="true"
5-
bootstrap="vendor/autoload.php"
5+
bootstrap="tests/bootstrap.php"
66
cacheResult="false"
77
beStrictAboutOutputDuringTests="true"
88
>
99
<php>
10-
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
10+
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0" />
1111
</php>
1212

1313
<testsuites>

psalm-baseline.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<files psalm-version="4.7.0@d4377c0baf3ffbf0b1ec6998e8d1be2a40971005">
3+
<file src="src/EventListener/ConsoleCommandListener.php">
4+
<InvalidExtendClass occurrences="1">
5+
<code>ConsoleListener</code>
6+
</InvalidExtendClass>
7+
<MethodSignatureMismatch occurrences="1">
8+
<code>public function __construct(HubInterface $hub, bool $captureErrors = true)</code>
9+
</MethodSignatureMismatch>
10+
</file>
11+
<file src="src/Tracing/Cache/TraceableCacheAdapterTrait.php">
12+
<InvalidReturnType occurrences="1">
13+
<code>getItems</code>
14+
</InvalidReturnType>
15+
</file>
16+
</files>

psalm.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0"?>
22
<psalm
33
errorLevel="4"
4-
resolveFromConfigFile="true"
54
memoizeMethodCallResults="true"
5+
errorBaseline="psalm-baseline.xml"
66
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
77
xmlns="https://getpsalm.org/schema/config"
88
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
@@ -13,4 +13,8 @@
1313
<directory name="vendor" />
1414
</ignoreFiles>
1515
</projectFiles>
16+
17+
<stubs>
18+
<file name="tests/Stubs/Profile.phpstub"/>
19+
</stubs>
1620
</psalm>

0 commit comments

Comments
 (0)