Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support Symfony 6 #28

Merged
merged 2 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 36 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,26 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
symfony:
- '4.4.*'
- '5.3.*'
php:
- '7.4'
- '8.0'
- '8.1'
include:
- symfony: '4.4.*'
php: '7.4'
- symfony: '4.4.*'
php: '8.0'
- symfony: '4.4.*'
php: '8.1'
- symfony: '5.4.*'
php: '7.4'
- symfony: '5.4.*'
php: '8.0'
- symfony: '5.4.*'
php: '8.1'
- symfony: '6.0.*'
php: '8.0'
- symfony: '6.0.*'
php: '8.1'
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup PHP Action
uses: shivammathur/setup-php@v2
with:
Expand Down Expand Up @@ -63,16 +73,26 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
symfony:
- '4.4.*'
- '5.3.*'
php:
- '7.4'
- '8.0'
- '8.1'
include:
- symfony: '4.4.*'
php: '7.4'
- symfony: '4.4.*'
php: '8.0'
- symfony: '4.4.*'
php: '8.1'
- symfony: '5.4.*'
php: '7.4'
- symfony: '5.4.*'
php: '8.0'
- symfony: '5.4.*'
php: '8.1'
- symfony: '6.0.*'
php: '8.0'
- symfony: '6.0.*'
php: '8.1'
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup PHP Action
uses: shivammathur/setup-php@v2
with:
Expand Down
12 changes: 6 additions & 6 deletions DBAL/SQLSpanFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

final class SQLSpanFactory implements SpanFactory
{
private $statementFormatter;
private $tracing;
private $tagFullStatement;
private $tagParameters;
private $tagRowCount;
private $tagUser;
private SQLStatementFormatter $statementFormatter;
private Tracing $tracing;
private bool $tagFullStatement;
private bool $tagParameters;
private bool $tagRowCount;
private bool $tagUser;

public function __construct(
SQLStatementFormatter $statementFormatter,
Expand Down
4 changes: 2 additions & 2 deletions DBAL/TracingConnectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

final class TracingConnectionFactory
{
private $connectionFactory;
private $eventListener;
private DoctrineConnectionFactory $connectionFactory;
private TracingEventListener $eventListener;

public function __construct(
DoctrineConnectionFactory $connectionFactory,
Expand Down
12 changes: 6 additions & 6 deletions DBAL/TracingDriverConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
*/
final class TracingDriverConnection implements DBALDriverConnection, WrappingDriverConnection
{
private $decoratedConnection;
private $tracing;
private $spanFactory;
private $username;
private DBALDriverConnection $decoratedConnection;
private Tracing $tracing;
private SpanFactory $spanFactory;
private ?string $username;

public function __construct(
DBALDriverConnection $decoratedConnection,
Expand Down Expand Up @@ -49,7 +49,7 @@ public function query()
$parameters = array_slice($args, 1);
$this->spanFactory->beforeOperation($args[0]);
$result = $this->decoratedConnection->query(...$args);
$this->spanFactory->afterOperation($args[0], $parameters, $this->username, $result->rowCount());
$this->spanFactory->afterOperation($args[0], $parameters, $this->username, (int) $result->rowCount());
return new TracingStatement($result, $this->spanFactory, $args[0], $this->username);
}

Expand All @@ -70,7 +70,7 @@ public function exec($statement)
{
$this->spanFactory->beforeOperation($statement);
$result = $this->decoratedConnection->exec($statement);
$this->spanFactory->afterOperation($statement, [], $this->username, $result);
$this->spanFactory->afterOperation($statement, [], $this->username, (int) $result);
return $result;
}

Expand Down
4 changes: 2 additions & 2 deletions DBAL/TracingEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

final class TracingEventListener
{
private $tracing;
private $spanFactory;
private Tracing $tracing;
private SpanFactory $spanFactory;

public function __construct(
Tracing $tracing,
Expand Down
8 changes: 4 additions & 4 deletions DBAL/TracingStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ final class TracingStatement implements IteratorAggregate, StatementCombinedResu
* @var Statement<Statement>
*/
private $statement;
private $sql;
private $spanFactory;
private $username;
private string $sql;
private SpanFactory $spanFactory;
private ?string $username;
/**
* @var array<mixed>
*/
Expand Down Expand Up @@ -138,7 +138,7 @@ public function execute($params = null): bool
$this->sql,
$params ?? $this->params,
$this->username,
$this->statement->rowCount()
(int) $this->statement->rowCount()
);
return $result;
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# auxmoney OpentracingBundle - Doctrine DBAL

[![test](https://github.com/auxmoney/OpentracingBundle-Doctrine-DBAL/workflows/test/badge.svg)](https://github.com/auxmoney/OpentracingBundle-Doctrine-DBAL/actions?query=workflow%3Atest)
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/auxmoney/OpentracingBundle-Doctrine-DBAL)
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/auxmoney/OpentracingBundle-Doctrine-DBAL)](https://github.com/auxmoney/OpentracingBundle-Doctrine-DBAL/releases/latest)
![Coveralls github](https://img.shields.io/coveralls/github/auxmoney/OpentracingBundle-Doctrine-DBAL)
![Codacy Badge](https://api.codacy.com/project/badge/Grade/5ccaae3d94cf41c68ad8de83ddcbca1a)
![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/auxmoney/OpentracingBundle-Doctrine-DBAL)
Expand Down
11 changes: 5 additions & 6 deletions Tests/DBAL/SQLSpanFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ class SQLSpanFactoryTest extends TestCase

private $statementFormatter;
private $tracing;
private $tagFullStatement;
private $tagParameters;
private $tagRowCount;
private $tagUser;
/** @var SQLSpanFactory */
private $subject;
private string $tagFullStatement;
private string $tagParameters;
private string $tagRowCount;
private string $tagUser;
private SQLSpanFactory $subject;

public function setUp(): void
{
Expand Down
3 changes: 1 addition & 2 deletions Tests/DBAL/SQLStatementFormatterServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

class SQLStatementFormatterServiceTest extends TestCase
{
/** @var SQLStatementFormatterService */
private $subject;
private SQLStatementFormatterService $subject;

public function setUp(): void
{
Expand Down
11 changes: 4 additions & 7 deletions Tests/DBAL/TracingConnectionFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,17 @@ class TracingConnectionFactoryTest extends TestCase
use ProphecyTrait;

private $connectionFactory;
private $tracing;
private $spanFactory;
/** @var TracingConnectionFactory */
private $subject;
private TracingConnectionFactory $subject;

public function setUp(): void
{
parent::setUp();
$this->connectionFactory = $this->prophesize(DoctrineConnectionFactory::class);
$this->tracing = $this->prophesize(Tracing::class);
$this->spanFactory = $this->prophesize(SpanFactory::class);
$tracing = $this->prophesize(Tracing::class);
$spanFactory = $this->prophesize(SpanFactory::class);

$this->subject = new TracingConnectionFactory(
$this->connectionFactory->reveal(), $this->tracing->reveal(), $this->spanFactory->reveal()
$this->connectionFactory->reveal(), $tracing->reveal(), $spanFactory->reveal()
);
}

Expand Down
5 changes: 2 additions & 3 deletions Tests/DBAL/TracingDriverConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ class TracingDriverConnectionTest extends TestCase
private $decoratedConnection;
private $tracing;
private $spanFactory;
private $username;
/** @var TracingDriverConnection */
private $subject;
private string $username;
private TracingDriverConnection $subject;

public function setUp(): void
{
Expand Down
4 changes: 1 addition & 3 deletions Tests/DBAL/TracingEventListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ class TracingEventListenerTest extends TestCase

private $tracing;
private $spanFactory;

/** @var TracingEventListener */
private $subject;
private TracingEventListener $subject;

public function setUp(): void
{
Expand Down
7 changes: 3 additions & 4 deletions Tests/DBAL/TracingStatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ class TracingStatementTest extends TestCase

private $statement;
private $spanFactory;
private $sql;
private $username;
/** @var TracingStatement */
private $subject;
private string $sql;
private string $username;
private TracingStatement $subject;

public function setUp(): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

class OpentracingDoctrineDBALExtensionTest extends TestCase
{
/** @var OpentracingDoctrineDBALExtension */
private $subject;
private OpentracingDoctrineDBALExtension $subject;

public function setUp(): void
{
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"roave/security-advisories": "dev-latest",
"phpunit/phpunit": "^9.5",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/phpstan": "^1.1",
"phpstan/phpstan": "^1.5",
"squizlabs/php_codesniffer": "^3.6",
"phpmd/phpmd": "^2.10",
"phpmd/phpmd": "^2.12",
"php-coveralls/php-coveralls": "^2.5",
"symfony/filesystem": "*",
"symfony/process": "*",
Expand Down
Loading