Skip to content

Fix tooling deprecations#111

Merged
zanbaldwin merged 1 commit into
6.xfrom
z/phpunit-deprecations
Jun 6, 2026
Merged

Fix tooling deprecations#111
zanbaldwin merged 1 commit into
6.xfrom
z/phpunit-deprecations

Conversation

@zanbaldwin
Copy link
Copy Markdown
Member

No description provided.

@zanbaldwin zanbaldwin self-assigned this Jun 6, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Jun 6, 2026

Greptile Summary

This PR fixes PHPUnit deprecation warnings across the test suite by introducing a thin tests/TestCase.php base class with a legacyExpectExceptionMessage() compatibility shim, and updates PHPStan configuration to suppress cross-version type-analysis noise.

  • New tests/TestCase.php: Adds legacyExpectExceptionMessage() which delegates to expectExceptionMessageIsOrContains() on PHPUnit 11+ (where expectExceptionMessage() is deprecated) and falls back to expectExceptionMessage() on older versions, using a method_exists() check at runtime.
  • Test file updates (IPv4Test, IPv6Test, MultiTest): All three files now extend the new base class and replace direct expectExceptionMessage() calls with legacyExpectExceptionMessage().
  • PHPStan config: Two new ignoreErrors entries — one narrowly scoped to suppress a confirmed false-positive in src/Util/Binary.php, and one blanket suppression (with reportUnmatched: false) for tests/TestCase.php to sidestep unresolvable multi-version PHPUnit type-checking issues.

Confidence Score: 5/5

All changes are confined to test infrastructure and static analysis configuration; no production code is touched.

The new base TestCase correctly uses method_exists() to branch between PHPUnit versions at runtime, the three test files are updated consistently, and the PHPStan suppressions are appropriately scoped with clear rationale. No logic changes or regressions are introduced.

No files require special attention.

Important Files Changed

Filename Overview
tests/TestCase.php New abstract base TestCase with a legacyExpectExceptionMessage() compatibility shim that selects between expectExceptionMessageIsOrContains() (PHPUnit 11+) and the deprecated expectExceptionMessage() at runtime.
phpstan.neon Adds two new ignoreErrors entries: one narrowly scoped to suppress a PHPStan false-positive on Binary.php, and a blanket suppression (reportUnmatched: false) for the new tests/TestCase.php to avoid cross-version PHPUnit type-analysis noise.
tests/Version/IPv4Test.php Switches import from PHPUnit's TestCase to the project's custom TestCase; replaces two expectExceptionMessage() calls with legacyExpectExceptionMessage().
tests/Version/IPv6Test.php Same import and expectExceptionMessage() migration as IPv4Test, applied to the IPv6 test suite.
tests/Version/MultiTest.php Same import and expectExceptionMessage() migration as IPv4Test, applied to the Multi-version test suite.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Test class calls legacyExpectExceptionMessage] --> B{method_exists
expectExceptionMessageIsOrContains?}
    B -- Yes PHPUnit 11+ --> C[expectExceptionMessageIsOrContains
no deprecation warning]
    B -- No Older PHPUnit --> D[expectExceptionMessage
legacy fallback]
    C --> E[Test continues]
    D --> E
Loading

Reviews (2): Last reviewed commit: "test: 🚨 fix tooling deprecations" | Re-trigger Greptile

@zanbaldwin zanbaldwin force-pushed the z/phpunit-deprecations branch from 363fbd2 to 6cf40e4 Compare June 6, 2026 23:11
@zanbaldwin zanbaldwin merged commit 088a165 into 6.x Jun 6, 2026
24 checks passed
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.

1 participant