Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.1 / 8.2 Compatibility #7225

Merged
merged 37 commits into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d11fc69
Run tests against PHP 8.1
swissspidy Aug 25, 2022
7902c3a
Run tests against PHP 8.2
swissspidy Aug 25, 2022
91c050b
Change php file to trigger CI
swissspidy Aug 25, 2022
2443a05
Update PHPUnit depending on matrix
swissspidy Aug 25, 2022
3f37f08
Fix setup/teardown method names in `BlockUniqidTransformerTest`
swissspidy Aug 25, 2022
d2c4c95
Add `ReturnTypeWillChange` attribute in `ElementList`
swissspidy Aug 25, 2022
e09f922
Remove conflicting Requests library
swissspidy Aug 25, 2022
924be54
Remove float key test case in `EventTest`
swissspidy Aug 25, 2022
3a98e8f
ignore platform reqs
swissspidy Aug 25, 2022
3c0badc
Add `file_exists` check
swissspidy Aug 25, 2022
0ee41fd
Don’t convert to exceptions for now
swissspidy Aug 25, 2022
ab075f9
Install PHPUnit 7.x on PHP 7.1
swissspidy Aug 25, 2022
db8f0f7
Fix string interpolation in `CachedRemoteGetRequestTest`
swissspidy Aug 25, 2022
cf6c769
Avoid passing `null` to `parse_str`
swissspidy Aug 25, 2022
01ab3e9
Add `ReturnTypeWillChange` attribute in `AMP_Validation_Callback_Wrap…
swissspidy Aug 25, 2022
e21f5a4
Do not install `pcov/clobber` for PHPUnit 8
swissspidy Aug 25, 2022
84c83ce
Avoid passing `null` to `parse_str`, take 2
swissspidy Aug 25, 2022
0e0d64c
Add missing attribute
swissspidy Aug 25, 2022
e42e2b3
Fix another string interpolation issue
swissspidy Aug 25, 2022
2517d89
Update amp-toolbox-php to 0.11.3-alpha
westonruter Sep 20, 2022
35e0ea4
Merge remote-tracking branch 'origin/develop' into try-php81-php82
westonruter Sep 20, 2022
97440f4
Remove temp change
swissspidy Sep 20, 2022
91460a4
Add return type instead of attribute
swissspidy Sep 22, 2022
c5f32cd
Use xdebug instead of pcov
swissspidy Sep 22, 2022
5773928
Update `testVersion` in PHPCS config since the plugin requires 7.0+
swissspidy Sep 22, 2022
bd2ee42
Address unrelated PHPCS warnings
swissspidy Sep 22, 2022
2ed5103
Make actual use of `$_tests_dir` in test bootstrap
swissspidy Sep 22, 2022
0093af3
Merge branch 'develop' into try-php81-php82
swissspidy Sep 30, 2022
5afdbb3
Merge branch 'develop' into try-php81-php82
swissspidy Oct 25, 2022
7ce100c
Try running coverage on PHP 8.0
swissspidy Oct 25, 2022
c0077b1
Fix `test_handle_single_url_page_bulk_and_inline_actions` test
swissspidy Oct 25, 2022
29849b9
Fix `test_prepare_response_throwing_error` on trunk
swissspidy Oct 25, 2022
d00f532
Fix automatic conversion of false to array
swissspidy Oct 25, 2022
b29258d
Fix `test_prepare_response_throwing_exception`
swissspidy Oct 25, 2022
dd4524c
Merge branch 'develop' into try-php81-php82
swissspidy Oct 26, 2022
b81b485
Apply suggestions from code review
swissspidy Oct 26, 2022
2473fe6
Merge branch 'develop' into try-php81-php82
westonruter Oct 27, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 48 additions & 11 deletions .github/workflows/build-test-measure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,24 @@ jobs:
wp: 'trunk'
experimental: true

- php: '8.1'
wp: 'trunk'
experimental: true

- php: '8.2'
wp: 'trunk'
experimental: true

- php: '8.0'
wp: 'latest'
coverage: true

- php: '8.0'
wp: 'latest'
external-http: true

# PHP 8.0 cannot be used as yet due to the earliest compatible PHPUnit (v9) being unable to run due to the
# WP test suite enforcing PHPUnit 7 or earlier.
- php: '7.4'
wp: 'latest'
coverage: true

- php: '7.4'
wp: 'latest'
Expand Down Expand Up @@ -425,8 +434,7 @@ jobs:
with:
php-version: ${{ matrix.php }}
extensions: curl, date, dom, gd, iconv, json, libxml, mysql, spl
coverage: ${{ matrix.coverage && 'pcov' || 'none' }}
ini-values: pcov.directory=.
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we continue using pcov for coverage in the CI? I've looked at the problem that it uses xdebug in any case, but I can debug it in another PR. Thoughts?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll defer to Weston, but if it works and is faster, sure.

But since this never really worked in the first place, definitely warrants its own issue/PR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PCOV is faster but lacks path coverage. A difference in reporting can be seen here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PCOV was introduced in #5201

I just pinged you both the thread where this was discussed.


- name: Shutdown default MySQL service
if: needs.pre-run.outputs.changed-php-count > 0
Expand Down Expand Up @@ -467,6 +475,41 @@ jobs:
composer remove --dev phpdocumentor/reflection
composer install --prefer-dist --ignore-platform-reqs --no-progress --no-interaction

# See https://github.com/wp-cli/wp-cli/issues/5484
- name: Remove conflicting Requests library
if: needs.pre-run.outputs.changed-php-count > 0
run: composer remove --dev --ignore-platform-reqs --no-interaction --no-scripts roave/security-advisories wp-cli/export-command wp-cli/extension-command wp-cli/wp-cli wp-cli/wp-cli-tests

# Installs a different PHPUnit version depending on the WP/PHP version combo we're testing against.
#
# | WP / PHP | PHPUnit |
# |-----------|---------|
# | 5.0 / 7.0 | 6 |
# | 5.7 / 7.1 | 7 |
# | 5.9 / 7.2 | 8 |
# | 5.9 / 7.4 | 9 |
# | * / 8 | 9 |
#
# See https://make.wordpress.org/core/handbook/references/phpunit-compatibility-and-wordpress-versions/
- name: Update PHPUnit
if: needs.pre-run.outputs.changed-php-count > 0
run: |
if [[ $PHP_VERSION == "7.1" ]]; then
echo "Installing PHPUnit 7.5.x"
composer require --ignore-platform-reqs --no-interaction --no-scripts phpunit/phpunit:^7.5 --with-dependencies
elif [[ $PHP_VERSION == "7.2" ]]; then
echo "Installing PHPUnit 8.5.x"
composer require --ignore-platform-reqs --no-interaction --no-scripts phpunit/phpunit:^8.5 --with-dependencies
echo "Downgrading phpunit/php-token-stream because the latest version requires PHP 7.3"
composer require --ignore-platform-reqs --no-interaction --no-scripts phpunit/php-token-stream:^3.1.3 --with-dependencies
elif [[ $WP_VERSION == "latest" || $WP_VERSION == "trunk" || $PHP_VERSION == "7.4" ]]; then
echo "Installing latest version of PHPUnit"
composer update --ignore-platform-reqs --no-interaction --no-scripts yoast/phpunit-polyfills --with-dependencies
fi
env:
WP_VERSION: ${{ matrix.wp }}
PHP_VERSION: ${{ matrix.php }}

- name: Install Node dependencies
if: needs.pre-run.outputs.changed-php-count > 0
run: npm ci
Expand All @@ -491,12 +534,6 @@ jobs:
if: needs.pre-run.outputs.changed-php-count > 0
run: bash bin/ci/after-wp-install.sh ${{ matrix.wp }} ${{ matrix.install-pwa-plugin == true }}

- name: Setup PCOV
if: ${{ matrix.coverage == true && needs.pre-run.outputs.changed-php-count > 0 }}
run: |
composer require --dev --ignore-platform-reqs pcov/clobber
vendor/bin/pcov clobber

swissspidy marked this conversation as resolved.
Show resolved Hide resolved
- name: Copy plugin to WP plugins directory
if: needs.pre-run.outputs.changed-php-count > 0
run: cp -r "$PWD" "$WP_CORE_DIR/src/wp-content/plugins/amp"
Expand Down
2 changes: 1 addition & 1 deletion .phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
</rule>

<!-- Include sniffs for PHP cross-version compatibility. -->
<config name="testVersion" value="5.6-"/>
<config name="testVersion" value="7.0-"/>
swissspidy marked this conversation as resolved.
Show resolved Hide resolved
<rule ref="PHPCompatibilityWP">
<exclude-pattern>bin/*</exclude-pattern>
<exclude-pattern>tests/php/src/PhpStan/*</exclude-pattern>
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"ext-json": "*",
"ext-libxml": "*",
"ext-spl": "*",
"ampproject/amp-toolbox": "0.11.2",
"ampproject/amp-toolbox": "dev-main",
swissspidy marked this conversation as resolved.
Show resolved Hide resolved
"cweagans/composer-patches": "~1.0",
"fasterimage/fasterimage": "1.5.0",
"sabberworm/php-css-parser": "8.4.0"
Expand Down
Loading