From 674d4446722027d252d33ee99bfa2e7026048358 Mon Sep 17 00:00:00 2001 From: Brad Kent Date: Mon, 14 Oct 2024 16:56:01 -0500 Subject: [PATCH] DoctrineMiddleware tweaks add php8.4 to github actions --- .github/workflows/phpunit.yml | 2 +- README.md | 4 ++-- src/Debug/Collector/Doctrine/Connection.php | 5 +++-- src/Debug/Collector/Doctrine/Statement.php | 4 ++-- tests/Debug/Collector/DoctrineMiddlewareTest.php | 7 ++++--- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index aa0c560d..479a7bee 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -7,7 +7,7 @@ jobs: matrix: # windows-latest, macOS-latest operating-system: [ubuntu-latest] - php-version: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] + php-version: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] name: PHP ${{ matrix.php-version }} Test on ${{ matrix.operating-system }} # services: # mysql: diff --git a/README.md b/README.md index b0184e77..923bae81 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Browser/javascript like console class for PHP ## Installation -This library supports PHP 5.4 - 8.3 +This library supports PHP 5.4 - 8.4 It is installable and autoloadable via [Composer](https://getcomposer.org/) as [bdk/debug](https://packagist.org/packages/bdk/debug). @@ -102,7 +102,7 @@ $monolog->critical('all your base are belong to them'); ## Tests / Quality -![Supported PHP versions](https://img.shields.io/static/v1?label=PHP&message=5.4%20-%208.3&color=blue) +![Supported PHP versions](https://img.shields.io/static/v1?label=PHP&message=5.4%20-%208.4&color=blue) ![Build Status](https://img.shields.io/github/actions/workflow/status/bkdotcom/PHPDebugConsole/phpunit.yml.svg?branch=master&logo=github) [![Codacy Score](https://img.shields.io/codacy/grade/e950849edfd9463b993386080d39875e/master.svg?logo=codacy)](https://app.codacy.com/gh/bkdotcom/PHPDebugConsole/dashboard) [![Maintainability](https://img.shields.io/codeclimate/maintainability/bkdotcom/PHPDebugConsole.svg?logo=codeclimate)](https://codeclimate.com/github/bkdotcom/PHPDebugConsole) diff --git a/src/Debug/Collector/Doctrine/Connection.php b/src/Debug/Collector/Doctrine/Connection.php index 72049526..024421a6 100644 --- a/src/Debug/Collector/Doctrine/Connection.php +++ b/src/Debug/Collector/Doctrine/Connection.php @@ -132,7 +132,7 @@ private function buildDsn() $params = \array_merge(array( 'dbname' => null, 'driver' => null, - 'host' => null, + 'host' => 'localhost', 'memory' => false, 'password' => null, 'user' => null, @@ -147,7 +147,8 @@ private function buildDsn() $keysNew = \array_values(\array_intersect_key($map, $rename)); $renamed = \array_combine($keysNew, \array_values($rename)); $parts = \array_merge($renamed, $params); - if ($params['memory']) { + if ($params['memory'] || $params['dbname'] === ':memory:') { + $params['memory'] = true; $parts['path'] = ':memory:'; } $parts['scheme'] = \str_replace('_', '-', $parts['scheme']); diff --git a/src/Debug/Collector/Doctrine/Statement.php b/src/Debug/Collector/Doctrine/Statement.php index cb201cc1..8a4adee8 100644 --- a/src/Debug/Collector/Doctrine/Statement.php +++ b/src/Debug/Collector/Doctrine/Statement.php @@ -21,10 +21,10 @@ class Statement extends AbstractStatementMiddleware private $sql; /** @var array|array */ - private array $params = []; + private $params = []; /** @var array|array */ - private array $types = []; + private $types = []; /** * Constructor diff --git a/tests/Debug/Collector/DoctrineMiddlewareTest.php b/tests/Debug/Collector/DoctrineMiddlewareTest.php index d283d813..d91fdb11 100644 --- a/tests/Debug/Collector/DoctrineMiddlewareTest.php +++ b/tests/Debug/Collector/DoctrineMiddlewareTest.php @@ -178,10 +178,11 @@ public function getConnection() return false; } - $dsnParser = new \Doctrine\DBAL\Tools\DsnParser(); - $params = $dsnParser->parse('pdo-sqlite:///:memory:'); $conn = DriverManager::getConnection( - $params, + array( + 'dbname' => ':memory:', + 'driver' => 'pdo_sqlite', + ), (new \Doctrine\DBAL\Configuration())->setMiddlewares([ new DoctrineMiddleware(), ])