Skip to content

Apply responsibility-based coding style and alias conventions - #20

Merged
gachakra merged 1 commit into
mainfrom
chore/apply-coding-style
Dec 3, 2026
Merged

gachakra merged 1 commit into
mainfrom
chore/apply-coding-style

Conversation

@gachakra

@gachakra gachakra commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Apply the constructor-first, responsibility-based method order from Separate Composer and PHP development services #19 to native enum extensions, collections, composites and traits.
  • Keep cohesive lookup, mapping, selection and iteration families together.
  • Define forwarding alias and projection documentation conventions. Preserve historical Class-based methods and their relative order; group only the nine new methods from Unify mapping and qualified formatting APIs #18 at the end of the class. Use @see for forwarding aliases and concrete examples for projections.
  • Adjust selected Native examples, test fixture alignment and README snippets; retain existing bit-flag expressions, weak-typing fixtures and historical documentation.

Scope and verification

No intentional changes to signatures, method bodies, dependencies or runtime contracts. For the five reordered native source files and Class-based Enum, the authoring check compared method bodies before and after reordering. All pre-existing Class-based method blocks (including PHPDoc) were also compared in their original relative order. Automated formatting tools are not introduced. No PHP execution tests have been run in the authoring environment; CI and independent review are pending. Review method ordering, whitespace-only changes, PHPDoc and README examples, and ensure static-analysis checks still pass after line-number changes.

@gachakra gachakra left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Independently reviewed 666f380c30cfef80fd0ede35348a535bbec220d8 against dd89613ed1168a5ffe0a4a66c2675b41d56d5e92. No actionable findings.

  • Method organization and layout. Constructors lead the affected classes where declared. The native collections keep lookup, mapping by source, selection, and lazy iteration families together. Direct access and basic metadata precede derived representations where that order fits the class. Predicates and magic methods follow their corresponding operation groups. I checked declaration and assignment alignment, nested match arms, and blank lines where they mark changes in responsibility.
  • Aliases and projections. The seven Class-based forwarding aliases link to their originals with @see and retain applicable return shapes, exceptions, and compatibility notes. The two projections, qualifiedNames() and valueToName(), describe their distinct results and include concrete examples. I exercised all nine methods and checked their types with PHPStan, including map keys and custom delimiters in the runtime checks.
  • Historical API and compatibility. All 40 pre-#18 Class-based method blocks, including PHPDoc and implementation, match byte-for-byte in their original relative order. The nine methods introduced in #18 are the final method group. Beyond declaration placement and insignificant whitespace, I found no executable token or signature differences in 236 methods across 16 changed PHP files. The three changed README PHP snippets also preserve their executable content. Reflection exposes the intended declaration-order change for reordered methods.
  • Independent verification. PHP 8.4.28 and 8.5.13 each passed 369 PHPUnit tests with 1,577 assertions, all 25 executable examples with assertions enabled, PHPStan 2.3.7 CI checks, the targeted alias and projection type checks, PHP lint, and the Composer metadata, platform, and strict PSR-4 checks. Both distribution archive checks passed. The selection fixture retained its 13 expected diagnostics.

@gachakra
gachakra marked this pull request as ready for review December 3, 2026 08:38
@gachakra
gachakra merged commit b7eb3d5 into main Dec 3, 2026
2 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