From adaa0f187cb290037b34b1a24a1c1b61ac00512b Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Wed, 1 Nov 2023 23:15:26 -0400 Subject: [PATCH 1/6] Tests for PHP 8.2 --- .github/workflows/pull_request.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 5008b48..01d81c4 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -4,14 +4,18 @@ on: [pull_request] jobs: lint: - name: Run Linter + name: Run Linter on PHP ${{ matrix.php }} runs-on: ubuntu-latest + strategy: + matrix: + php: ['8.0', '8.1', '8.2'] + steps: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: ${{ matrix.php }} - name: Checkout repository uses: actions/checkout@v3 @@ -26,14 +30,18 @@ jobs: - run: composer lint tests: - name: Run Unit Tests + name: Run Unit Tests on PHP ${{ matrix.php }} runs-on: ubuntu-latest + strategy: + matrix: + php: ['8.0', '8.1', '8.2'] + steps: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: ${{ matrix.php }} - name: Checkout repository uses: actions/checkout@v3 @@ -45,4 +53,4 @@ jobs: - name: Install dependencies run: composer update --ignore-platform-reqs --optimize-autoloader --no-plugins --no-scripts --prefer-dist - - run: composer test \ No newline at end of file + - run: composer test From 5e265ae841c1513bb7b319a9e2f95c4b5618da0f Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Wed, 1 Nov 2023 23:19:34 -0400 Subject: [PATCH 2/6] Update DSN.php --- src/DSN/DSN.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/DSN/DSN.php b/src/DSN/DSN.php index 185efc0..a60b7d0 100644 --- a/src/DSN/DSN.php +++ b/src/DSN/DSN.php @@ -60,11 +60,11 @@ public function __construct(string $dsn) } $this->scheme = $parts['scheme'] ?? null; - $this->user = isset($parts['user']) ? \urldecode($parts['user']) : null; - $this->password = isset($parts['pass']) ? \urldecode($parts['pass']) : null; - $this->host = $parts['host'] ?? null; + $this->user = $parts['user'] ?? null; + $this->password = $parts['pass'] ?? null; + $this->host = $parts['host'] ?? ''; $this->port = $parts['port'] ?? null; - $this->path = isset($parts['path']) ? ltrim($parts['path'], '/') : null; + $this->path = $parts['path'] ?? ''; $this->query = $parts['query'] ?? null; } @@ -125,11 +125,11 @@ public function getPort(): ?string */ public function getPath(): ?string { - return $this->path; + return ltrim($this->path, '/'); } /** - * Return the raw query string + * Return the query string * * @return ?string */ From 574eeecce6495fb7e395638643622d6a1dbf817e Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Wed, 1 Nov 2023 23:26:35 -0400 Subject: [PATCH 3/6] Update DSN.php --- src/DSN/DSN.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/DSN/DSN.php b/src/DSN/DSN.php index a60b7d0..0984b37 100644 --- a/src/DSN/DSN.php +++ b/src/DSN/DSN.php @@ -60,10 +60,14 @@ public function __construct(string $dsn) } $this->scheme = $parts['scheme'] ?? null; + $this->user = isset($parts['user']) ? \urldecode($parts['user']) : null; + $this->password = isset($parts['pass']) ? \urldecode($parts['pass']) : null; + $this->host = $parts['host'] ?? null; $this->user = $parts['user'] ?? null; $this->password = $parts['pass'] ?? null; $this->host = $parts['host'] ?? ''; $this->port = $parts['port'] ?? null; + $this->path = isset($parts['path']) ? ltrim($parts['path'], '/') : null; $this->path = $parts['path'] ?? ''; $this->query = $parts['query'] ?? null; } @@ -125,7 +129,7 @@ public function getPort(): ?string */ public function getPath(): ?string { - return ltrim($this->path, '/'); + return $this->path; } /** From b27de85d70e5bda5683d94c034cb7ad8f236f0b1 Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Wed, 1 Nov 2023 23:30:51 -0400 Subject: [PATCH 4/6] Update DSN.php --- src/DSN/DSN.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/DSN/DSN.php b/src/DSN/DSN.php index 0984b37..1f59665 100644 --- a/src/DSN/DSN.php +++ b/src/DSN/DSN.php @@ -62,13 +62,9 @@ public function __construct(string $dsn) $this->scheme = $parts['scheme'] ?? null; $this->user = isset($parts['user']) ? \urldecode($parts['user']) : null; $this->password = isset($parts['pass']) ? \urldecode($parts['pass']) : null; - $this->host = $parts['host'] ?? null; - $this->user = $parts['user'] ?? null; - $this->password = $parts['pass'] ?? null; $this->host = $parts['host'] ?? ''; $this->port = $parts['port'] ?? null; - $this->path = isset($parts['path']) ? ltrim($parts['path'], '/') : null; - $this->path = $parts['path'] ?? ''; + $this->path = isset($parts['path']) ? ltrim($parts['path'], '/') : ''; $this->query = $parts['query'] ?? null; } @@ -133,7 +129,7 @@ public function getPath(): ?string } /** - * Return the query string + * Return the raw query string * * @return ?string */ From 95c92d3428e51d50f5d949072387ffcb354ed6d1 Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Wed, 1 Nov 2023 23:42:19 -0400 Subject: [PATCH 5/6] Update DSN.php --- src/DSN/DSN.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DSN/DSN.php b/src/DSN/DSN.php index 1f59665..38a8a2b 100644 --- a/src/DSN/DSN.php +++ b/src/DSN/DSN.php @@ -64,7 +64,7 @@ public function __construct(string $dsn) $this->password = isset($parts['pass']) ? \urldecode($parts['pass']) : null; $this->host = $parts['host'] ?? ''; $this->port = $parts['port'] ?? null; - $this->path = isset($parts['path']) ? ltrim($parts['path'], '/') : ''; + $this->path = isset($parts['path']) ? ltrim((string)$parts['path'], '/') : ''; $this->query = $parts['query'] ?? null; } From 60ddab861f8f475a4a9e5bfe1405b2dd1848e216 Mon Sep 17 00:00:00 2001 From: "Eldad A. Fux" Date: Wed, 1 Nov 2023 23:44:30 -0400 Subject: [PATCH 6/6] Update DSN.php --- src/DSN/DSN.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DSN/DSN.php b/src/DSN/DSN.php index 38a8a2b..0eb0ef2 100644 --- a/src/DSN/DSN.php +++ b/src/DSN/DSN.php @@ -64,7 +64,7 @@ public function __construct(string $dsn) $this->password = isset($parts['pass']) ? \urldecode($parts['pass']) : null; $this->host = $parts['host'] ?? ''; $this->port = $parts['port'] ?? null; - $this->path = isset($parts['path']) ? ltrim((string)$parts['path'], '/') : ''; + $this->path = isset($parts['path']) ? ltrim((string) $parts['path'], '/') : ''; $this->query = $parts['query'] ?? null; }