Skip to content

Rename the whole-value output methods to to* conversions#130

Merged
zanbaldwin merged 1 commit into
6.xfrom
z/output-renames
Jul 3, 2026
Merged

Rename the whole-value output methods to to* conversions#130
zanbaldwin merged 1 commit into
6.xfrom
z/output-renames

Conversation

@zanbaldwin

Copy link
Copy Markdown
Member
  • to* = convert the canonically-held binary representation to something
  • get* = component and property accessors

@zanbaldwin zanbaldwin self-assigned this Jul 3, 2026
@greptile-apps

greptile-apps Bot commented Jul 3, 2026

Copy link
Copy Markdown

Greptile Summary

This PR renames whole-address output methods from get* accessors to to* conversions. The main changes are:

  • Added toDotAddress(), toCompactedAddress(), toExpandedAddress(), and toProtocolAppropriateAddress() across contracts and version classes.
  • Kept the old get* methods as deprecated forwarding aliases for compatibility.
  • Updated documentation, changelog entries, and tests to use the new conversion names.

Confidence Score: 5/5

Safe to merge with minimal risk.

The rename is applied consistently across contracts, implementations, docs, and tests. Deprecated aliases preserve existing callers and tests cover formatter forwarding behavior. No correctness or security issues were identified.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • Baseline address accessors were validated: getDotAddress, getCompactedAddress, getExpandedAddress, and getProtocolAppropriateAddress returned the expected strings, while the to* methods were absent as expected.
  • Post-change checks were performed: head to* methods now return the specified IPv4 and IPv6 values, and legacy get* aliases return the same values as before.
  • Reflection and interface naming were reviewed: Output4Interface/Output6Interface now require to* names, Version4Interface/Version6Interface retain deprecated get* aliases, and getSegments(), getVersion(), and getBinary() remain callable.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
src/Version/IPv4.php Adds toDotAddress() and keeps getDotAddress() as a deprecated forwarding alias.
src/Version/IPv6.php Adds toExpandedAddress() and toCompactedAddress() with deprecated get* aliases.
src/Version/Multi.php Adds toProtocolAppropriateAddress() and toDotAddress() while preserving deprecated aliases.
src/Contracts/Output4Interface.php Renames the IPv4 output contract method to toDotAddress() with an optional formatter.
src/Contracts/Output6Interface.php Renames IPv6 output contract methods to toCompactedAddress() and toExpandedAddress().
src/Version/MultiVersionInterface.php Adds the new protocol-appropriate conversion method to the multi-version interface.
tests/Version/IPv4Test.php Updates IPv4 tests for toDotAddress() and verifies deprecated alias forwarding.
tests/Version/IPv6Test.php Updates IPv6 tests for new conversion names and deprecated alias behavior.
tests/Version/MultiTest.php Updates multi-version tests for new conversion names and alias forwarding.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Caller
participant IP as IPv4/IPv6/Multi
participant Alias as Deprecated get* alias
participant Formatter as ProtocolFormatter

Caller->>IP: toDotAddress()/toCompactedAddress()/toProtocolAppropriateAddress()
IP->>Formatter: ntop(canonical or embedded binary)
Formatter-->>IP: formatted address string
IP-->>Caller: address string

Caller->>Alias: "get*Address(formatter?)"
Alias->>IP: "to*Address(resolved formatter)"
IP-->>Caller: address string
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Caller
participant IP as IPv4/IPv6/Multi
participant Alias as Deprecated get* alias
participant Formatter as ProtocolFormatter

Caller->>IP: toDotAddress()/toCompactedAddress()/toProtocolAppropriateAddress()
IP->>Formatter: ntop(canonical or embedded binary)
Formatter-->>IP: formatted address string
IP-->>Caller: address string

Caller->>Alias: "get*Address(formatter?)"
Alias->>IP: "to*Address(resolved formatter)"
IP-->>Caller: address string
Loading

Reviews (1): Last reviewed commit: "refactor(contracts): 🔨 rename the whole..." | Re-trigger Greptile

@zanbaldwin zanbaldwin merged commit fce31ad into 6.x Jul 3, 2026
25 checks passed
@zanbaldwin zanbaldwin deleted the z/output-renames branch July 3, 2026 14:05
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