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 diff --git a/src/DSN/DSN.php b/src/DSN/DSN.php index 185efc0..0eb0ef2 100644 --- a/src/DSN/DSN.php +++ b/src/DSN/DSN.php @@ -62,9 +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->host = $parts['host'] ?? ''; $this->port = $parts['port'] ?? null; - $this->path = isset($parts['path']) ? ltrim($parts['path'], '/') : null; + $this->path = isset($parts['path']) ? ltrim((string) $parts['path'], '/') : ''; $this->query = $parts['query'] ?? null; }