Skip to content

docs: align mapping driver examples with their contracts - #529

Merged
greg0ire merged 1 commit into
doctrine:4.2.xfrom
dajiaohuang:docs/mapping-driver-examples-20261017-c7
Oct 18, 2026
Merged

greg0ire merged 1 commit into
doctrine:4.2.xfrom
dajiaohuang:docs/mapping-driver-examples-20261017-c7

Conversation

@dajiaohuang

Copy link
Copy Markdown
Contributor

Problem and change

Several mapping-driver examples in docs/en/reference/index.rst do not match the public driver contracts:

  • JSONFileDriver omits the ClassMetadata import and the required parameter/return types.
  • loadMappingFile() decodes the filename instead of reading its contents, and the locator extension is missing its leading dot.
  • Examples instantiate the ClassMetadata interface instead of using the mapper's metadata implementation.
  • The static-driver example calls $phpDriver rather than $staticPHPDriver and describes file loading rather than User::loadMetadata() dispatch.

Correct the examples and explicitly state that the mapper supplies $classMetadata. This is one documentation page only; no library API, implementation or dependencies change.

Validation

Existing unchanged-base/candidate evidence is reused: PHP 8.3.6 reproduces the original declaration incompatibility; the corrected JSON driver and real FileDriver/locator consumer pass, including filename decoding and extension behavior. Reflection/registry/driver/decorator checks, the real metadata-factory checks and lint of all 36 production PHP files also passed.

Full PHPUnit/PHPStan/PHPCS and documentation generation were not run. The documentation workflow needs PHP 8.4 and a Composer-provided docs builder, absent from the local environment; the exercised library APIs support PHP 8.3. No dependency installation or real ORM/database integration was performed. Normal platform PR checks may run; no CI pass or merge-readiness claim is made.

@GromNaN GromNaN left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you @dajiaohuang

@GromNaN GromNaN added this to the 4.2.2 milestone Oct 17, 2026
@greg0ire
greg0ire merged commit adddf85 into doctrine:4.2.x Oct 18, 2026
12 checks passed
@greg0ire

Copy link
Copy Markdown
Member

Thanks @dajiaohuang !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants