diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe772b3..e0bf28f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,13 +9,13 @@ jobs: strategy: matrix: operating-system: ['ubuntu-latest'] - php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3'] + php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] - continue-on-error: ${{ matrix.php-versions == '8.3' }} + continue-on-error: ${{ matrix.php-versions == '8.4' }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -27,11 +27,11 @@ jobs: - name: Install Composer dependencies (PHP < 8.1) if: ${{ matrix.php-versions != '8.3' }} - uses: "ramsey/composer-install@v1" + uses: "ramsey/composer-install@v3" - name: Install Composer dependencies - ignore-platform-reqs (PHP 8.1) if: ${{ matrix.php-versions == '8.3' }} - uses: "ramsey/composer-install@v1" + uses: "ramsey/composer-install@v3" with: composer-options: --ignore-platform-reqs diff --git a/.github/workflows/psalm.yml b/.github/workflows/psalm.yml index 3c4efea..8757d7f 100644 --- a/.github/workflows/psalm.yml +++ b/.github/workflows/psalm.yml @@ -9,10 +9,10 @@ jobs: strategy: matrix: operating-system: ['ubuntu-latest'] - php-versions: ['8.1'] + php-versions: ['8.3'] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -22,7 +22,7 @@ jobs: coverage: none - name: Install Composer dependencies - uses: "ramsey/composer-install@v1" + uses: "ramsey/composer-install@v3" with: composer-options: --no-dev diff --git a/src/CSPBuilder.php b/src/CSPBuilder.php index 83ab9b8..544121d 100644 --- a/src/CSPBuilder.php +++ b/src/CSPBuilder.php @@ -289,8 +289,10 @@ public function addSource(string $directive, string $path): self if (!isset($this->policies[$directive]['allow'])) { $this->policies[$directive]['allow'] = []; } - if (!in_array($path, $this->policies[$directive]['allow'], true)) { - $this->policies[$directive]['allow'][] = $path; + if (is_array($this->policies[$directive]['allow'])) { + if (!in_array($path, $this->policies[$directive]['allow'], true)) { + $this->policies[$directive]['allow'][] = $path; + } } return $this; } @@ -1268,6 +1270,7 @@ protected function enc(string $piece, string $type = 'default'): string * Is this user currently connected over HTTPS? * * @return bool + * @psalm-suppress RiskyTruthyFalsyComparison */ protected function isHTTPSConnection(): bool {