Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ste93cry committed Apr 18, 2021
2 parents 43cd505 + d3833ab commit e6a6a8b
Show file tree
Hide file tree
Showing 69 changed files with 4,404 additions and 211 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/static-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ jobs:

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'

- name: Install dependencies
run: composer update --no-progress --no-interaction --prefer-dist
Expand Down
65 changes: 61 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
Tests:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental == true }}
env:
SYMFONY_REQUIRE: ${{matrix.symfony_constraint}}
strategy:
fail-fast: false
matrix:
Expand All @@ -21,7 +23,7 @@ jobs:
- '7.3'
- '7.2'
sentry_constraint: [false]
symfony_constraint: [false]
symfony_constraint: ['']
experimental: [false]
include:
# - description: 'sentry/sentry dev-develop'
Expand Down Expand Up @@ -55,9 +57,8 @@ jobs:
with:
php-version: ${{ matrix.php }}
coverage: xdebug
- run: |
sed -ri '/symfony\/(monolog-bundle|phpunit-bridge|messenger|psr-http-message-bridge|polyfill-php80)/! s/"symfony\/(.+)": "(.+)"/"symfony\/\1": "'${{ matrix.symfony_constraint }}'"/' composer.json;
if: matrix.symfony_constraint
- name: Install Symfony Flex
run: composer global require --no-progress --no-scripts --no-plugins symfony/flex
- run: composer remove --dev symfony/messenger --no-update
if: matrix.symfony_constraint == '3.4.*' || matrix.composer_option == '--prefer-lowest'
- run: composer update --no-progress --ansi ${{ matrix.composer_option }}
Expand All @@ -68,3 +69,59 @@ jobs:
with:
file: './coverage.xml'
fail_ci_if_error: true

missing-optional-packages-tests:
name: Tests without optional packages
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- '7.2'
- '8.0'
dependencies:
- lowest
- highest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug

- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Determine Composer cache directory
id: composer-cache
run: echo "::set-output name=directory::$(composer config cache-dir)"

- name: Cache Composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.directory }}
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-${{ matrix.dependencies }}-

- name: Remove optional packages
run: composer remove doctrine/dbal doctrine/doctrine-bundle symfony/messenger symfony/twig-bundle symfony/cache --dev --no-update

- name: Install highest dependencies
run: composer update --no-progress --no-interaction --prefer-dist
if: ${{ matrix.dependencies == 'highest' }}

- name: Install lowest dependencies
run: composer update --no-progress --no-interaction --prefer-dist --prefer-lowest
if: ${{ matrix.dependencies == 'lowest' }}

- name: Run tests
run: vendor/bin/phpunit --coverage-clover=build/coverage-report.xml

- name: Upload code coverage
uses: codecov/codecov-action@v1
with:
file: build/coverage-report.xml
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
## Unreleased
- Avoid failures when the `RequestFetcher` fails to translate the `Request` (#472)

- Add support for distributed tracing of Symfony request events (#423)
- Add support for distributed tracing of Twig template rendering (#430)
- Add support for distributed tracing of SQL queries while using Doctrine DBAL (#426)
- Add support for distributed tracing when running a console command (#455)
- Add support for distributed tracing of cache pools (#)
- Add `Full command` to extras for CLI commands, which includes command with all arguments
- Deprecate the `Sentry\SentryBundle\EventListener\ConsoleCommandListener` class in favor of its parent class `Sentry\SentryBundle\EventListener\ConsoleListener` (#429)
- 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)

## 4.0.3 (2021-03-03)
- Fix regression from #454 for `null` value on DSN not disabling Sentry (#457)

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ psalm:
test:
vendor/bin/phpunit

pre-commit-check: cs phpstan test
pre-commit-check: cs phpstan psalm test

setup-git:
git config branch.autosetuprebase always
38 changes: 23 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,19 @@
"jean85/pretty-package-versions": "^1.5 || ^2.0",
"php-http/discovery": "^1.11",
"sentry/sdk": "^3.1",
"symfony/config": "^3.4.43||^4.4.11||^5.0.11",
"symfony/console": "^3.4.43||^4.4.11||^5.0.11",
"symfony/dependency-injection": "^3.4.43||^4.4.11||^5.0.11",
"symfony/event-dispatcher": "^3.4.43||^4.4.11||^5.0.11",
"symfony/http-kernel": "^3.4.43||^4.4.11||^5.0.11",
"symfony/psr-http-message-bridge": "^2.0",
"symfony/security-core": "^3.4.43||^4.4.11||^5.0.11"
"symfony/config": "^3.4.44||^4.4.20||^5.0.11",
"symfony/console": "^3.4.44||^4.4.20||^5.0.11",
"symfony/dependency-injection": "^3.4.44||^4.4.20||^5.0.11",
"symfony/event-dispatcher": "^3.4.44||^4.4.20||^5.0.11",
"symfony/http-kernel": "^3.4.44||^4.4.20||^5.0.11",
"symfony/polyfill-php80": "^1.22",
"symfony/psr-http-message-bridge": "^1.2||^2.0",
"symfony/security-core": "^3.4.44||^4.4.20||^5.0.11"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.17",
"doctrine/dbal": "^2.10||^3.0",
"doctrine/doctrine-bundle": "^1.12||^2.0",
"friendsofphp/php-cs-fixer": "^2.18",
"jangregor/phpstan-prophecy": "^0.8",
"monolog/monolog": "^1.3||^2.0",
"phpspec/prophecy": "!=1.11.0",
Expand All @@ -41,17 +44,22 @@
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpunit/phpunit": "^8.5||^9.0",
"symfony/browser-kit": "^3.4.43||^4.4.11||^5.0.11",
"symfony/framework-bundle": "^3.4.43||^4.4.11||^5.0.11",
"symfony/messenger": "^4.4.11||^5.0.11",
"symfony/browser-kit": "^3.4.44||^4.4.20||^5.0.11",
"symfony/cache": "^3.4.44||^4.4.20||^5.0.11",
"symfony/dom-crawler": "^3.4.44||^4.4.20||^5.0.11",
"symfony/framework-bundle": "^3.4.44||^4.4.20||^5.0.11",
"symfony/messenger": "^4.4.20||^5.0.11",
"symfony/monolog-bundle": "^3.4",
"symfony/phpunit-bridge": "^5.0",
"symfony/polyfill-php80": "^1.22",
"symfony/yaml": "^3.4.43||^4.4.11||^5.0.11",
"symfony/phpunit-bridge": "^5.2.6",
"symfony/twig-bundle": "^3.4.44||^4.4.20||^5.0.11",
"symfony/yaml": "^3.4.44||^4.4.20||^5.0.11",
"vimeo/psalm": "^4.3"
},
"suggest": {
"monolog/monolog": "Allow sending log messages to Sentry by using the included Monolog handler."
"monolog/monolog": "Allow sending log messages to Sentry by using the included Monolog handler.",
"doctrine/doctrine-bundle": "Allow distributed tracing of database queries using Sentry.",
"symfony/twig-bundle": "Allow distributed tracing of Twig template rendering using Sentry.",
"symfony/cache": "Allow distributed tracing of cache pools using Sentry."
},
"autoload": {
"files": [
Expand Down
109 changes: 109 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,81 @@ parameters:
count: 1
path: src/EventListener/ErrorListener.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriver\\:\\:connect\\(\\) has parameter \\$driverOptions with no value type specified in iterable type array\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriver.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriver\\:\\:connect\\(\\) has parameter \\$password with no typehint specified\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriver.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriver\\:\\:connect\\(\\) has parameter \\$username with no typehint specified\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriver.php

-
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Driver\\|Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\Compatibility\\\\ExceptionConverterDriverInterface\\:\\:connect\\(\\)\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriver.php

-
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Driver\\|Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\Compatibility\\\\ExceptionConverterDriverInterface\\:\\:getDatabasePlatform\\(\\)\\.$#"
count: 2
path: src/Tracing/Doctrine/DBAL/TracingDriver.php

-
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Driver\\|Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\Compatibility\\\\ExceptionConverterDriverInterface\\:\\:getSchemaManager\\(\\)\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriver.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriver\\:\\:convertException\\(\\) has parameter \\$message with no typehint specified\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriver.php

-
message: "#^Call to an undefined method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\Compatibility\\\\ExceptionConverterDriverInterface\\:\\:convertException\\(\\)\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriver.php

-
message: "#^Parameter \\#2 \\$query of class Doctrine\\\\DBAL\\\\Exception\\\\DriverException constructor expects Doctrine\\\\DBAL\\\\Query\\|null, Doctrine\\\\DBAL\\\\Driver\\\\Exception given\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriver.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnection\\:\\:prepare\\(\\) has parameter \\$sql with no typehint specified\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriverConnection.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnection\\:\\:query\\(\\) has parameter \\$args with no typehint specified\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriverConnection.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnection\\:\\:exec\\(\\) has parameter \\$sql with no typehint specified\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriverConnection.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnection\\:\\:errorCode\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriverConnection.php

-
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Driver\\\\Connection\\:\\:errorCode\\(\\)\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriverConnection.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnection\\:\\:errorInfo\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriverConnection.php

-
message: "#^Class Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\GetResponseForExceptionEvent not found\\.$#"
count: 1
Expand All @@ -25,6 +100,16 @@ parameters:
count: 2
path: src/aliases.php

-
message: "#^Class Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\FilterResponseEvent not found\\.$#"
count: 1
path: src/aliases.php

-
message: "#^Class Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\PostResponseEvent not found\\.$#"
count: 1
path: src/aliases.php

-
message: "#^Class Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\FilterControllerEvent not found\\.$#"
count: 1
Expand Down Expand Up @@ -115,3 +200,27 @@ parameters:
count: 2
path: tests/EventListener/SubRequestListenerTest.php

-
message: "#^Trying to mock an undefined method getName\\(\\) on class Doctrine\\\\DBAL\\\\Driver\\.$#"
count: 1
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php

-
message: "#^Trying to mock an undefined method getDatabase\\(\\) on class Doctrine\\\\DBAL\\\\Driver\\.$#"
count: 1
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php

-
message: "#^Parameter \\#1 \\$driverException of class Doctrine\\\\DBAL\\\\Exception\\\\DriverException constructor expects Doctrine\\\\DBAL\\\\Driver\\\\Exception, string given\\.$#"
count: 1
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php

-
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\\.$#"
count: 1
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php

-
message: "#^Trying to mock an undefined method convertException\\(\\) on class Sentry\\\\SentryBundle\\\\Tests\\\\Tracing\\\\Doctrine\\\\DBAL\\\\StubExceptionConverterDriverInterface\\.$#"
count: 1
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php
3 changes: 3 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ parameters:
- tests/End2End/App
dynamicConstantNames:
- Symfony\Component\HttpKernel\Kernel::VERSION
- Doctrine\DBAL\Version::VERSION
stubFiles:
- tests/Stubs/Profile.phpstub
4 changes: 2 additions & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/schema/8.5.xsd"
colors="true"
bootstrap="vendor/autoload.php"
bootstrap="tests/bootstrap.php"
cacheResult="false"
beStrictAboutOutputDuringTests="true"
>
<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0" />
</php>

<testsuites>
Expand Down
16 changes: 16 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.7.0@d4377c0baf3ffbf0b1ec6998e8d1be2a40971005">
<file src="src/EventListener/ConsoleCommandListener.php">
<InvalidExtendClass occurrences="1">
<code>ConsoleListener</code>
</InvalidExtendClass>
<MethodSignatureMismatch occurrences="1">
<code>public function __construct(HubInterface $hub, bool $captureErrors = true)</code>
</MethodSignatureMismatch>
</file>
<file src="src/Tracing/Cache/TraceableCacheAdapterTrait.php">
<InvalidReturnType occurrences="1">
<code>getItems</code>
</InvalidReturnType>
</file>
</files>
6 changes: 5 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
<psalm
errorLevel="4"
resolveFromConfigFile="true"
memoizeMethodCallResults="true"
errorBaseline="psalm-baseline.xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand All @@ -13,4 +13,8 @@
<directory name="vendor" />
</ignoreFiles>
</projectFiles>

<stubs>
<file name="tests/Stubs/Profile.phpstub"/>
</stubs>
</psalm>
Loading

0 comments on commit e6a6a8b

Please sign in to comment.