Environment: empty .env values give the default, the new traits and updateRow() (3.2.0)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 75/100
- Tipo di issue
- Documentazione
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- php
- Ambito
- documentation
Direzione di ricerca
Read the 3.2.x Environment code and the current docs under v3.0/packages/environment/, plus v3.0/upgrade-guide.md; the issue names the sections and line ranges to update. Check the Config typed reader contract alongside Environment so their behavior and cross-links agree. Update the docs for the empty-value defaults, traits, updateRow() behavior, and upgrade steps; done when every statement matches the code and the grep check includes ValueTrait and EnvFileTrait.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Framework 3.2.0 changes the Environment package (quantum-php/framework#709):
env_bool()andenv_int()(environment()->getBool()/getInt()) treat an empty value,KEY=or aKEYline without=, as not set and return the default. They gavefalseor threwEnvException::invalidValue(). This is a breaking change:TWO_FA=withenv_bool('TWO_FA', true)now leaves two-factor authentication on;TWO_FA=falseturns it off.env()still returns the raw value.Environmentloads the.envfile itself;ReadTrait(renamed fromValueTrait) reads and the newWriteTraitwrites (updateRow());EnvFileTraitis removed.updateRow()finds the key and its value as the file has them (KEY="…", also over several lines,KEY='…',KEY=value,KEYwithout=), keeps a comment after the value, writes the new value as it is given ($and\included), and throwsEnvException::fileNotFound()instead of writing an empty file when the replacement fails. A line it cannot find as it was read, such asexport KEY=value, is left unchanged.
The docs still describe the old traits and say an empty value gives false.
Changes
- Environment package (
v3.0/packages/environment/):overview.md:16: the traits areAppEnvTrait,ReadTraitandWriteTrait.architecture.md:27-33, "HowEnvironmentis organised":Environmentholds its state,load()and the file lookup and parsing;ReadTraitthe readers;WriteTraitupdateRow().:60-62, "Mutation model": howupdateRow()finds the line, keeps a comment, and what it leaves unchanged.contracts.md:21-33, "Typed reader contract": an empty value (''ornull) is not set and gives the default; a missing key without a default givesfalse/0.:49-58, "Mutability contract": theupdateRow()guarantees above, andfileNotFound()when the replacement fails.helpers.md:32-56:env_bool()/env_int()return the default for an empty value.usage.md:23, "Reading booleans and numbers": an empty value gives the default (it saysfalsetoday), with theTWO_FA=example.
- The env and config readers differ on purpose:
.envis outside input and often incomplete, soenv_bool()/env_int()are forgiving (a missing or empty value gives the default, orfalse/0), whileconfig()->getBool()/getInt()without a default state a required key and throwConfigException::missingKey(). Both pages say this in the same words and link to each other:environment/contracts.md, "Typed reader contract", with a link to the Config typed reader contract;config/contracts.md:76-90, "Typed reader contract", with a link to the Environment typed reader contract.
v3.0/upgrade-guide.md, "Upgrading from 3.1 to 3.2": a new section before "Check the upgrade" on empty.envvalues (theTWO_FA=example andTWO_FA=false), the renamed and removed traits (a class of your own that usedValueTraitorEnvFileTrait), and whatupdateRow()now replaces; the check grep also looks forValueTraitandEnvFileTrait.
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#709, PR quantum-php/framework#710, merge-up quantum-php/framework#711
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 3
- Fork
- 1
- Merge medio
- 2m
- PR unite (30g)
- 27
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di quantum-php/docs
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
quantum-php/docs#196 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
quantum-php/docs#190 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
quantum-php/docs#187 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 3/5 1-2 giorni Idoneità per principianti 63/100
quantum-php/docs#192 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
quantum-php/docs#185 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di quantum-php/docs
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
google/elephant-goldfish-model#586 ·
I maintainer di solito rispondono entro 2 giorni
-
documentation Entwickler
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 89/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
memtomem/memtomem-stm#1657 ·
I maintainer di solito rispondono entro 1 giorno
-
Help with the docsApertadocumentation good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
lightninglabs/layertree#28 ·