Skip to content

Add PHP 8.2-8.5 version support upgrade skill and audit engine - #3

Open
noruzzamans wants to merge 4 commits into
Fueled:trunkfrom
noruzzamans:feature/php-version-upgrade-skill
Open

noruzzamans wants to merge 4 commits into
Fueled:trunkfrom
noruzzamans:feature/php-version-upgrade-skill

Conversation

@noruzzamans

@noruzzamans noruzzamans commented Sep 25, 2026 •

Copy link
Copy Markdown

Description of the Change

Following the initiative outlined by @jeffpaul in #2, the architectural consultation with @dkotter, and the direction set by WooCommerce's PHP version support update, this pull request introduces a standardized, reusable AI Agent skill conforming to the @10up/agent-skills / agentskills.io specification to automate auditing and preparing open-source repositories for modern PHP support.

This skill is designed as the foundational precursor to streamline the PHP upgrade across the suite of 24 downstream repositories linked to #2 (including safe-redirect-manager, distributor, ElasticPress, classifai, safe-svg, etc.).

📁 Bundled Skill Architecture

skills/php-version-upgrade/
├── SKILL.md                                  # Core procedure, phase checklists, and execution guardrails
├── scripts/
│   └── audit_php_versions.mjs                # Standalone Node.js ESM scanner (single repo & batch mode)
└── references/
    ├── detection-and-tooling-matrix.md       # Configuration mappings for headers, Composer, linters, & CI
    ├── php82-85-deprecations.md              # Technical remediation catalog for PHP 8.2–8.5 deprecations
    ├── legacy-shims-catalog.md               # Catalog of obsolete polyfills and dead conditional blocks (< 8.2)
    └── targeted-modernizations.md            # Guardrails distinguishing high-value fixes from cosmetic churn

⚙️ Key Operational Capabilities

  1. Automated Audit Engine (audit_php_versions.mjs):
    • Pure Node.js ESM (zero external npm dependencies, Node 18+ native).
    • Audits plugin/theme headers (Requires PHP), readme.txt, composer.json (require.php), phpcs.xml (testVersion), static analysis, and GitHub Actions CI matrices.
    • Scans code patterns for dynamic properties, deprecated ${var} interpolation, utf8_encode(), auto_detect_line_endings, and obsolete polyfills native in PHP 8.0+.
    • Features --batch mode for automated scanning across multiple repositories and --json for programmatic agent pipelines.
  2. Dynamic Version Parameterization (Maintainer Guidance):
    • Fully parameterized via CLI flags (--min=<version> and --max=<version>) with default baseline (8.2 and 8.5).
    • Interactive agent invocation protocol prompting for custom boundaries, ensuring future-proof reusability (e.g., bumping to 8.3 or targeting 8.1).
    • Dynamic CI matrix generation and version-aware legacy polyfill/shim pruning.
  3. Deterministic Metadata & Tooling Standards:
    • Elevates minimum runtime requirement floor to target minimum (default: 8.2) and maximum testing ceiling to target maximum (default: 8.5).
    • Harmonizes PHPCS compatibility runtime (--runtime-set testVersion <min>-<max>) and PHPStan/Psalm targets.
    • Synchronizes CI matrices (['8.2', '8.3', '8.4', '8.5']) with experimental: true for pre-GA PHP 8.5 containers.
  4. Strict Non-Refactoring Guardrails:
    • Strictly enforces Jeffrey Paul's rule: avoid unnecessary refactoring solely to adopt newer PHP syntax.
    • Prohibits bulk parameter typing on public hooks, wholesale constructor promotion, or speculative match expression rewrites, ensuring surgical PR diffs and minimal maintainer friction.

Closes #2

How to test the Change

  1. Verify script execution in a single repository (Default Boundaries):

    node skills/php-version-upgrade/scripts/audit_php_versions.mjs /path/to/plugin

    Confirm structured terminal report displays detected metadata, code pattern risks, and remediation action items.

  2. Verify dynamic version parameterization (Custom Boundaries):

    node skills/php-version-upgrade/scripts/audit_php_versions.mjs /path/to/plugin --min=8.3 --max=8.5
  3. Verify JSON output mode:

    node skills/php-version-upgrade/scripts/audit_php_versions.mjs /path/to/plugin --json
  4. Verify batch mode across multiple plugins:

    node skills/php-version-upgrade/scripts/audit_php_versions.mjs --batch=/path/to/plugins-dir
  5. Verify skill documentation completeness:
    Review SKILL.md and the 4 modular guides in references/ to ensure all procedures align with Fueled and 10up engineering standards.

Changelog Entry

Added - Reusable AI Agent skill and audit engine for PHP version support upgrades with dynamic parameterization.

Credits

Props @noruzzamans, @jeffpaul, @dkotter

Checklist:

@noruzzamans
noruzzamans marked this pull request as ready for review September 25, 2026 16:10
@noruzzamans

Copy link
Copy Markdown
Author

Hi @dkotter and @jeffpaul,

Following our discussion on #2, this pull request has been updated with full dynamic parameterization and is now marked Ready for Review!

Summary of Updates:

  1. Interactive Invocation (SKILL.md): Configured to prompt for target min (default: 8.2) and max (default: 8.5) PHP versions, ensuring the skill remains flexible for future upgrades (e.g. PHP 8.3) or custom baselines.
  2. Dynamic CLI Arguments (scripts/audit_php_versions.mjs): Supports --min=<version> and --max=<version> flags for custom single and batch repository audits.
  3. Dynamic CI Matrix & Shim Pruning: Matrix generation and obsolete polyfill/shim checks automatically adapt relative to the target versions specified.
  4. Verification: Syntax verified with node --check and tested locally across single repositories (safe-redirect-manager, distributor) as well as batch mode.

Looking forward to your review and feedback whenever you have a moment!

Comment thread skills/php-version-upgrade/SKILL.md Outdated
- phpstan.neon*
- .github/workflows/*.yml
metadata:
author: Fueled & 10up

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There does not need to be any references to 10up. That can be cleaned up to just be Fueled across all files

Comment thread skills/php-version-upgrade/SKILL.md Outdated
- .github/workflows/*.yml
metadata:
author: Fueled & 10up
version: "1.1.0"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Since this hasn't been released yet, any reason for this not to be 1.0.0?

Comment thread skills/php-version-upgrade/SKILL.md Outdated
## 🎯 Interactive Invocation & Version Configuration

When invoking this skill, determine the target version boundaries:
- **Target Minimum PHP Version Floor (`targetMin`):** `8.2` (Default for current Fueled/10up initiative)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
- **Target Minimum PHP Version Floor (`targetMin`):** `8.2` (Default for current Fueled/10up initiative)
- **Target Minimum PHP Version Floor (`targetMin`):** `8.2`

Comment thread skills/php-version-upgrade/SKILL.md Outdated

When invoking this skill, determine the target version boundaries:
- **Target Minimum PHP Version Floor (`targetMin`):** `8.2` (Default for current Fueled/10up initiative)
- **Target Maximum Tested PHP Version Ceiling (`targetMax`):** `8.5` (Default for current Fueled/10up initiative)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
- **Target Maximum Tested PHP Version Ceiling (`targetMax`):** `8.5` (Default for current Fueled/10up initiative)
- **Target Maximum Tested PHP Version Ceiling (`targetMax`):** `8.5`

Comment thread skills/php-version-upgrade/SKILL.md Outdated

## When to Use

- Updating a Fueled or 10up open-source repository to modernize PHP requirements.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Any particularly reason this needs to mention Fueled or 10up here? I'd make this generic for any codebase, open source or not, owned by Fueled or not

@@ -0,0 +1,164 @@
# PHP 8.2–8.5 Deprecations and Incompatibilities Reference

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'd maybe include down to PHP 8 here, not just PHP 8.2+

@@ -0,0 +1,76 @@
# Legacy Shims and Dead Code Catalog

When elevating the minimum supported PHP runtime floor to **PHP 8.2**, legacy conditional branches, compatibility shims, and polyfills for features introduced in PHP 8.0 and 8.1 become dead code.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
When elevating the minimum supported PHP runtime floor to **PHP 8.2**, legacy conditional branches, compatibility shims, and polyfills for features introduced in PHP 8.0 and 8.1 become dead code.
When elevating the minimum supported PHP runtime floor to **PHP 8.2+**, legacy conditional branches, compatibility shims, and polyfills for features introduced in PHP 8.0 and 8.1 become dead code.

@@ -0,0 +1,183 @@
# Detection and Tooling Configuration Matrix

This reference specifies the deterministic configuration, metadata, and continuous integration settings required when upgrading a WordPress plugin or theme repository to support **PHP 8.2 through PHP 8.5**.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

So a lot still here references PHP 8.2 as the minimum, though someone can set a different minimum. If we want to keep referencing a specific minimum, I'd set that to PHP 8, not 8.2 so it's more flexible

@noruzzamans

Copy link
Copy Markdown
Author

Thanks for the thorough review and great suggestions, @dkotter! All feedback points have been addressed in commit a07b4b0:

  1. Initial Release Versioning: Reset SKILL.md version to 1.0.0.
  2. Generic Invocation: Removed the (Default for current Fueled/10up initiative) annotations on targetMin and targetMax.
  3. Codebase Generalization: Removed all organization-specific mentions across SKILL.md and references/targeted-modernizations.md to ensure the skill is completely generic for any WordPress plugin, theme, or library.
  4. PHP 8.0–8.5 Coverage: Expanded the deprecation catalog down to PHP 8.0 (covering PHP 8.0 non-numeric string comparisons, internal TypeError/ValueError semantics, removed legacy functions, and PHP 8.1 null deprecations & #[\ReturnTypeWillChange]), renaming the guide to references/php80-85-deprecations.md.
  5. Flexible Baseline Floor: Updated references/detection-and-tooling-matrix.md to reference PHP 8.0 as the flexible baseline floor example instead of hardcoded 8.2.
  6. Legacy Shims Catalog: Updated minimum floor to PHP 8.2+ and documented tiered pruning rules for PHP 8.0+ and 8.1+ shims.

Ready for re-review!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a skill for PHP 8.2–8.5 support upgrades

2 participants