From 494467de3894226b3540e35f9713ba3e6f8c70bc Mon Sep 17 00:00:00 2001 From: Tim Nolte Date: Thu, 18 Aug 2022 23:21:16 -0400 Subject: [PATCH] Fixes and Updates GitHub Actions * Updates GitHub Actions for better handling of environment versions and caching. * Fixes GitHub Actions to leverage environment variables and matrices. --- .github/workflows/i18n.yml | 25 +- .github/workflows/linting.yml | 44 ++- .github/workflows/pr-unit-testing.yml | 67 ++-- .github/workflows/release.yml | 15 +- .github/workflows/static-analysis.yml | 47 ++- .github/workflows/unit-testing.yml | 125 +++--- .nvmrc | 2 +- composer.json | 15 +- composer.lock | 526 ++++++++++---------------- openid-connect-generic.php | 4 +- phpstan.neon.dist | 24 +- 11 files changed, 389 insertions(+), 505 deletions(-) diff --git a/.github/workflows/i18n.yml b/.github/workflows/i18n.yml index 344285bd..a4f59e3a 100644 --- a/.github/workflows/i18n.yml +++ b/.github/workflows/i18n.yml @@ -5,42 +5,31 @@ on: push: branches: - dev - - main - 'release/**' - 'feature/**' - 'fix/**' env: WP_MULTISITE: 0 + ACTION_VERSION: 2 jobs: - check: - name: Setup & Check + check_i18n: + name: Setup & Check Internationalization runs-on: ubuntu-latest steps: - name: Checkout Code + # https://github.com/marketplace/actions/checkout uses: actions/checkout@v2 - name: Setup Node Environment - uses: actions/setup-node@v1 # https://github.com/marketplace/actions/setup-node-js-environment + uses: actions/setup-node@v2 with: - node-version: 14.x - - - name: Cache node modules - uses: actions/cache@v2 - env: - npm-cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.npm-cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.npm-cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- + node-version-file: '.nvmrc' + cache: ${{ !env.ACT && 'npm' || '' }} - name: NPM Install run: npm ci diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index d0da7999..f0c6a7d7 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -5,43 +5,53 @@ on: push: branches: - dev - - main - 'release/**' - 'feature/**' - 'fix/**' env: - PHP_VERSION: 7.4 + PHP_VERSION: '7.4' WP_MULTISITE: 0 + COMPOSER_VERSION: '2.2' + ACTION_VERSION: 2 jobs: - check: - name: Setup & Check + check_linting: + name: Setup & Check Coding Standards runs-on: ubuntu-latest steps: - name: Checkout Code + # https://github.com/marketplace/actions/checkout uses: actions/checkout@v2 - - name: Setup PHP Environment - uses: shivammathur/setup-php@v2 - # https://github.com/marketplace/actions/setup-php-action - with: - php-version: ${{ env.PHP_VERSION }} - tools: composer:v2 + - name: Get Composer Cache Directory + id: composer-cache + if: ${{ !env.ACT }} + run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Cache Composer dependencies - uses: actions/cache@v2 + if: ${{ !env.ACT }} + # https://github.com/marketplace/actions/cache + uses: actions/cache@v3 env: - composer-cache-name: cache-vendor + composer-cache-name: cache-composer with: - path: ~/vendor - key: ${{ runner.os }}-build-${{ env.composer-cache-name }}-${{ hashFiles('**/composer.lock') }} + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-build-${{ env.composer-cache-name }}-v${{ env.ACTION_VERSION }}-${{ hashFiles('**/composer.lock') }} restore-keys: | - ${{ runner.os }}-build-${{ env.composer-cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- + ${{ runner.os }}-build-${{ env.composer-cache-name }}-v${{ env.ACTION_VERSION }}- + + - name: Setup PHP & Composer Environment + # https://github.com/marketplace/actions/setup-php-action + uses: shivammathur/setup-php@v2 + with: + php-version: "${{ env.PHP_VERSION }}" + tools: "composer:${{ env.COMPOSER_VERSION }}" + + - name: Environment Check + run: php -v && composer --version - name: Install Composer Dependencies run: composer install diff --git a/.github/workflows/pr-unit-testing.yml b/.github/workflows/pr-unit-testing.yml index f522e1d6..e0a71643 100644 --- a/.github/workflows/pr-unit-testing.yml +++ b/.github/workflows/pr-unit-testing.yml @@ -7,60 +7,61 @@ on: pull_request: env: - PHP_STABLE_VERSION: '7.4' - WP_PREF_STABLE_VERSION: '5.7.*' + PHP_VERSION: '7.4' + WP_VERSION: '5.9.*' WP_MULTISITE: 0 + COMPOSER_VERSION: '2.2' + ACTION_VERSION: 2 jobs: - test: + pr_unit_testing: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - job-name: 'Preferred Stable Requirements' - bleeding-edge: false - php-version: '7.4' - wordpress-version: '5.7.*' - wp-multisite-mode: 0 - - name: '${{ matrix.job-name }} (PHP:${{ matrix.php-version }}/WP:${{ matrix.wordpress-version }})' + name: 'Unit Test PR in Latest Stable Requirements' steps: - name: Checkout Code + # https://github.com/marketplace/actions/checkout uses: actions/checkout@v2 - - name: Setup PHP Environment - uses: shivammathur/setup-php@v2 - # https://github.com/marketplace/actions/setup-php-action + - name: Get Composer Cache Directory + id: composer-cache + if: ${{ !env.ACT }} + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache Composer dependencies + if: ${{ !env.ACT }} + uses: actions/cache@v2 + env: + composer-cache-name: cache-composer with: - php-version: ${{ matrix.php-version }} - tools: composer:v2 + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-build-${{ env.composer-cache-name }}-wp-${{ env.WP_VERSION }}-v${{ env.ACTION_VERSION }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.composer-cache-name }}-wp-${{ env.WP_VERSION }}-v${{ env.ACTION_VERSION }}- - name: Setup Node Environment - uses: actions/setup-node@v1 # https://github.com/marketplace/actions/setup-node-js-environment + uses: actions/setup-node@v2 with: - node-version: 14.x + node-version-file: '.nvmrc' + cache: ${{ !env.ACT && 'npm' || '' }} - - name: Cache Composer dependencies - uses: actions/cache@v2 - env: - composer-cache-name: cache-vendor + - name: Setup PHP & Composer Environment + # https://github.com/marketplace/actions/setup-php-action + uses: shivammathur/setup-php@v2 with: - path: ~/vendor - key: ${{ runner.os }}-build-${{ env.composer-cache-name }}-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.composer-cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- + php-version: "${{ env.PHP_VERSION }}" + tools: "composer:${{ env.COMPOSER_VERSION }}" + + - name: Environment Check + run: php -v && composer --version - name: Require Specified WordPress Version - run: composer require johnpbloch/wordpress-core:${{ matrix.wordpress-version }} --dev --prefer-source --update-with-all-dependencies + run: composer require johnpbloch/wordpress-core:${{ env.WP_VERSION }} php-stubs/wordpress-stubs:${{ env.WP_VERSION }} wp-phpunit/wp-phpunit:${{ env.WP_VERSION }} --dev --prefer-source --update-with-all-dependencies - name: Install Composer Dependencies - run: composer install + run: composer install --prefer-dist - name: NPM Setup run: npm ci diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f63a0e11..e432ff93 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,6 +6,7 @@ on: env: WP_MULTISITE: 0 + ACTION_VERSION: 2 jobs: release: @@ -25,18 +26,22 @@ jobs: with: node-version: 14.x + - name: Get NPM Cache Directory + id: npm-cache + if: ${{ !env.ACT }} + run: echo "::set-output name=dir::$(npm config get cache)" + - name: Cache Node Modules + if: ${{ !env.ACT }} uses: actions/cache@v2 env: npm-cache-name: cache-node-modules with: # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.npm-cache-name }}-${{ hashFiles('**/package-lock.json') }} + path: ${{ steps.npm-cache.outputs.dir }} + key: ${{ runner.os }}-build-${{ env.npm-cache-name }}-v${{ env.ACTION_VERSION }}-${{ hashFiles('**/package-lock.json') }} restore-keys: | - ${{ runner.os }}-build-${{ env.npm-cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- + ${{ runner.os }}-build-${{ env.npm-cache-name }}-v${{ env.ACTION_VERSION }}- - name: NPM Install run: npm ci diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index c584c461..10fb40d7 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -5,48 +5,53 @@ on: push: branches: - dev - - main - 'release/**' - 'feature/**' - 'fix/**' env: - PHP_VERSION: 7.4 - WP_MODE: 'single' + PHP_VERSION: '7.4' WP_MULTISITE: 0 - WP_VERSION: '5.7.*' + COMPOSER_VERSION: '2.2' + ACTION_VERSION: 2 jobs: - check: - name: Setup & Check + check_static_analysis: + name: Setup & Perform Static Analysis runs-on: ubuntu-latest steps: - name: Checkout Code + # https://github.com/marketplace/actions/checkout uses: actions/checkout@v2 - - name: Setup PHP Environment - uses: shivammathur/setup-php@v2 - # https://github.com/marketplace/actions/setup-php-action - with: - php-version: ${{ env.PHP_VERSION }} - tools: composer:v2 + - name: Get Composer Cache Directory + id: composer-cache + if: ${{ !env.ACT }} + run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Cache Composer dependencies - uses: actions/cache@v2 + if: ${{ !env.ACT }} + # https://github.com/marketplace/actions/cache + uses: actions/cache@v3 env: - composer-cache-name: cache-vendor + composer-cache-name: cache-composer with: - path: ~/vendor - key: ${{ runner.os }}-build-${{ env.composer-cache-name }}-${{ hashFiles('**/composer.lock') }} + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-build-${{ env.composer-cache-name }}-v${{ env.ACTION_VERSION }}-${{ hashFiles('**/composer.lock') }} restore-keys: | - ${{ runner.os }}-build-${{ env.composer-cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- + ${{ runner.os }}-build-${{ env.composer-cache-name }}-v${{ env.ACTION_VERSION }}- + + - name: Setup PHP & Composer Environment + # https://github.com/marketplace/actions/setup-php-action + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ env.PHP_VERSION }} + tools: "composer:${{ env.COMPOSER_VERSION }}" - - name: Require Specified WordPress Version - run: composer require johnpbloch/wordpress-core:${{ env.WP_VERSION }} --dev --prefer-source --update-with-all-dependencies + - name: Environment Check + run: php -v && composer --version - name: Install Composer Dependencies run: composer install diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml index 59c61950..2d0f2bef 100644 --- a/.github/workflows/unit-testing.yml +++ b/.github/workflows/unit-testing.yml @@ -1,114 +1,109 @@ -name: Unit Testing - on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: # Triggers the workflow on push events only for the matching branches push: branches: - - dev - - main - 'release/**' - - 'feature/**' - - 'fix/**' env: - PHP_MIN_VERSION: '7.2' - PHP_PREF_MIN_VERSION: '7.3' - PHP_STABLE_VERSION: '7.4' - WP_MIN_VERSION: '5.5.*' - WP_PREF_MIN_VERSION: '5.6.*' - WP_PREF_STABLE_VERSION: '5.7.*' - WP_STABLE_VERSION: '5.8.*' + COMPOSER_VERSION: '2.2' + ACTION_VERSION: 2 jobs: - test: + matrix_unit_testing: runs-on: ubuntu-latest continue-on-error: ${{ matrix.bleeding-edge }} strategy: fail-fast: false matrix: + job-name: ['Unit Test'] + php-version: ['7.4','8.0'] + wordpress-version: ['5.7.*','5.8.*','5.9.*'] + wp-multisite-mode: [0] + bleeding-edge: [false] include: - - job-name: 'Latest Stable Requirements' - bleeding-edge: false - php-version: '7.4' - wordpress-version: '5.8.*' - wp-multisite-mode: 0 - - job-name: 'Preferred Stable Requirements' - bleeding-edge: false - php-version: '7.4' - wordpress-version: '5.7.*' - wp-multisite-mode: 0 - - job-name: 'Preferred Minimum Requirements' - bleeding-edge: false - php-version: '7.3' - wordpress-version: '5.6.*' - wp-multisite-mode: 0 - - job-name: 'Minimum Requirements' - bleeding-edge: false - php-version: '7.2' - wordpress-version: '5.5.*' - wp-multisite-mode: 0 - - job-name: 'Bleeding Edge Requirements' + - job-name: 'Unit Test Bleeding Edge Requirements' bleeding-edge: true - php-version: '8.0' + php-version: '8.1' wordpress-version: 'dev-master' wp-multisite-mode: 0 - - job-name: 'Multisite Compatibility Requirements' + - job-name: 'Unit Test Multisite Compatibility Requirements' bleeding-edge: false - php-version: '7.4' - wordpress-version: '5.7.*' + php-version: '8.0' + wordpress-version: '5.9.*' wp-multisite-mode: 1 name: '${{ matrix.job-name }} (PHP:${{ matrix.php-version }}/WP:${{ matrix.wordpress-version }})' steps: - name: Checkout Code + # https://github.com/marketplace/actions/checkout uses: actions/checkout@v2 - - name: Setup PHP Environment - uses: shivammathur/setup-php@v2 - # https://github.com/marketplace/actions/setup-php-action + - name: Get Composer Cache Directory + id: composer-cache + if: ${{ !env.ACT }} + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache Composer dependencies + if: ${{ !env.ACT }} + uses: actions/cache@v2 + env: + composer-cache-name: cache-composer with: - php-version: ${{ matrix.php-version }} - tools: composer:v2 + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-build-${{ env.composer-cache-name }}-wp-${{ matrix.wordpress-version }}-v${{ env.ACTION_VERSION }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.composer-cache-name }}-wp-${{ matrix.wordpress-version }}-v${{ env.ACTION_VERSION }}- - name: Setup Node Environment - uses: actions/setup-node@v1 # https://github.com/marketplace/actions/setup-node-js-environment + uses: actions/setup-node@v2 with: - node-version: 14.x + node-version-file: '.nvmrc' + cache: ${{ !env.ACT && 'npm' || '' }} - - name: Cache Composer dependencies - uses: actions/cache@v2 - env: - composer-cache-name: cache-vendor + - name: Setup PHP & Composer Environment + # https://github.com/marketplace/actions/setup-php-action + uses: shivammathur/setup-php@v2 with: - path: ~/vendor - key: ${{ runner.os }}-build-${{ env.composer-cache-name }}-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.composer-cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- + php-version: "${{ matrix.php-version }}" + tools: "composer:${{ env.COMPOSER_VERSION }}" + + - name: Environment Check + run: php -v && composer --version + + - name: Require Specified WordPress Version (PHP <7.4) + if: matrix.php-version == '7.3' || matrix.php-version == '7.2' + run: composer require johnpbloch/wordpress-core:${{ matrix.wordpress-version }} php-stubs/wordpress-stubs:${{ matrix.wordpress-version }} wp-phpunit/wp-phpunit:${{ matrix.wordpress-version }} --dev --prefer-source --update-with-all-dependencies --ignore-platform-req=php + + - name: Require Specified WordPress Version (Bleeding Edge) + if: matrix.bleeding-edge + run: composer require johnpbloch/wordpress-core:${{ matrix.wordpress-version }} php-stubs/wordpress-stubs:${{ matrix.wordpress-version }} szepeviktor/phpstan-wordpress:* wp-phpunit/wp-phpunit:${{ matrix.wordpress-version }} --dev --prefer-source --update-with-all-dependencies - name: Require Specified WordPress Version - run: composer require johnpbloch/wordpress-core:${{ matrix.wordpress-version }} --dev --prefer-source --update-with-all-dependencies + if: matrix.php-version != '7.3' && matrix.php-version != '7.2' && ! matrix.bleeding-edge + run: composer require johnpbloch/wordpress-core:${{ matrix.wordpress-version }} php-stubs/wordpress-stubs:${{ matrix.wordpress-version }} wp-phpunit/wp-phpunit:${{ matrix.wordpress-version }} --dev --prefer-source --update-with-all-dependencies + + - name: PHPUnit Bleeding Edge Support + if: matrix.bleeding-edge + run: | + composer require sebastian/code-unit:dev-main phpunit/phpunit:dev-master phpro/grumphp:dev-master --dev -W --ignore-platform-req=php --update-with-all-dependencies - name: PHPUnit PHP 8.0 Support if: matrix.php-version == '8.0' run: | - composer require sebastian/code-unit:^2.0 --dev -W --ignore-platform-req=php - composer require phpunit/phpunit:dev-master --dev -W --ignore-platform-req=php - composer require phpro/grumphp:dev-master --dev -W --ignore-platform-req=php + composer require phpunit/phpunit:^8.0 phpro/grumphp:^1.10.0 --dev -W --ignore-platform-req=php - - name: Install Composer Dependencies (PHP 8.0) - if: matrix.php-version == '8.0' - run: composer install --ignore-platform-req=php + - name: Install Composer Dependencies (PHP 8.x) + if: matrix.php-version == '8.0' || matrix.php-version == '8.1' + run: composer install --prefer-dist --ignore-platform-req=php - name: Install Composer Dependencies - if: matrix.php-version != '8.0' - run: composer install + if: matrix.php-version != '8.0' && matrix.php-version != '8.1' + run: composer install --prefer-dist - name: NPM Setup run: npm ci diff --git a/.nvmrc b/.nvmrc index 518633e1..8351c193 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -lts/fermium +14 diff --git a/composer.json b/composer.json index ee117b57..4d771a34 100644 --- a/composer.json +++ b/composer.json @@ -45,22 +45,23 @@ "php": ">=7.1", "brain/monkey": "^2.4", "dealerdirect/phpcodesniffer-composer-installer": "~0.7", - "johnpbloch/wordpress-core": "~5.7.0", + "johnpbloch/wordpress-core": "~5.9.0", "johnpbloch/wordpress-core-installer": "^2.0", "mockery/mockery": "^1.3", - "php-stubs/wordpress-stubs": "~5.7.0", - "phpcompatibility/php-compatibility": "^9.0", + "php-stubs/wordpress-stubs": "~5.9.0", + "phpcompatibility/php-compatibility": "dev-develop as 9.5.3", "phpcompatibility/phpcompatibility-wp": "^2.1", - "phpmd/phpmd": "^2.6", + "phpcsstandards/phpcsutils": "1.x-dev as 1.0", "phpro/grumphp": "^1.5", "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.2", + "phpstan/phpstan": "^1.6", "phpstan/phpstan-deprecation-rules": "^1.0", "phpunit/phpunit": "^7", "roave/security-advisories": "dev-master", "squizlabs/php_codesniffer": "^3.6", - "szepeviktor/phpstan-wordpress": "^1.0", - "wp-coding-standards/wpcs": "^2.2" + "szepeviktor/phpstan-wordpress": "^1.1", + "wp-coding-standards/wpcs": "^2.2", + "wp-phpunit/wp-phpunit": "~5.9.0" }, "autoload-dev": { "classmap": [ diff --git a/composer.lock b/composer.lock index f302ed29..5a005ca9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6f6b3eef54e5168ef86d0567a7dbd10a", + "content-hash": "031a39595b510f6a91c54ab62d450d83", "packages": [ { "name": "composer/installers", @@ -820,143 +820,6 @@ }, "time": "2021-11-11T15:53:55+00:00" }, - { - "name": "composer/pcre", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/composer/pcre.git", - "reference": "3d322d715c43a1ac36c7fe215fa59336265500f2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/3d322d715c43a1ac36c7fe215fa59336265500f2", - "reference": "3d322d715c43a1ac36c7fe215fa59336265500f2", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpstan/phpstan": "^1", - "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^4.2 || ^5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Pcre\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "PCRE wrapping library that offers type-safe preg_* replacements.", - "keywords": [ - "PCRE", - "preg", - "regex", - "regular expression" - ], - "support": { - "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/1.0.0" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2021-12-06T15:17:27+00:00" - }, - { - "name": "composer/xdebug-handler", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/composer/xdebug-handler.git", - "reference": "0c1a3925ec58a4ec98e992b9c7d171e9e184be0a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/0c1a3925ec58a4ec98e992b9c7d171e9e184be0a", - "reference": "0c1a3925ec58a4ec98e992b9c7d171e9e184be0a", - "shasum": "" - }, - "require": { - "composer/pcre": "^1", - "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1 || ^2 || ^3" - }, - "require-dev": { - "phpstan/phpstan": "^1.0", - "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^4.2 || ^5.0 || ^6.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Composer\\XdebugHandler\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "John Stevenson", - "email": "john-stevenson@blueyonder.co.uk" - } - ], - "description": "Restarts a process without Xdebug.", - "keywords": [ - "Xdebug", - "performance" - ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/2.0.4" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2022-01-04T17:06:45+00:00" - }, { "name": "dealerdirect/phpcodesniffer-composer-installer", "version": "v0.7.1", @@ -1288,16 +1151,16 @@ }, { "name": "johnpbloch/wordpress-core", - "version": "5.7.6", + "version": "5.9.3", "source": { "type": "git", "url": "https://github.com/johnpbloch/wordpress-core.git", - "reference": "8238ab07c57090815de2500a43f05e7790e9a6a3" + "reference": "455d38c7b7bcdce3e0a1c6108eccca8de1860361" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/8238ab07c57090815de2500a43f05e7790e9a6a3", - "reference": "8238ab07c57090815de2500a43f05e7790e9a6a3", + "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/455d38c7b7bcdce3e0a1c6108eccca8de1860361", + "reference": "455d38c7b7bcdce3e0a1c6108eccca8de1860361", "shasum": "" }, "require": { @@ -1305,7 +1168,7 @@ "php": ">=5.6.20" }, "provide": { - "wordpress/core-implementation": "5.7.6" + "wordpress/core-implementation": "5.9.3" }, "type": "wordpress-core", "notification-url": "https://packagist.org/downloads/", @@ -1332,7 +1195,7 @@ "source": "https://core.trac.wordpress.org/browser", "wiki": "https://codex.wordpress.org/" }, - "time": "2022-03-11T00:51:28+00:00" + "time": "2022-04-05T19:23:48+00:00" }, { "name": "johnpbloch/wordpress-core-installer", @@ -1754,63 +1617,6 @@ }, "time": "2021-04-09T13:42:10+00:00" }, - { - "name": "pdepend/pdepend", - "version": "2.10.2", - "source": { - "type": "git", - "url": "https://github.com/pdepend/pdepend.git", - "reference": "c8c1d2af43fb8c2b5387d50e9c42a9c56de13686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/pdepend/pdepend/zipball/c8c1d2af43fb8c2b5387d50e9c42a9c56de13686", - "reference": "c8c1d2af43fb8c2b5387d50e9c42a9c56de13686", - "shasum": "" - }, - "require": { - "php": ">=5.3.7", - "symfony/config": "^2.3.0|^3|^4|^5", - "symfony/dependency-injection": "^2.3.0|^3|^4|^5", - "symfony/filesystem": "^2.3.0|^3|^4|^5" - }, - "require-dev": { - "easy-doc/easy-doc": "0.0.0|^1.2.3", - "gregwar/rst": "^1.0", - "phpunit/phpunit": "^4.8.36|^5.7.27", - "squizlabs/php_codesniffer": "^2.0.0" - }, - "bin": [ - "src/bin/pdepend" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "PDepend\\": "src/main/php/PDepend" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Official version of pdepend to be handled with Composer", - "support": { - "issues": "https://github.com/pdepend/pdepend/issues", - "source": "https://github.com/pdepend/pdepend/tree/2.10.2" - }, - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/pdepend/pdepend", - "type": "tidelift" - } - ], - "time": "2021-11-16T20:05:32+00:00" - }, { "name": "phar-io/manifest", "version": "1.0.3", @@ -1923,24 +1729,27 @@ }, { "name": "php-stubs/wordpress-stubs", - "version": "v5.7.4", + "version": "v5.9.3", "source": { "type": "git", "url": "https://github.com/php-stubs/wordpress-stubs.git", - "reference": "9d8e09f3c6e099f11b98551412f8bb4239a43f8e" + "reference": "18d56875e5078a50b8ea4bc4b20b735ca61edeee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/9d8e09f3c6e099f11b98551412f8bb4239a43f8e", - "reference": "9d8e09f3c6e099f11b98551412f8bb4239a43f8e", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/18d56875e5078a50b8ea4bc4b20b735ca61edeee", + "reference": "18d56875e5078a50b8ea4bc4b20b735ca61edeee", "shasum": "" }, "replace": { "giacocorsiglia/wordpress-stubs": "*" }, "require-dev": { - "giacocorsiglia/stubs-generator": "^0.5.0", - "php": "~7.1" + "nikic/php-parser": "< 4.12.0", + "php": "~7.3 || ~8.0", + "php-stubs/generator": "^0.8.1", + "phpdocumentor/reflection-docblock": "^5.3", + "phpstan/phpstan": "^1.2" }, "suggest": { "paragonie/sodium_compat": "Pure PHP implementation of libsodium", @@ -1961,39 +1770,52 @@ ], "support": { "issues": "https://github.com/php-stubs/wordpress-stubs/issues", - "source": "https://github.com/php-stubs/wordpress-stubs/tree/v5.7.4" + "source": "https://github.com/php-stubs/wordpress-stubs/tree/v5.9.3" }, - "time": "2021-11-11T13:56:27+00:00" + "time": "2022-04-06T15:33:59+00:00" }, { "name": "phpcompatibility/php-compatibility", - "version": "9.3.5", + "version": "dev-develop", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", - "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" + "reference": "c23e20c0aaa5c527fd7b3fbef38c50c458bb47f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", - "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/c23e20c0aaa5c527fd7b3fbef38c50c458bb47f1", + "reference": "c23e20c0aaa5c527fd7b3fbef38c50c458bb47f1", "shasum": "" }, "require": { - "php": ">=5.3", - "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" + "php": ">=5.4", + "phpcsstandards/phpcsutils": "^1.0", + "squizlabs/php_codesniffer": "^2.6 || ^3.1.0" }, "conflict": { "squizlabs/php_codesniffer": "2.6.2" }, + "replace": { + "wimg/php-compatibility": "*" + }, "require-dev": { - "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" + "php-parallel-lint/php-console-highlighter": "^0.5", + "php-parallel-lint/php-parallel-lint": "^1.2.0", + "phpcsstandards/phpcsdevtools": "^1.0", + "phpunit/phpunit": "^4.8 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || >=9.0 <9.3.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." }, + "default-branch": true, "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-master": "9.x-dev", + "dev-develop": "10.x-dev" + } + }, "notification-url": "https://packagist.org/downloads/", "license": [ "LGPL-3.0-or-later" @@ -2025,7 +1847,7 @@ "issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues", "source": "https://github.com/PHPCompatibility/PHPCompatibility" }, - "time": "2019-12-27T09:44:58+00:00" + "time": "2022-04-14T19:54:29+00:00" }, { "name": "phpcompatibility/phpcompatibility-paragonie", @@ -2137,6 +1959,83 @@ }, "time": "2021-12-30T16:37:40+00:00" }, + { + "name": "phpcsstandards/phpcsutils", + "version": "dev-develop", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", + "reference": "b65fbd47c38202a667ea3930a4a51c5c8b9ca434" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/b65fbd47c38202a667ea3930a4a51c5c8b9ca434", + "reference": "b65fbd47c38202a667ea3930a4a51c5c8b9ca434", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^2.6.0 || ^3.1.0 || 4.0.x-dev@dev" + }, + "conflict": { + "squizlabs/php_codesniffer": "3.5.3" + }, + "require-dev": { + "ext-filter": "*", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0", + "yoast/phpunit-polyfills": "^1.0.1" + }, + "default-branch": true, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHPCSUtils/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSUtils/graphs/contributors" + } + ], + "description": "A suite of utility functions for use with PHP_CodeSniffer", + "homepage": "https://phpcsutils.com/", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "phpcs2", + "phpcs3", + "standards", + "tokens", + "utility" + ], + "support": { + "docs": "https://phpcsutils.com/", + "issues": "https://github.com/PHPCSStandards/PHPCSUtils/issues", + "source": "https://github.com/PHPCSStandards/PHPCSUtils" + }, + "time": "2022-06-30T21:20:54+00:00" + }, { "name": "phpdocumentor/reflection-common", "version": "2.2.0", @@ -2297,89 +2196,6 @@ }, "time": "2022-01-04T19:58:01+00:00" }, - { - "name": "phpmd/phpmd", - "version": "2.11.1", - "source": { - "type": "git", - "url": "https://github.com/phpmd/phpmd.git", - "reference": "08b60a2eb7e14c23f46ff8865b510ae08b75d0fd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpmd/phpmd/zipball/08b60a2eb7e14c23f46ff8865b510ae08b75d0fd", - "reference": "08b60a2eb7e14c23f46ff8865b510ae08b75d0fd", - "shasum": "" - }, - "require": { - "composer/xdebug-handler": "^1.0 || ^2.0", - "ext-xml": "*", - "pdepend/pdepend": "^2.10.2", - "php": ">=5.3.9" - }, - "require-dev": { - "easy-doc/easy-doc": "0.0.0 || ^1.3.2", - "ext-json": "*", - "ext-simplexml": "*", - "gregwar/rst": "^1.0", - "mikey179/vfsstream": "^1.6.8", - "phpunit/phpunit": "^4.8.36 || ^5.7.27", - "squizlabs/php_codesniffer": "^2.0" - }, - "bin": [ - "src/bin/phpmd" - ], - "type": "library", - "autoload": { - "psr-0": { - "PHPMD\\": "src/main/php" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Manuel Pichler", - "email": "github@manuel-pichler.de", - "homepage": "https://github.com/manuelpichler", - "role": "Project Founder" - }, - { - "name": "Marc Würth", - "email": "ravage@bluewin.ch", - "homepage": "https://github.com/ravage84", - "role": "Project Maintainer" - }, - { - "name": "Other contributors", - "homepage": "https://github.com/phpmd/phpmd/graphs/contributors", - "role": "Contributors" - } - ], - "description": "PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.", - "homepage": "https://phpmd.org/", - "keywords": [ - "mess detection", - "mess detector", - "pdepend", - "phpmd", - "pmd" - ], - "support": { - "irc": "irc://irc.freenode.org/phpmd", - "issues": "https://github.com/phpmd/phpmd/issues", - "source": "https://github.com/phpmd/phpmd/tree/2.11.1" - }, - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/phpmd/phpmd", - "type": "tidelift" - } - ], - "time": "2021-12-17T11:25:43+00:00" - }, { "name": "phpro/grumphp", "version": "v1.5.0", @@ -2609,20 +2425,20 @@ }, { "name": "phpstan/phpstan", - "version": "1.4.0", + "version": "1.8.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "72b04d97b5e6e60a081f17c416fef35bd521120b" + "reference": "c53312ecc575caf07b0e90dee43883fdf90ca67c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/72b04d97b5e6e60a081f17c416fef35bd521120b", - "reference": "72b04d97b5e6e60a081f17c416fef35bd521120b", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c53312ecc575caf07b0e90dee43883fdf90ca67c", + "reference": "c53312ecc575caf07b0e90dee43883fdf90ca67c", "shasum": "" }, "require": { - "php": "^7.1|^8.0" + "php": "^7.2|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -2632,11 +2448,6 @@ "phpstan.phar" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, "autoload": { "files": [ "bootstrap.php" @@ -2649,7 +2460,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.4.0" + "source": "https://github.com/phpstan/phpstan/tree/1.8.2" }, "funding": [ { @@ -2669,7 +2480,7 @@ "type": "tidelift" } ], - "time": "2022-01-14T15:58:47+00:00" + "time": "2022-07-20T09:57:31+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -6190,30 +6001,30 @@ }, { "name": "szepeviktor/phpstan-wordpress", - "version": "v1.0.2", + "version": "v1.1.2", "source": { "type": "git", "url": "https://github.com/szepeviktor/phpstan-wordpress.git", - "reference": "d44b5abcaa529698e138b2d21bc2a7cf9834039c" + "reference": "e487dc725845ac914681e148d0e8ac479ad887ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/d44b5abcaa529698e138b2d21bc2a7cf9834039c", - "reference": "d44b5abcaa529698e138b2d21bc2a7cf9834039c", + "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/e487dc725845ac914681e148d0e8ac479ad887ec", + "reference": "e487dc725845ac914681e148d0e8ac479ad887ec", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0", - "php-stubs/wordpress-stubs": "^4.7 || ^5.0", - "phpstan/phpstan": "^1.0", + "php": "^7.2 || ^8.0", + "php-stubs/wordpress-stubs": "^4.7 || ^5.0 || ^6.0", + "phpstan/phpstan": "^1.6", "symfony/polyfill-php73": "^1.12.0" }, "require-dev": { - "composer/composer": "^1.10.23", + "composer/composer": "^2.1.14", "dealerdirect/phpcodesniffer-composer-installer": "^0.7", "php-parallel-lint/php-parallel-lint": "^1.1", - "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^7 || ^9", + "phpstan/phpstan-strict-rules": "^1.2", + "phpunit/phpunit": "^8 || ^9", "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^0.6" }, "type": "phpstan-extension", @@ -6243,7 +6054,7 @@ ], "support": { "issues": "https://github.com/szepeviktor/phpstan-wordpress/issues", - "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v1.0.2" + "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v1.1.2" }, "funding": [ { @@ -6251,7 +6062,7 @@ "type": "custom" } ], - "time": "2021-11-19T12:47:11+00:00" + "time": "2022-06-21T10:51:00+00:00" }, { "name": "theseer/tokenizer", @@ -6411,11 +6222,74 @@ "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki" }, "time": "2020-05-13T23:57:56+00:00" + }, + { + "name": "wp-phpunit/wp-phpunit", + "version": "5.9.3", + "source": { + "type": "git", + "url": "https://github.com/wp-phpunit/wp-phpunit.git", + "reference": "ceece1ed4f2d0732c4a4f2603f4376d85547a50f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-phpunit/wp-phpunit/zipball/ceece1ed4f2d0732c4a4f2603f4376d85547a50f", + "reference": "ceece1ed4f2d0732c4a4f2603f4376d85547a50f", + "shasum": "" + }, + "type": "library", + "autoload": { + "files": [ + "__loaded.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Evan Mattson", + "email": "me@aaemnnost.tv" + }, + { + "name": "WordPress Community", + "homepage": "https://wordpress.org/about/" + } + ], + "description": "WordPress core PHPUnit library", + "homepage": "https://github.com/wp-phpunit", + "keywords": [ + "phpunit", + "test", + "wordpress" + ], + "support": { + "docs": "https://github.com/wp-phpunit/docs", + "issues": "https://github.com/wp-phpunit/issues", + "source": "https://github.com/wp-phpunit/wp-phpunit" + }, + "time": "2022-02-22T20:53:17+00:00" + } + ], + "aliases": [ + { + "package": "phpcompatibility/php-compatibility", + "version": "dev-develop", + "alias": "9.5.3", + "alias_normalized": "9.5.3.0" + }, + { + "package": "phpcsstandards/phpcsutils", + "version": "1.9999999.9999999.9999999-dev", + "alias": "1.0", + "alias_normalized": "1.0.0.0" } ], - "aliases": [], "minimum-stability": "stable", "stability-flags": { + "phpcompatibility/php-compatibility": 20, + "phpcsstandards/phpcsutils": 20, "roave/security-advisories": 20 }, "prefer-stable": false, diff --git a/openid-connect-generic.php b/openid-connect-generic.php index 1ffead2a..19ce9700 100644 --- a/openid-connect-generic.php +++ b/openid-connect-generic.php @@ -194,8 +194,8 @@ public function init() { */ public function enforce_privacy_redirect() { if ( $this->settings->enforce_privacy && ! is_user_logged_in() ) { - // The client endpoint relies on the wp admind ajax endpoint. - if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || ! isset( $_GET['action'] ) || 'openid-connect-authorize' != $_GET['action'] ) { + // The client endpoint relies on the wp-admin ajax endpoint. + if ( ! defined( 'DOING_AJAX' ) || ! constant( 'DOING_AJAX' ) || ! isset( $_GET['action'] ) || 'openid-connect-authorize' != $_GET['action'] ) { auth_redirect(); } } diff --git a/phpstan.neon.dist b/phpstan.neon.dist index f3a1d6d9..04f6035a 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -11,6 +11,7 @@ parameters: inferPrivatePropertyTypeFromConstructor: true bootstrapFiles: - tests/phpstan-bootstrap.php + - %rootDir%/../../php-stubs/wordpress-stubs/wordpress-stubs.php # autoload_files: # Missing constants, function and class stubs # - tests/phpstan/bootstrap.php @@ -24,19 +25,22 @@ parameters: - includes/ - ./ excludePaths: - - node_modules/ - - scripts/ - - tests/ - - tools/ - - vendor/ - - wordpress/ + analyse: + - node_modules/ + - scripts/ + - tests/ + - tools/ + - vendor/ + - wordpress/ + analyseAndScan: + - wordpress/wp-content/uploads/ # scanFiles: - # - includes/class.php - scanDirectories: - - wordpress + # - includes/class.php + # scanDirectories: + # - wordpress ignoreErrors: # Uses func_get_args() - - '#^Function apply_filters(_ref_array)? invoked with [34567] parameters, 2 required\.$#' + # - '#^Function apply_filters(_ref_array)? invoked with [34567] parameters, 2 required\.$#' # Fixed in WordPress 5.3 # - '#^Function do_action(_ref_array)? invoked with [3456] parameters, 1-2 required\.$#' # - '#^Function current_user_can invoked with 2 parameters, 1 required\.$#'