Introduce new type-safe methods for receiving config section values#24404
Merged
Introduce new type-safe methods for receiving config section values#24404
Conversation
caddoo
previously approved these changes
Apr 21, 2026
Contributor
caddoo
left a comment
There was a problem hiding this comment.
A nice change, just a comment.
How can we encourage using the specially typed functions though going forward?
And move away from people using getConfigValue
Member
Author
|
@caddoo I considered marking the method as |
mneudert
approved these changes
Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This changes the section config helpers to support typed access with optional typed defaults, and updates existing manual-cast call sites to use those helpers while preserving previous behavior.
What changed
SectionConfig now provides typed getters for config values:
getIntegerConfigValue(string $name, ?int $default = null, ?int $idSite = null): ?intgetFloatConfigValue(string $name, ?float $default = null, ?int $idSite = null): ?floatgetBoolConfigValue(string $name, ?bool $default = null, ?int $idSite = null): ?boolgetStringConfigValue(string $name, ?string $default = null, ?int $idSite = null): ?stringgetArrayConfigValue(string $name, ?array $default = null, ?int $idSite = null): ?arrayBehavior:
TrackerConfig was refactored to extend SectionConfig, while keeping the
use_third_party_id_cookiespecial handling.Existing call sites that previously did manual casts on GeneralConfig, DatabaseConfig, or TrackerConfig were updated to use the typed getters instead. Where the old code relied on PHP cast fallback behavior, explicit defaults were added so behavior stays the same:
(int)casts now pass0(bool)/!!casts now passfalse(string)casts now pass''Why
This avoids repeating ad-hoc casts throughout the codebase, makes the expected type explicit at the config access point, and centralizes invalid-value handling and logging.
Notes
The migrated call sites were reviewed to preserve previous semantics. In particular, places that previously depended on PHP cast behavior now pass explicit defaults instead of implicitly returning null.
Checklist
Review