From 490536e291ada511cb8b426b247df7a6f1d43d5c Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 18 Oct 2024 13:32:21 +0200 Subject: [PATCH 1/7] Update `ampproject/amp-toolbox` --- composer.json | 2 +- composer.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 45d33c66619..0aab81ddb75 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "ext-json": "*", "ext-libxml": "*", "ext-spl": "*", - "ampproject/amp-toolbox": "0.11.5", + "ampproject/amp-toolbox": "0.11.6", "cweagans/composer-patches": "^1.0", "fasterimage/fasterimage": "1.5.0", "sabberworm/php-css-parser": "8.5.1" diff --git a/composer.lock b/composer.lock index 68e45fd5dbf..4e7a2e69426 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c672b16c6c4a23f305014e966245c095", + "content-hash": "d1bc9359ff0023f06fd3e4dfbc5c1eb6", "packages": [ { "name": "ampproject/amp-toolbox", - "version": "0.11.5", + "version": "0.11.6", "source": { "type": "git", "url": "https://github.com/ampproject/amp-toolbox-php.git", - "reference": "78531851c59fa5f306315372719f0064b5542cf4" + "reference": "72674f17e012ec880efc2e255997dce8fd44ca4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ampproject/amp-toolbox-php/zipball/78531851c59fa5f306315372719f0064b5542cf4", - "reference": "78531851c59fa5f306315372719f0064b5542cf4", + "url": "https://api.github.com/repos/ampproject/amp-toolbox-php/zipball/72674f17e012ec880efc2e255997dce8fd44ca4e", + "reference": "72674f17e012ec880efc2e255997dce8fd44ca4e", "shasum": "" }, "require": { @@ -26,7 +26,7 @@ "ext-iconv": "*", "ext-json": "*", "ext-libxml": "*", - "php": "^5.6 || ^7.0 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { "civicrm/composer-downloads-plugin": "^2.1 || ^3.0", @@ -76,9 +76,9 @@ "description": "A collection of AMP tools making it easier to publish and host AMP pages with PHP.", "support": { "issues": "https://github.com/ampproject/amp-toolbox-php/issues", - "source": "https://github.com/ampproject/amp-toolbox-php/tree/0.11.5" + "source": "https://github.com/ampproject/amp-toolbox-php/tree/0.11.6" }, - "time": "2024-02-05T19:10:57+00:00" + "time": "2024-10-17T15:07:03+00:00" }, { "name": "cweagans/composer-patches", @@ -8525,7 +8525,7 @@ "ext-libxml": "*", "ext-spl": "*" }, - "platform-dev": [], + "platform-dev": {}, "platform-overrides": { "php": "7.4" }, From 32f4f287eae97b345e267a2e477ecb6b811c0b63 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 18 Oct 2024 13:33:20 +0200 Subject: [PATCH 2/7] Run tests against PHP 8.4 --- .github/workflows/build-test-measure.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/build-test-measure.yml b/.github/workflows/build-test-measure.yml index facc17fcb1e..a2a9c4f859f 100644 --- a/.github/workflows/build-test-measure.yml +++ b/.github/workflows/build-test-measure.yml @@ -289,6 +289,11 @@ jobs: install-pwa-plugin: [true] coverage: [false] include: + - php: '8.4' + wp: 'trunk' + phpunit: '9.6' + experimental: true + - php: '8.3' wp: 'trunk' phpunit: '9.6' @@ -492,6 +497,10 @@ jobs: php: ['7.4'] wp: ['latest'] include: + - php: '8.4' + wp: 'trunk' + experimental: true + - php: '8.3' wp: 'trunk' experimental: true From 34dc99cfb81e5d54c114be3e8a4ec4af6c64369b Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 18 Oct 2024 13:47:42 +0200 Subject: [PATCH 3/7] Account for auto sizes added in WP 6.7 --- tests/php/test-amp-gallery-embed-handler.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/php/test-amp-gallery-embed-handler.php b/tests/php/test-amp-gallery-embed-handler.php index 3c0a4fed002..2427a598844 100644 --- a/tests/php/test-amp-gallery-embed-handler.php +++ b/tests/php/test-amp-gallery-embed-handler.php @@ -287,6 +287,11 @@ public function test__conversion( $source, $expected, $use_legacy_mode = false ) // Remove decoding attribute. $content = preg_replace( '/\s+decoding="async"/', '', $content ); + // Auto sizes was added in WordPress 6.7 + if ( version_compare( strtok( get_bloginfo( 'version' ), '-' ), '6.7', '>=' ) ) { + $expected = str_replace( ' sizes="', ' sizes="auto, ', $expected ); + } + $this->assertEquals( $this->normalize( $expected ), $this->normalize( $content ) From 41b18ca6460d963292f6a5356807aa24435488a4 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 18 Oct 2024 13:49:26 +0200 Subject: [PATCH 4/7] Update Mockery & co --- composer.lock | 98 +++++++++++++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 50 deletions(-) diff --git a/composer.lock b/composer.lock index 4e7a2e69426..ede3dbe09d7 100644 --- a/composer.lock +++ b/composer.lock @@ -307,20 +307,20 @@ "packages-dev": [ { "name": "antecedent/patchwork", - "version": "2.1.26", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/antecedent/patchwork.git", - "reference": "f2dae0851b2eae4c51969af740fdd0356d7f8f55" + "reference": "b07d4fb37c3c723c8755122160c089e077d5de65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/antecedent/patchwork/zipball/f2dae0851b2eae4c51969af740fdd0356d7f8f55", - "reference": "f2dae0851b2eae4c51969af740fdd0356d7f8f55", + "url": "https://api.github.com/repos/antecedent/patchwork/zipball/b07d4fb37c3c723c8755122160c089e077d5de65", + "reference": "b07d4fb37c3c723c8755122160c089e077d5de65", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": ">=7.1.0" }, "require-dev": { "phpunit/phpunit": ">=4" @@ -337,7 +337,7 @@ } ], "description": "Method redefinition (monkey-patching) functionality for PHP.", - "homepage": "http://patchwork2.org/", + "homepage": "https://antecedent.github.io/patchwork/", "keywords": [ "aop", "aspect", @@ -349,9 +349,9 @@ ], "support": { "issues": "https://github.com/antecedent/patchwork/issues", - "source": "https://github.com/antecedent/patchwork/tree/2.1.26" + "source": "https://github.com/antecedent/patchwork/tree/2.2.0" }, - "time": "2023-09-18T08:18:37+00:00" + "time": "2024-09-27T16:59:55+00:00" }, { "name": "automattic/vipwpcs", @@ -2015,16 +2015,16 @@ }, { "name": "mockery/mockery", - "version": "1.6.6", + "version": "1.6.12", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "b8e0bb7d8c604046539c1115994632c74dcb361e" + "reference": "1f4efdd7d3beafe9807b08156dfcb176d18f1699" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/b8e0bb7d8c604046539c1115994632c74dcb361e", - "reference": "b8e0bb7d8c604046539c1115994632c74dcb361e", + "url": "https://api.github.com/repos/mockery/mockery/zipball/1f4efdd7d3beafe9807b08156dfcb176d18f1699", + "reference": "1f4efdd7d3beafe9807b08156dfcb176d18f1699", "shasum": "" }, "require": { @@ -2036,10 +2036,8 @@ "phpunit/phpunit": "<8.0" }, "require-dev": { - "phpunit/phpunit": "^8.5 || ^9.6.10", - "psalm/plugin-phpunit": "^0.18.4", - "symplify/easy-coding-standard": "^11.5.0", - "vimeo/psalm": "^4.30" + "phpunit/phpunit": "^8.5 || ^9.6.17", + "symplify/easy-coding-standard": "^12.1.14" }, "type": "library", "autoload": { @@ -2096,7 +2094,7 @@ "security": "https://github.com/mockery/mockery/security/advisories", "source": "https://github.com/mockery/mockery" }, - "time": "2023-08-09T00:03:52+00:00" + "time": "2024-05-16T03:13:13+00:00" }, { "name": "monolog/monolog", @@ -6620,20 +6618,20 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "0424dff1c58f028c451efff2045f5d92410bd540" + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", - "reference": "0424dff1c58f028c451efff2045f5d92410bd540", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-ctype": "*" @@ -6679,7 +6677,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" }, "funding": [ { @@ -6695,7 +6693,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-grapheme", @@ -7014,20 +7012,20 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", - "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { @@ -7074,7 +7072,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" }, "funding": [ { @@ -7090,24 +7088,24 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "3fb075789fb91f9ad9af537c4012d523085bd5af" + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/3fb075789fb91f9ad9af537c4012d523085bd5af", - "reference": "3fb075789fb91f9ad9af537c4012d523085bd5af", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { @@ -7150,7 +7148,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0" }, "funding": [ { @@ -7166,7 +7164,7 @@ "type": "tidelift" } ], - "time": "2024-06-19T12:30:46+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/service-contracts", @@ -7514,16 +7512,16 @@ }, { "name": "symfony/yaml", - "version": "v5.4.40", + "version": "v5.4.44", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "81cad0ceab3d61fe14fe941ff18a230ac9c80f83" + "reference": "7025b964f123bbf1896d7563db6ec7f1f63e918a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/81cad0ceab3d61fe14fe941ff18a230ac9c80f83", - "reference": "81cad0ceab3d61fe14fe941ff18a230ac9c80f83", + "url": "https://api.github.com/repos/symfony/yaml/zipball/7025b964f123bbf1896d7563db6ec7f1f63e918a", + "reference": "7025b964f123bbf1896d7563db6ec7f1f63e918a", "shasum": "" }, "require": { @@ -7569,7 +7567,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v5.4.40" + "source": "https://github.com/symfony/yaml/tree/v5.4.44" }, "funding": [ { @@ -7585,7 +7583,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:33:22+00:00" + "time": "2024-09-16T14:36:56+00:00" }, { "name": "theseer/tokenizer", @@ -8376,16 +8374,16 @@ }, { "name": "yoast/phpunit-polyfills", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/Yoast/PHPUnit-Polyfills.git", - "reference": "a0f7d708794a738f328d7b6c94380fd1d6c40446" + "reference": "e9c8413de4c8ae03d2923a44f17d0d7dad1b96be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/a0f7d708794a738f328d7b6c94380fd1d6c40446", - "reference": "a0f7d708794a738f328d7b6c94380fd1d6c40446", + "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/e9c8413de4c8ae03d2923a44f17d0d7dad1b96be", + "reference": "e9c8413de4c8ae03d2923a44f17d0d7dad1b96be", "shasum": "" }, "require": { @@ -8400,7 +8398,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.x-dev" + "dev-main": "3.x-dev" } }, "autoload": { @@ -8435,7 +8433,7 @@ "security": "https://github.com/Yoast/PHPUnit-Polyfills/security/policy", "source": "https://github.com/Yoast/PHPUnit-Polyfills" }, - "time": "2024-04-05T16:01:51+00:00" + "time": "2024-09-06T22:03:10+00:00" }, { "name": "yoast/wp-test-utils", From 391c2b403f1987126062c94ae6f26fd234ab99dc Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 18 Oct 2024 13:52:47 +0200 Subject: [PATCH 5/7] Nullable types --- includes/admin/class-amp-template-customizer.php | 2 +- src/Dom/ElementList.php | 2 +- src/Infrastructure/Injector/SimpleInjector.php | 2 +- src/Infrastructure/ServiceBasedPlugin.php | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/admin/class-amp-template-customizer.php b/includes/admin/class-amp-template-customizer.php index 8d1dc767c64..6bda727e41e 100644 --- a/includes/admin/class-amp-template-customizer.php +++ b/includes/admin/class-amp-template-customizer.php @@ -76,7 +76,7 @@ protected function __construct( WP_Customize_Manager $wp_customize, ReaderThemeL * @param ReaderThemeLoader|null $reader_theme_loader Reader theme loader. * @return AMP_Template_Customizer Instance. */ - public static function init( WP_Customize_Manager $wp_customize, ReaderThemeLoader $reader_theme_loader = null ) { + public static function init( WP_Customize_Manager $wp_customize, ?ReaderThemeLoader $reader_theme_loader = null ) { if ( null === $reader_theme_loader ) { $reader_theme_loader = Services::get( 'reader_theme_loader' ); } diff --git a/src/Dom/ElementList.php b/src/Dom/ElementList.php index eac2366454f..9e14671c49b 100644 --- a/src/Dom/ElementList.php +++ b/src/Dom/ElementList.php @@ -35,7 +35,7 @@ final class ElementList implements IteratorAggregate, Countable { * @param DOMElement|null $caption The caption for the element. * @return ElementList A clone of this list, with the new element added. */ - public function add( DOMElement $element, DOMElement $caption = null ): ElementList { + public function add( DOMElement $element, ?DOMElement $caption = null ): ElementList { $cloned_list = clone $this; $cloned_list->elements[] = null === $caption ? $element : new CaptionedSlide( $element, $caption ); return $cloned_list; diff --git a/src/Infrastructure/Injector/SimpleInjector.php b/src/Infrastructure/Injector/SimpleInjector.php index 489b2de75dd..924c34463f7 100644 --- a/src/Infrastructure/Injector/SimpleInjector.php +++ b/src/Infrastructure/Injector/SimpleInjector.php @@ -51,7 +51,7 @@ final class SimpleInjector implements Injector { * * @param Instantiator|null $instantiator Optional. Instantiator to use. */ - public function __construct( Instantiator $instantiator = null ) { + public function __construct( ?Instantiator $instantiator = null ) { $this->instantiator = null !== $instantiator ? $instantiator : new FallbackInstantiator(); diff --git a/src/Infrastructure/ServiceBasedPlugin.php b/src/Infrastructure/ServiceBasedPlugin.php index 1574cdf8ab7..ffc6dc61663 100644 --- a/src/Infrastructure/ServiceBasedPlugin.php +++ b/src/Infrastructure/ServiceBasedPlugin.php @@ -67,8 +67,8 @@ abstract class ServiceBasedPlugin implements Plugin { */ public function __construct( $enable_filters = null, - Injector $injector = null, - ServiceContainer $service_container = null + ?Injector $injector = null, + ?ServiceContainer $service_container = null ) { /* * We use what is commonly referred to as a "poka-yoke" here. From f7f32fb7c3b5f00f97e281c8090d1d79abed1fc2 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 18 Oct 2024 14:00:02 +0200 Subject: [PATCH 6/7] Update `mikey179/vfsstream` --- composer.json | 2 +- composer.lock | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 0aab81ddb75..adcb2dc15b5 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "automattic/vipwpcs": "^3.0", "civicrm/composer-downloads-plugin": "^4.0", "google/cloud-storage": "^1.0", - "mikey179/vfsstream": "1.6.11", + "mikey179/vfsstream": "1.6.12", "mustache/mustache": "^2", "php-stubs/wordpress-stubs": "^6.0", "phpcompatibility/phpcompatibility-wp": "2.1.5", diff --git a/composer.lock b/composer.lock index ede3dbe09d7..8e509fdb2d6 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": "d1bc9359ff0023f06fd3e4dfbc5c1eb6", + "content-hash": "609f396f85d60e46926a06c18aa6bd63", "packages": [ { "name": "ampproject/amp-toolbox", @@ -1964,23 +1964,24 @@ }, { "name": "mikey179/vfsstream", - "version": "v1.6.11", + "version": "v1.6.12", "source": { "type": "git", "url": "https://github.com/bovigo/vfsStream.git", - "reference": "17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f" + "reference": "fe695ec993e0a55c3abdda10a9364eb31c6f1bf0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f", - "reference": "17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f", + "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/fe695ec993e0a55c3abdda10a9364eb31c6f1bf0", + "reference": "fe695ec993e0a55c3abdda10a9364eb31c6f1bf0", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=7.1.0" }, "require-dev": { - "phpunit/phpunit": "^4.5|^5.0" + "phpunit/phpunit": "^7.5||^8.5||^9.6", + "yoast/phpunit-polyfills": "^2.0" }, "type": "library", "extra": { @@ -2011,7 +2012,7 @@ "source": "https://github.com/bovigo/vfsStream/tree/master", "wiki": "https://github.com/bovigo/vfsStream/wiki" }, - "time": "2022-02-23T02:02:42+00:00" + "time": "2024-08-29T18:43:31+00:00" }, { "name": "mockery/mockery", From a5e804f95c2f84b6224eb08053e13dac13951a10 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 18 Oct 2024 14:05:31 +0200 Subject: [PATCH 7/7] PHPStan: disable `requireFileExists` --- phpstan.neon.dist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index e54f3d44c64..981b3690ec6 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -35,3 +35,5 @@ parameters: - WP_CLI::error dynamicConstantNames: - INTL_IDNA_VARIANT_2003 + featureToggles: + requireFileExists: false