Skip to content

Bump minimum PHP requirement from 7.2 to 7.4#2469

Open
westonruter wants to merge 31 commits into
trunkfrom
update/php-74
Open

Bump minimum PHP requirement from 7.2 to 7.4#2469
westonruter wants to merge 31 commits into
trunkfrom
update/php-74

Conversation

@westonruter
Copy link
Copy Markdown
Member

Summary

Fixes #2340

Raises the minimum PHP version across the monorepo from 7.2 to 7.4, drops the two now-stale CI legs, retires workarounds whose comments invited removal at this bump, and opportunistically modernizes plugin source to use PHP 7.4 typed properties and arrow functions.

Floor bump

  • composer.json: require.php and config.platform.php^7.4 || ^8.0 / 7.4.
  • tools/phpcs/phpcs.ruleset.xml: testVersion7.4-.
  • All ten plugin bootstrap headers: Requires PHP: 7.4.
  • .github/workflows/php-test-plugins.yml: drops 7.2 and 7.3 from the unit-test matrix.
  • CONTRIBUTING.md, AGENTS.md, phpstan.neon.dist comment updated to reference 7.4.

Retired workarounds

  • OD_Link_Collection::get_prepared_links() — drops the empty-input guard around array_merge( ...array_map( ... ) ) that PHP 7.2/7.3 needed.
  • plugins/speculation-rules/settings.php — heredoc closer is reindented to its enclosing block using PHP 7.3+ flexible heredoc syntax.

Modernization

  • Native typed properties added across all 10 plugins (~60 properties across 24 classes); @var docblocks retained where they carry PHPStan-level subtypes (non-empty-string, int<1, max>, array shapes, etc.) the native type can't express.
  • A handful of bool|string, bool|callable, int|float|null properties stay un-typed with inline phpcs:ignore + a TODO note pointing at the eventual PHP 8.0 floor bump (PHP 7.4 has no native union types and callable is not allowed as a property type).
  • Lazy-init properties (is_array($prop) sentinel) refactored to ?T + null === $prop.
  • tools/phpcs/phpcs.ruleset.xml: removed the enableNativeTypeHint=false suppression so the SlevomatCodingStandard PropertyTypeHint sniff now requires native types in source; also excluded UselessAnnotation (so it doesn't fight WPCS's required @var) and MissingNativeTypeHint for tests (matching how other strict sniffs are already excluded for plugins/*/tests/**).
  • ~10 single-expression closures converted to arrow functions in OD, performance-lab, image-prioritizer, speculation-rules, web-worker-offloading, and view-transitions.

The PR is structured as 30 small logical commits so review and bisection stay easy.

Test plan

  • CI: php-test-plugins matrix shows three base legs (8.1, 8.0, 7.4) instead of five
  • CI: php-lint, plugin-check, and PHPStan green
  • Local: composer install resolves without re-locking
  • Local: composer phpstan (level 8) green
  • Local: composer lint:all green
  • Local: npm run test-php passes the 10 plugin suites
  • Manual: activate Optimization Detective and Speculative Loading on a wp-env'd site and confirm the link-collection path and the speculation-rules admin notice still render correctly

I fed this issue into Claude Code with the prompt:

I want to update this repo from the PHP 7.2 requirement to PHP 7.4. For reference, see this GitHub issue: #2340

In plan mode, it came up with the following:

Bump Performance plugin monorepo minimum PHP from 7.2 → 7.4

Context

The Performance Team's repo currently requires PHP 7.2, but tracking issue
#2340 calls for moving the floor to PHP 7.4. WordPress
core's own minimum has already moved past 7.2, so the older floor is buying
nothing in compatibility while costing two CI matrix jobs and blocking use of
typed properties, arrow functions, and the ??= operator.

This plan does the floor bump end-to-end: configuration, plugin headers, CI
matrix, lint/static-analysis settings, and docs; removes two now-dead
workarounds whose comments explicitly invite their removal at this version
bump; and opportunistically modernizes the codebase by converting class
properties (well-documented via @var) to native PHP 7.4 typed properties and
collapsing single-expression closures into arrow functions where the
conversion is unambiguous.

The user has approved an opportunistic modernization pass (not just a
config-only bump), so the plan covers both the version bump and the followup
typing work in a single PR.


Phase 1 — Bump the floor (config, headers, CI, docs)

composer.json

  • Line 15: "php": "^7.2 || ^8.0""php": "^7.4 || ^8.0"
  • Line 46 (config.platform): "php": "7.2""php": "7.4"

tools/phpcs/phpcs.ruleset.xml

  • Line 6: <config name="testVersion" value="7.2-"/>value="7.4-"
  • Line 118: delete the <property name="enableNativeTypeHint" value="false" /><!-- Only available in PHP 7.4+ --> line so the SlevomatCodingStandard PropertyTypeHint sniff defaults back to requiring native type hints. (See Phase 4 — every class property must gain a native type before this gate is allowed to be the default; the conversion lands in the same PR.)

phpstan.neon.dist

  • Line 16 comment: change "config.platform.php being 7.2" → "config.platform.php being 7.4". The phpstan/php-8-stubs scan entries below still apply (those are PHP 8.0 polyfills — the polyfill need is unrelated to the 7.4 floor).

Plugin bootstrap headers — Requires PHP: 7.2Requires PHP: 7.4

  • plugins/auto-sizes/auto-sizes.php:7
  • plugins/dominant-color-images/load.php:7
  • plugins/embed-optimizer/load.php:7
  • plugins/image-prioritizer/load.php:7
  • plugins/optimization-detective/load.php:7
  • plugins/performance-lab/load.php:7
  • plugins/speculation-rules/load.php:7
  • plugins/view-transitions/view-transitions.php:7
  • plugins/web-worker-offloading/load.php:7
  • plugins/webp-uploads/load.php:7

.github/workflows/php-test-plugins.yml

  • Line 42: php: ['8.1', '8.0', '7.4', '7.3', '7.2']php: ['8.1', '8.0', '7.4'] (drops the two unit-testing jobs the issue calls out). Leave the include: block alone — the existing php: '7.4' + wp: '6.6' and 8.2/8.3/8.4/8.5 trunk entries stay.

Documentation

  • CONTRIBUTING.md:10: "minimum required version right now is 7.2" → "7.4".
  • AGENTS.md:83: "backward compatible with PHP 7.2" → "PHP 7.4".

Out of scope for Phase 1

  • plugins/*/readme.txt files have no Requires PHP header (it's pulled from the .php bootstrap by w.org), so no readme.txt changes needed.
  • No per-plugin composer.json files exist; only the root one.
  • The package.xml at the repo root is an untracked Xdebug PECL manifest unrelated to this work; ignore.

Phase 2 — Remove dead 7.2/7.3 workarounds

Both call sites carry comments that explicitly say the workaround can be retired at the bump.

plugins/optimization-detective/class-od-link-collection.php (around line 130-135)

PHP 7.4 changed array_merge() to allow zero arguments, so the empty-input guard is no longer required. Remove the if ( count( $links_by_rel ) === 0 ) { return array(); } block and the explanatory comment; let the existing array_merge( ...array_map( ... ) ) call run unconditionally.

plugins/speculation-rules/settings.php (around line 343-344)

PHP 7.3 introduced flexible heredoc/nowdoc indentation. Re-indent the closing JS; marker to match its enclosing block (two more levels in) and delete the // 👆 This 'JS;' line can only be indented two tabs when minimum PHP version is increased to 7.3+. comment. Also re-indent the heredoc body so it lines up with the new closer (PHP 7.3+ strips the closer's indentation from each line uniformly).

Optimization-detective changelog note

The plugins/optimization-detective/readme.txt:263 line "Use PHP 7.2 features in Optimization Detective" is historical changelog content and should be left alone.


Phase 3 — Modernization: typed properties

The Slevomat PropertyTypeHint sniff is being un-suppressed in Phase 1, so every class property in non-test plugin code must gain a native type hint in this PR. The good news from the inventory: 63 of 64 properties already carry single-type @var docblocks, so this is mechanical.

Approach per property

  1. Read the existing @var T docblock.
  2. If T is string, int, bool, float, array, self, a class name, or T|null (which becomes ?T), declare it natively: private ?string $foo; or private array $bar = array();.
  3. If T is a non-null union beyond T|null (e.g., array|false, string|int) — PHP 7.4 doesn't support these natively; refactor the property to use a single type plus a default that signals the absence (e.g., empty array, 0), or leave the property untyped and add an inline phpcs:ignore for that one property with a TODO: PHP 8.0 note. Inventory found ~11 such properties — handle them one-by-one in the diff, preferring refactor over suppression where the codepath cleanly allows it.
  4. Initialize at declaration where the type requires it (PHP 7.4 throws on read-before-write of typed uninitialized non-nullable properties). Use the existing constructor's initial value as the literal.
  5. Keep the @var docblock — it stays valuable for PHPStan-level subtypes (e.g., non-empty-string, array shapes) that the native type can't express.

Files in scope (28 classes, 64 properties)

Heaviest: optimization-detective (16 classes, 45 props). Top conversion targets:

  • plugins/optimization-detective/class-od-html-tag-processor.php — 9 properties
  • plugins/optimization-detective/class-od-url-metric-group.php — 7 properties
  • plugins/optimization-detective/class-od-url-metric-group-collection.php — 6 properties
  • plugins/optimization-detective/class-od-tag-visitor-context.php — 5 properties
  • plugins/optimization-detective/class-od-template-optimization-context.php — 5 properties
  • Remaining od-* classes, class-od-element.php, class-od-data-validation-exception.php, class-od-link-collection.php, class-od-strict-url-metric.php, class-od-tag-visitor-registry.php, class-od-url-metric.php, class-od-visited-tag-state.php, storage/class-od-storage-lock.php, etc.

Other plugins:

  • view-transitions — 2 classes, 9 properties
  • performance-lab — 2 classes, 5 properties
  • image-prioritizer — 4 classes, 3 properties
  • embed-optimizerclass-embed-optimizer-tag-visitor.php — 1 property
  • speculation-rules — 1 class, 1 property
  • dominant-color-images — no class properties to convert

The 1 property lacking an @var (uncovered by the inventory) gets typed by reading its assignments in context.


Phase 4 — Modernization: arrow functions

Convert single-expression closures function (...) { return <expr>; } to fn (...) => <expr> where:

  • The body is a single return statement (no other statements, no nested closures).
  • No use ($x) clause is needed (arrow functions auto-capture by value, which is a behavior change only when the closure currently captures a reference).
  • The closure isn't static function already in a context where staticness matters — static fn is allowed in PHP 7.4 and should be kept.

Highest-density files (from inventory):

  • plugins/performance-lab/ — ~18 closure call sites across ~9 files
  • plugins/optimization-detective/ — ~15 across ~8 files (notably storage/data.php, helper.php, optimization.php)
  • plugins/image-prioritizer/, plugins/speculation-rules/ — a handful each

Estimate ~15–25 conversions across the repo. Inspect each individually rather than mechanically — leave multi-statement closures untouched.

The ??= operator: 0 candidates found in the codebase. No work.


Commit strategy

Each discrete change lands in its own logical commit, in this order, on the update/php-74 branch:

  1. Bump composer.json PHP requirement to ^7.4 || ^8.0require.php and config.platform.php. Run composer update --lock only if the lock file legitimately changes; otherwise omit.
  2. Bump phpcs testVersion to 7.4- — single edit in tools/phpcs/phpcs.ruleset.xml line 6.
  3. Bump plugin header Requires PHP to 7.4 — all 10 plugin bootstrap files in one commit (single mechanical change across the monorepo).
  4. Drop PHP 7.2 and 7.3 from CI unit-test matrix.github/workflows/php-test-plugins.yml.
  5. Update CONTRIBUTING.md and AGENTS.md to reference PHP 7.4 — docs only.
  6. Update phpstan.neon.dist comment to reference 7.4 — single comment line.
  7. Remove PHP 7.2/7.3 array_merge empty-input workaroundplugins/optimization-detective/class-od-link-collection.php. (Phase 2.)
  8. Re-indent speculation-rules heredoc closer for PHP 7.3+ flexible heredocplugins/speculation-rules/settings.php. (Phase 2.)
  9. Convert optimization-detective class properties to native typed properties — one commit per class file, or one bundled commit for all od-* classes if the diff stays reviewable. Target: each class's typed-property conversion in its own commit so blame stays clean. (Phase 3.)
  10. Convert remaining plugin class properties to native typed properties — view-transitions, performance-lab, image-prioritizer, embed-optimizer, speculation-rules. One commit per plugin.
  11. Re-enable Slevomat PropertyTypeHint native type requirement — remove the enableNativeTypeHint=false line from tools/phpcs/phpcs.ruleset.xml. This commit must come after all property typing is in place; ordering it last in the typing-related commits keeps composer lint:all green at every commit.
  12. Convert single-expression closures to arrow functions — one commit per plugin (or per file if a plugin has many). (Phase 4.)

Commit messages follow the existing repo style (imperative present tense, no Anthropic Co-Authored-By trailer unless requested). Group order ensures bisection: every commit leaves the repo in a working, lint-green state.

Defer commit creation until the user explicitly asks to commit; per CLAUDE.md guidance, do not auto-commit.


Phase 5 — Verification

Run locally before opening the PR:

  1. composer install — confirms platform/require change parses.
  2. composer phpstan — must stay green at level 8.
  3. composer lint:all — must stay green; verifies the enableNativeTypeHint removal is satisfied (i.e., every property gained its native type).
  4. npm run test:php — full PHPUnit suite. Expect any test that exercises the array_merge empty-input branch in optimization-detective to still pass (the unconditional array_merge returns the same array() for empty input on PHP 7.4+).
  5. composer test:plugins — per-plugin suites.
  6. npm run env:cli -- plugin activate optimization-detective speculation-rules — sanity-check on the wp-env'd WordPress that the two files we edited still load (heredoc reformat in particular).
  7. Optionally bring up the dev environment (http://localhost:8000/) and visit the front-end to confirm Optimization Detective's link collection and Speculation Rules' admin notice render correctly.

CI verification once pushed:

  • php-test-plugins.yml should now show 3 base-matrix jobs (8.1, 8.0, 7.4) instead of 5 — confirms the matrix change took effect.
  • php-lint.yml should pass on latest PHP.
  • plugin-check.yml should pass on PHP 8.3.

Critical files (for quick navigation during execution)

Purpose Path
Top-level Composer config composer.json
PHPCS base ruleset tools/phpcs/phpcs.ruleset.xml
PHPStan config phpstan.neon.dist
CI unit-test matrix .github/workflows/php-test-plugins.yml
Contributor docs CONTRIBUTING.md, AGENTS.md
Plugin headers plugins/*/load.php and plugins/auto-sizes/auto-sizes.php, plugins/view-transitions/view-transitions.php
Dead-workaround 1 plugins/optimization-detective/class-od-link-collection.php:130-135
Dead-workaround 2 plugins/speculation-rules/settings.php:343-344
Heaviest typed-property targets plugins/optimization-detective/class-od-*.php

westonruter and others added 30 commits May 8, 2026 12:57
Updates the composer require constraint and the config.platform.php
override so dependencies resolve against PHP 7.4 as the floor.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Aligns the PHPCompatibility testVersion with the new minimum PHP
version, so syntax newer than 7.4 stays disallowed but 7.4-only
constructs (typed properties, arrow functions) no longer flag.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Updates the WordPress plugin metadata across all bundled plugins so
WordPress will refuse to activate them on hosts below the new floor.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The plugin no longer supports anything below PHP 7.4, so the two
older matrix legs only cost CI time without protecting users.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The PHP 8 polyfill stubs are still required (those functions appeared
in PHP 8.0), but the rationale comment incorrectly cited 7.2.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
PHP 7.4 changed array_merge() to accept zero arguments (returning an
empty array), so the explicit early-return when links_by_rel is empty
is no longer necessary.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…edoc

The 'JS;' closer can now sit at the same indent as its opener and PHP
will strip that prefix from each body line, dropping the obsolete
PHP 7.2 indentation note in the process.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
WPCS (Squiz.Commenting.VariableComment.MissingVar) requires every
class property docblock to carry an @var tag, while Slevomats
PropertyTypeHint.UselessAnnotation flags any @var that just repeats
the native type. Once we start adding native typed properties (PHP
7.4+) the two sniffs collide on every plain bool/int/string property,
so excluding the Slevomat sub-sniff lets the WordPress convention win.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Now that PHP 7.4 is the minimum, declare native types on the
classs nine private properties; the existing @var docblocks stay
to carry PHPStan-level subtypes (non-empty-string[], non-negative-int,
array shapes) that the native type cannot express.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Declares the seven private properties with native types now that PHP
7.4 is the minimum, retaining the @var docblocks so PHPStan still
sees the bounded-int and array-shape subtypes.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Make $elements nullable so the existing lazy-init pattern continues
to work with a typed property; null replaces the prior is_array
check, which would always be true for a non-nullable array property.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
OD_Tag_Visitor_Registry, OD_Link_Collection, and OD_Visited_Tag_State
each have a single property; bundling the conversions in one commit
since the change in each file is mechanical and trivial.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Convert the three private/protected properties across the video and
background-image tag visitors. The lazily-populated tuple list keeps
its nullable type to preserve "not yet computed" sentinel semantics;
copy it to a local before iterating so PHPStan can narrow off null.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Type all four straightforward properties across Perflab_Server_Timing
and Perflab_Server_Timing_Metric. The remaining metric $value
property keeps an int|float|null docblock (with a phpcs:ignore note)
because PHP 7.4 has no native int|float union type; it converts when
PHP 8.0 becomes the floor.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Type the five straightforward properties across the registry and the
animation class. Four properties remain untyped because PHP 7.4 does
not allow callable as a native property type or bool|string unions;
each is annotated with phpcs:ignore plus a TODO for the PHP 8.0
follow-up.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Drop the enableNativeTypeHint=false suppression now that every class
property in tracked plugin source carries a native type (or an
inline phpcs:ignore for the few PHP 8.0-only union-type cases).

Tests are excluded from the MissingNativeTypeHint sub-sniff so
PHPUnit fixtures, mocks, and test data classes do not have to match
the strict typing applied to production code -- this matches how
other strict sniffs (DiscouragedFunctions, DocComment, etc.) are
already excluded for tests in the same ruleset.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…-detective

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ffloading

The WooCommerce check is intentionally left as a closure because its
body contains a documentation comment that does not survive the
reduction to a single expression.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@westonruter westonruter added the [Type] Enhancement A suggestion for improvement of an existing feature label May 8, 2026
@westonruter westonruter added the [Plugin] Modern Image Formats Issues for the Modern Image Formats plugin (formerly WebP Uploads) label May 8, 2026
@westonruter westonruter added [Plugin] Image Placeholders Issues for the Image Placeholders plugin (formerly Dominant Color Images) [Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only [Plugin] Optimization Detective Issues for the Optimization Detective plugin [Plugin] Speculative Loading Issues for the Speculative Loading plugin (formerly Speculation Rules) [Plugin] Embed Optimizer Issues for the Embed Optimizer plugin (formerly Auto Sizes) [Plugin] Enhanced Responsive Images Issues for the Enhanced Responsive Images plugin (formerly Auto Sizes) [Plugin] Image Prioritizer Issues for the Image Prioritizer plugin (dependent on Optimization Detective) [Plugin] Web Worker Offloading Issues for the Web Worker Offloading plugin. [Plugin] View Transitions Issues for the View Transitions plugin labels May 8, 2026
@westonruter westonruter added this to the performance-lab n.e.x.t milestone May 8, 2026
@westonruter westonruter requested a review from Copilot May 8, 2026 21:19
@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 92.59259% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.29%. Comparing base (c1a7da2) to head (71430b3).

Files with missing lines Patch % Lines
...erformance-lab/includes/server-timing/defaults.php 0.00% 1 Missing ⚠️
plugins/view-transitions/includes/theme.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk    #2469      +/-   ##
==========================================
- Coverage   69.33%   69.29%   -0.05%     
==========================================
  Files          90       90              
  Lines        7749     7724      -25     
==========================================
- Hits         5373     5352      -21     
+ Misses       2376     2372       -4     
Flag Coverage Δ
multisite 69.29% <92.59%> (-0.05%) ⬇️
single 35.75% <33.33%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: westonruter <[email protected]>
Co-authored-by: adamsilverstein <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Raises the monorepo’s minimum supported PHP version to 7.4 (per #2340), updates tooling/CI/docs to match, and modernizes plugin source to take advantage of PHP 7.4 features (typed properties and arrow functions) while removing now-unnecessary 7.2/7.3 compatibility workarounds.

Changes:

  • Bump PHP requirements across Composer, PHPCS (PHPCompatibility testVersion), plugin headers, docs, and CI matrix (dropping PHP 7.2/7.3 legs).
  • Re-enable/enforce native property type hints via PHPCS ruleset updates (with targeted exclusions for tests and redundant @var annotations).
  • Modernize runtime code with typed properties, null-based lazy init, and arrow functions; retire PHP 7.2/7.3-specific workarounds.

Reviewed changes

Copilot reviewed 42 out of 43 changed files in this pull request and generated no comments.

Show a summary per file
File Description
composer.json Updates required PHP version and Composer platform PHP to 7.4.
composer.lock Reflects updated platform PHP constraints/override and new content hash.
tools/phpcs/phpcs.ruleset.xml Bumps PHPCompatibility to 7.4-, enforces native property types, and adjusts Slevomat exclusions (including tests).
phpstan.neon.dist Updates comment to reflect 7.4 Composer platform setting.
.github/workflows/php-test-plugins.yml Removes PHP 7.2 and 7.3 from the plugin test matrix.
CONTRIBUTING.md Updates stated minimum PHP version to 7.4.
AGENTS.md Updates repository minimum PHP version references to 7.4.
plugins/auto-sizes/auto-sizes.php Updates plugin header “Requires PHP” to 7.4.
plugins/dominant-color-images/load.php Updates plugin header “Requires PHP” to 7.4.
plugins/embed-optimizer/load.php Updates plugin header “Requires PHP” to 7.4.
plugins/embed-optimizer/class-embed-optimizer-tag-visitor.php Adds native typed property for internal state.
plugins/image-prioritizer/load.php Updates plugin header “Requires PHP” to 7.4.
plugins/image-prioritizer/helper.php Converts a single-expression closure to an arrow function.
plugins/image-prioritizer/class-image-prioritizer-video-tag-visitor.php Adds native typed property for internal state.
plugins/image-prioritizer/class-image-prioritizer-img-tag-visitor.php Converts a single-expression closure to an arrow function.
plugins/image-prioritizer/class-image-prioritizer-background-image-styled-tag-visitor.php Refactors lazy-init state to ?array and adjusts related logic accordingly.
plugins/optimization-detective/load.php Updates plugin header “Requires PHP” to 7.4.
plugins/optimization-detective/detection.php Converts a single-expression closure to an arrow function.
plugins/optimization-detective/class-od-link-collection.php Retires PHP 7.2/7.3 array_merge empty-spread workaround; adds typed property and arrow function.
plugins/optimization-detective/class-od-html-tag-processor.php Adds native typed properties for internal stacks/state.
plugins/optimization-detective/class-od-element.php Adds native typed properties for data and owning URL metric.
plugins/optimization-detective/class-od-url-metric.php Adds native typed properties and refactors lazy-init elements to null sentinel; converts closures to arrow functions.
plugins/optimization-detective/class-od-url-metric-group.php Adds native typed properties; converts closures to arrow functions.
plugins/optimization-detective/class-od-url-metric-group-collection.php Adds native typed properties for collection state/caches.
plugins/optimization-detective/class-od-template-optimization-context.php Adds native typed properties for context fields.
plugins/optimization-detective/class-od-tag-visitor-context.php Adds native typed properties for visitor context fields.
plugins/optimization-detective/class-od-tag-visitor-registry.php Adds native typed property for registry state.
plugins/optimization-detective/class-od-visited-tag-state.php Adds native typed property for internal boolean state.
plugins/optimization-detective/storage/class-od-url-metric-store-request-context.php Adds native typed properties for request context fields.
plugins/performance-lab/load.php Updates plugin header “Requires PHP” to 7.4.
plugins/performance-lab/includes/server-timing/defaults.php Converts a single-expression closure to an arrow function.
plugins/performance-lab/includes/server-timing/class-perflab-server-timing.php Adds typed properties and converts a single-expression closure to an arrow function.
plugins/performance-lab/includes/server-timing/class-perflab-server-timing-metric.php Adds typed properties; leaves union-typed value untyped with PHPCS suppression.
plugins/speculation-rules/load.php Updates plugin header “Requires PHP” to 7.4.
plugins/speculation-rules/settings.php Uses flexible heredoc indentation now that PHP 7.3+ is guaranteed; removes related workaround comment.
plugins/speculation-rules/class-plsr-url-pattern-prefixer.php Adds typed property and converts closure to arrow function.
plugins/view-transitions/view-transitions.php Updates plugin header “Requires PHP” to 7.4.
plugins/view-transitions/includes/theme.php Converts a single-expression closure to an arrow function.
plugins/view-transitions/includes/class-plvt-view-transition-animation.php Adds typed properties where possible; documents/suppresses cases requiring PHP 8 union types or disallowed callable property types.
plugins/view-transitions/includes/class-plvt-view-transition-animation-registry.php Adds typed properties for registry maps.
plugins/web-worker-offloading/load.php Updates plugin header “Requires PHP” to 7.4.
plugins/web-worker-offloading/third-party.php Converts single-expression closures to arrow functions for integration checks.
plugins/webp-uploads/load.php Updates plugin header “Requires PHP” to 7.4.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

'complete' => $group->is_complete(),
);
},
static fn ( OD_URL_Metric_Group $group ): array => array(
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The array return type hint is overkill.

Suggested change
static fn ( OD_URL_Metric_Group $group ): array => array(
static fn ( OD_URL_Metric_Group $group ) => array(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Plugin] Embed Optimizer Issues for the Embed Optimizer plugin (formerly Auto Sizes) [Plugin] Enhanced Responsive Images Issues for the Enhanced Responsive Images plugin (formerly Auto Sizes) [Plugin] Image Placeholders Issues for the Image Placeholders plugin (formerly Dominant Color Images) [Plugin] Image Prioritizer Issues for the Image Prioritizer plugin (dependent on Optimization Detective) [Plugin] Modern Image Formats Issues for the Modern Image Formats plugin (formerly WebP Uploads) [Plugin] Optimization Detective Issues for the Optimization Detective plugin [Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only [Plugin] Speculative Loading Issues for the Speculative Loading plugin (formerly Speculation Rules) [Plugin] View Transitions Issues for the View Transitions plugin [Plugin] Web Worker Offloading Issues for the Web Worker Offloading plugin. [Type] Enhancement A suggestion for improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Minimum version of PHP can be bumped to 7.4

2 participants