Make WordPress Core

Changeset 65808 for trunk/package.json


Ignore:
Timestamp:
11/27/2026 08:15:25 PM (16 hours ago)
Author:
westonruter
Message:

Build/Test Tools: Add tests for the PHPStan extensions.

The extensions in tests/phpstan change what PHPStan reads out of core, deriving types from hash notation and @global tags, typing filtered values, and checking hook documentation, so a defect in one surfaces only as a quiet change in what the analysis reports. They are now covered by a PHPUnit suite built on PHPStan's test harness, which runs them against fixtures rather than against core, with hook reference comments resolving against a small fixture tree instead of src. It is run with composer phpstan:test or npm run typecheck:php:test.

Since the harness parses every file as an analyzed one, it cannot see whether the redefinition of the simple parser in base.neon still applies, which is what gives a file that is only scanned the same derived types. One test therefore runs a real analysis with base.neon to cover it, so that a PHPStan upgrade renaming the service it redefines fails a test rather than quietly undoing it.

In CI, the suite runs in the analysis of the whole codebase, after its results are reported, so that a failing test does not also leave a pull request without its annotations. It is skipped on branches that do not have it.

Developed in ​https://github.com/WordPress/wordpress-develop/pull/15850.
Follow-up to r62292, r62939, r63420, r63462.

Props johnbillion, lucatume, westonruter.
Fixes #66634.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package.json

    r65764 r65808  
    156156                "typecheck:php:baselines": "node ./tools/local-env/scripts/docker.js run --rm php composer phpstan:baselines --",
    157157                "typecheck:php:fix": "node ./tools/local-env/scripts/docker.js run --rm php composer phpstan:fix --",
     158                "typecheck:php:test": "node ./tools/local-env/scripts/docker.js run --rm php composer phpstan:test --",
    158159                "gutenberg:copy": "node tools/gutenberg/copy.js",
    159160                "gutenberg:verify": "node tools/gutenberg/utils.js",
Note: See TracChangeset for help on using the changeset viewer.