WordPress build repository browser


Ignore:
Timestamp:
11/03/2026 05:52:04 PM (6 days ago)
Author:
westonruter
Message:

Build/Test Tools: Fix static analysis issues in HashNotationVisitor.

This fixes the level-10 PHPStan errors that predate the hash notation visitor's recent changes, along with a few PhpStorm inspection warnings, without changing the @phpstan-* tags the visitor derives across src/.

Most of the errors came from one limit: an entry in a hash can open a hash of its own, and an array shape cannot refer to itself, so every nested entry was mixed. Entries are therefore read into a new HashEntry class, whose children are typed as entries in turn. The rest came from writes through a list offset, which PHPStan reads as adding an incomplete element, so a tag or entry is now completed before it is added to its list. String types are also narrowed where possible, though an entry's type and key are only non-empty strings, since 0 is valid as either.

Developed in ​https://github.com/WordPress/wordpress-develop/pull/15384.
Follow-up to r63420, r63789, r65217.

Props westonruter, lancewillett.
See #65817.

Built from ​https://develop.svn.wordpress.org/trunk@65246

File:
1 edited

Legend:

Unmodified
Added
Removed
Note: See TracChangeset for help on using the changeset viewer.