Skip to content

Document PHPStan meta() return-type extension usage#167

Merged
voku merged 1 commit intomasterfrom
copilot/update-readme-custom-phpstan-extension
Apr 30, 2026
Merged

Document PHPStan meta() return-type extension usage#167
voku merged 1 commit intomasterfrom
copilot/update-readme-custom-phpstan-extension

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 30, 2026

The README template did not explain how consumers can enable PHPStan support for YourArrayySubclass::meta(). This left the custom return-type extension discoverable in the codebase, but not in the published docs.

  • What changed

    • Added a focused section to the PHPDoc array-shape / property-checking docs in build/docs/base.md.
    • Regenerated README.md so the published documentation includes the same guidance.
  • PHPStan integration

    • Documents when the extension is useful: projects that use meta() with PHPStan and want literal-string/object-shape inference for meta keys.
    • Explains the practical effect: expressions like $userMeta->id resolve to 'id', nested meta-key access stays typed, and invalid properties such as $userMeta->ghost can be reported.
  • Consumer setup

    • Adds the PHPStan service registration snippet needed to enable Arrayy\PHPStan\MetaDynamicStaticMethodReturnTypeExtension.
    • Clarifies that the repository’s own phpstan.neon is not shipped with the Composer package, so users should copy the service definition into their project config.
services:
    -
        class: Arrayy\PHPStan\MetaDynamicStaticMethodReturnTypeExtension
        tags:
            - phpstan.broker.dynamicStaticMethodReturnTypeExtension

This change is Reviewable

Agent-Logs-Url: https://github.com/voku/Arrayy/sessions/650b49fa-7eca-4322-b5df-f8c896c5ce8a

Co-authored-by: voku <264695+voku@users.noreply.github.com>
@voku voku marked this pull request as ready for review April 30, 2026 14:13
@voku voku merged commit 57c7fca into master Apr 30, 2026
5 of 14 checks passed
@sonarqubecloud
Copy link
Copy Markdown

@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 92.079% (-0.3%) from 92.38% — copilot/update-readme-custom-phpstan-extension into master

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.

3 participants