Config sections for adapters, and Config::all() returning an array (3.2.0)

Aberta
#192 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
63/100
Tipo de issue
Documentação
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
markdown, php
Domínio
documentation

Direção de pesquisa

Start from v3.0/packages/config/contracts.md, the "Typed reader contract" and section() entries, and check each claim against the 3.2.x code before editing. Then work through overview.md, architecture.md, usage.md, v3.0/advanced-features/configuration.md, the adapter pages listed (renderer, logger, mailer, cache, ratelimit, session, lang, auth) and the new 3.1-to-3.2 section in v3.0/upgrade-guide.md. Done when every cited line matches the released 3.2 behaviour and the upgrade-guide grep also covers ValueTrait, ConfigFileTrait and ->all()->.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

documentation

Summary

Framework 3.2.0 gives adapters their settings as a read-only Quantum\Config\ConfigSection instead of an array (quantum-php/framework#672). config()->section('cache.redis') returns one; Config and ConfigSection read with the same code (ReadTrait, TypedValuesTrait), and only Config loads and changes values (WriteTrait, renamed from ValueTrait; ConfigFileTrait is folded into Config). Config::all() returns an array instead of the Data object. Adapters read ports, TTLs and lifetimes as whole numbers, so text such as '600' works and 'abc' throws a ConfigException; a missing cache or rate limit ttl or port throws, and the auth adapters require their config. getBool() and getInt() without a default require the key, and empty text (such as KEY= in .env) counts as not set. The docs still describe the arrays, all(): ?Data, the old traits and the old typed reader defaults.

Changes

  1. Config package (v3.0/packages/config/):
    • overview.md:51: the traits are ReadTrait, WriteTrait and TypedValuesTrait; mention ConfigSection.
    • architecture.md:13, :19-21: all() returns an array; the trait list (no ConfigFileTrait, ValueTrait is WriteTrait, the new ReadTrait is shared with ConfigSection).
    • contracts.md:66-68, :102: all(): array, [] when empty (not null); add the section() and ConfigSection contract (read-only, empty for a missing or non-array key, keeps its values, arrays copied and objects shared); set() with a dotted key on an empty config nests the value.
    • contracts.md:70-86, "Typed reader contract": the signatures are getBool(string $key, ?bool $default = null) and getInt(string $key, ?int $default = null); a key that is missing, null or empty text is not set; not set returns the default when one is given and throws ConfigException::missingKey() when none is given; getBool() no longer reads an empty value as false, and getInt() no longer throws invalidValue() for it.
    • usage.md: a short section on reading a slice with config()->section(...); in "Reading booleans and numbers" (:41-48), the example config()->getBool('app.debug') and the text "both return the default: false and 0 unless you pass another" change to the required-key rule, with a default passed for optional keys.
  2. v3.0/advanced-features/configuration.md:32: all() returns an array, not a dot-accessible object.
  3. Adapter config pages, the adapter receives a ConfigSection, and numbers are whole numbers:
    • renderer/adapters.md:25, :63, :76: no more "config array"; Twig receives the section's all().
    • logger/architecture.md:36, mailer/architecture.md:33: "constructor parameters" become the adapter's config section.
    • cache/adapters.md (ttl, port) and ratelimit/adapters.md (ttl, port): text works, other text throws, a missing ttl throws.
    • session/adapters.md:20 (timeout), lang/usage.md:131-145 (cache.ttl), auth/adapters.md:34 (remember_lifetime), auth/usage.md:61 (otp_expires): read as whole numbers, defaults kept when missing.
    • mailer/adapters.md (SMTP): port is a whole number; a missing or empty port uses 25.
    • auth/adapters.md, auth/usage.md: two_fa, otp_expires and session.remember_lifetime are read when the adapter is built, so an invalid value fails there, also with two-factor authentication off; an adapter of your own that uses AuthTrait implements readConfig(ConfigSection $config).
  4. v3.0/upgrade-guide.md, "Upgrading from 3.1 to 3.2": a new section before "Check the upgrade" on code that builds adapters itself (new RedisAdapter(new ConfigSection([...]))), values that now throw, config()->all() returning an array, ConfigInterface, the renamed and removed traits, LoggerTrait::initialize(ConfigSection $config), AuthTrait's readConfig(), the required auth config, and getBool()/getInt() without a default requiring the key (empty text counts as not set); the check grep also looks for ValueTrait, ConfigFileTrait and ->all()->.

Every statement is checked against the 3.2.x code. The changes wait in staging until 3.2.0 is released.

Related

  • quantum-php/framework#672, PR quantum-php/framework#706, merge-up quantum-php/framework#708

Updated 2026-11-25 to the final code of PR #706: the typed reader rules, the SMTP port default, and the auth settings read when the adapter is built.

Linguagem predominante
Sem dados de linguagem
Estrelas
3
Forks
1
Merge médio
2min
PRs com merge (30d)
27

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de quantum-php/docs

Todas as issues de quantum-php/docs

Issues semelhantes

Mais issues de Documentation

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.