Skip to content

Say that custom field overrides replace a property as a whole - #197

Merged
dnnsjsk merged 1 commit into
inline0:mainfrom
Contributolo:docs/custom-fields-overrides-replace
Nov 4, 2026
Merged

dnnsjsk merged 1 commit into
inline0:mainfrom
Contributolo:docs/custom-fields-overrides-replace

Conversation

@Contributolo

Copy link
Copy Markdown
Collaborator

The Overrides section of the custom fields page says that override properties "are merged on top of the original field definition". Both expansions apply an override with a plain array_merge(): Build::expand_custom_fields() in includes/classes/build.php and CustomFieldResolver in packages/phpstan/src/Schema/CustomFieldResolver.php. So an overridden options list is the complete list, and the same holds for conditions and for the attributes of a group; conditions on the reference are still appended afterwards.

"Merged on top" reads like it could be a deep merge, so a reader trying to drop one option or add one condition has to check the source. This adds a short paragraph and an options example to the Overrides section. Nothing else changes; npm run docs:check passes.

Build::expand_custom_fields() and the PHPStan CustomFieldResolver apply an
override with array_merge(), so an overridden options list, conditions list
or group attributes list replaces the original one instead of extending it.
The docs only said the properties are merged on top, which reads like a
deep merge.
@dnnsjsk
dnnsjsk merged commit d3f6679 into inline0:main Nov 4, 2026
@dnnsjsk

dnnsjsk commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Merged and released in 7.7.12, included in ff1b433. The custom-field docs now explain whole-property replacement for overrides, including options, conditions, and nested field lists. Full CI and distribution checks passed. Thanks for the contribution.

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.

2 participants