diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index e40393ded3..e236f444b3 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -23,34 +23,25 @@ jobs: WP_VERSION: ${{ matrix.wp }} strategy: - # PHP 7.2 uses PHPUnit 8.5.21 - # PHP 7.3 uses PHPUnit 9.5.10 - # PHP 7.4 uses PHPUnit 9.5.10 - # PHP 8.0 uses PHPUnit 9.5.10 - # PHP 8.1 uses PHPUnit 9.5.10 - # PHP 8.2 uses PHPUnit 9.5.10 + # Note: Different PHP versions use different PHPUnit versions. # Keys: # - coverage: Whether to run the tests with code coverage. # - experimental: Whether the build is "allowed to fail". matrix: - php: [ '7.2', '7.3', '7.4', '8.0'] + php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.3'] wp: ['latest'] coverage: [none] experimental: [false] include: - - php: '8.1' - coverage: pcov + - php: '8.2' + coverage: pcov # Warning: PCOV might not work for PHP 8.4 or newer according to https://thephp.cc/articles/pcov-or-xdebug. extensions: pcov ini-values: pcov.directory=., "pcov.exclude=\"~(vendor|tests)~\"" experimental: false - - php: '8.2' - wp: 'trunk' - coverage: none - experimental: false - - php: '8.3' + - php: '8.4' wp: 'trunk' coverage: none - experimental: false + experimental: true fail-fast: false continue-on-error: ${{ matrix.experimental }} steps: @@ -91,18 +82,18 @@ jobs: - name: Prepare environment for integration tests run: composer prepare-ci --no-interaction - - name: Run integration tests (single site) - if: ${{ matrix.php != 8.0 && ! matrix.experimental }} + - name: Run integration tests + if: ${{ !matrix.experimental && matrix.coverage == 'none' }} run: composer testwp --no-interaction - - name: Run integration tests experimental + - name: Run integration tests (multisite) + if: ${{ !matrix.experimental && matrix.coverage == 'none' }} + run: composer testwp-ms --no-interaction + + - name: Run integration tests (experimental) if: ${{ matrix.experimental }} run: composer testwp-experimental --no-interaction - - name: Run integration tests (multi site) - if: ${{ matrix.php != 8.0 && ! matrix.experimental }} - run: composer testwp-ms --no-interaction - - - name: Run integration tests (multisite site with code coverage) - if: ${{ matrix.php == 8.1 }} + - name: Run integration tests (multisite with code coverage) + if: ${{ matrix.coverage == 'pcov' }} run: composer coveragewp-ci --no-interaction diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index e5b8b79f3c..840881a882 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -25,25 +25,24 @@ jobs: WP_VERSION: latest strategy: - # PHP 7.2 uses PHPUnit 8.5.21 - # PHP 7.3 uses PHPUnit 9.5.10 - # PHP 7.4 uses PHPUnit 9.5.10 - # PHP 8.0 uses PHPUnit 9.5.10 - # PHP 8.1 uses PHPUnit 9.5.10 + # Note: Different PHP versions use different PHPUnit versions. # Keys: # - coverage: Whether to run the tests with code coverage. # - experimental: Whether the build is "allowed to fail". matrix: - php: ['7.2', '7.3', '7.4', '8.0', '8.2', '8.3'] + php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.3'] coverage: [none] experimental: [false] include: # Run code coverage for only one PHP version - - php: '8.1' - coverage: pcov + - php: '8.2' + coverage: pcov # Warning: PCOV might not work for PHP 8.4 or newer according to https://thephp.cc/articles/pcov-or-xdebug. extensions: pcov ini-values: pcov.directory=., "pcov.exclude=\"~(vendor|tests)~\"" experimental: false + - php: '8.4' + coverage: none + experimental: true fail-fast: false continue-on-error: ${{ matrix.experimental }} steps: diff --git a/phpunit-experimental.xml.dist b/phpunit-experimental.xml.dist index 34eddfed83..c5503d831e 100644 --- a/phpunit-experimental.xml.dist +++ b/phpunit-experimental.xml.dist @@ -16,6 +16,7 @@ + diff --git a/src/class-parsely.php b/src/class-parsely.php index b85468421c..f3eecee647 100644 --- a/src/class-parsely.php +++ b/src/class-parsely.php @@ -654,7 +654,7 @@ public function set_default_content_helper_settings_values(): void { * for context (Default null for current). * @return string */ - public static function get_settings_url( int $_blog_id = null ): string { + public static function get_settings_url( ?int $_blog_id = null ): string { return get_admin_url( $_blog_id, 'options-general.php?page=' . self::MENU_SLUG ); } diff --git a/src/rest-api/content-helper/trait-content-helper-feature.php b/src/rest-api/content-helper/trait-content-helper-feature.php index 383e7c2ce4..ab028ce885 100644 --- a/src/rest-api/content-helper/trait-content-helper-feature.php +++ b/src/rest-api/content-helper/trait-content-helper-feature.php @@ -56,7 +56,7 @@ protected function is_pch_feature_enabled_for_user(): bool { * @param WP_REST_Request|null $request The request object. * @return bool|WP_Error True if the endpoint is available. */ - public function is_available_to_current_user( WP_REST_Request $request = null ) { + public function is_available_to_current_user( ?WP_REST_Request $request = null ) { $can_use_feature = $this->is_pch_feature_enabled_for_user(); if ( ! $can_use_feature ) { diff --git a/src/services/content-api/class-content-api-service.php b/src/services/content-api/class-content-api-service.php index 83ceeb825c..7ca866c4fd 100644 --- a/src/services/content-api/class-content-api-service.php +++ b/src/services/content-api/class-content-api-service.php @@ -87,8 +87,8 @@ protected function register_endpoints(): void { */ public function get_post_details( string $url, - string $period_start = null, - string $period_end = null + ?string $period_start = null, + ?string $period_end = null ) { /** @var Endpoints\Endpoint_Analytics_Post_Details $endpoint */ $endpoint = $this->get_endpoint( '/analytics/post/detail' ); @@ -116,8 +116,8 @@ public function get_post_details( */ public function get_post_referrers( string $url, - string $period_start = null, - string $period_end = null + ?string $period_start = null, + ?string $period_end = null ) { /** @var Endpoints\Endpoint_Referrers_Post_Detail $endpoint */ $endpoint = $this->get_endpoint( '/referrers/post/detail' );