Raise PHPStan to level 9
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 20/100
- Tipo di issue
- Refactoring
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- php
- Ambito
- developer-experience, tooling
Direzione di ricerca
Run composer phpstan to reproduce the level 8 baseline, then temporarily set level: 9 in phpstan.neon.dist to see the 581 errors grouped per file. Start with the Di facade (Quantum\Di\Di): give its @method tags generic class-string<T>-in / T-out signatures, which clears the 49 errors from DiContainer::get() and create(). After that the work splits by package (Mailer, Database, Console, Storage, Lang, Http, Auth) into array shapes, typed accessors such as Config::getString()/getArray() next to getBool()/getInt(), and checks where mixed values enter. Done means the analysis is clean at level 9 with no baseline, tests green, and only then the level bumped in phpstan.neon.dist.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Raise the static analysis of src/ from PHPStan level 8 to level 9, which treats mixed strictly: a value of type mixed can no longer be used as a string, array or object without being checked or typed first.
Current state
composer phpstan passes at level 8. At level 9 it reports 581 errors in 151 files (PHPStan 2.3.7). They come from four sources:
- The
Difacade returnsmixed.DiContainer::get()andcreate()are generic (class-string<T>in,Tout), but the@methodtags of the static facadeQuantum\Di\Dideclaremixed, so every call on a service fetched throughDi::get()is a call onmixed. Generic@methodtags fix 49 errors. - Arrays without a shape. Config arrays (
$this->config['session']['remember_lifetime']), mail addresses ($address['email']), table column definitions and console argument lists are typed as plainarray, so every read returnsmixed. They need array shapes (array{email: string, name: string}) or a value object. - Values that are
mixedby nature:config()->get(),$_SERVER, Symfony'sInputInterface::getOption()andgetArgument(),json_decode()and remote API responses. They need a check where they enter the code, or typed accessors such asConfig::getString()andConfig::getArray()next to the existinggetBool()andgetInt(). - Single cases: casts and returns of
mixedvalues.
Most errors are in Mailer (81), Database (79), Console (56), Storage (48), Lang (41), Http (37) and Auth (34).
Approach
- Generic
@methodtags on theDifacade. - Typed config accessors, if the review agrees.
- One checkpoint per package (or a few small packages together): array shapes, checks at the entry of
mixedvalues, no behaviour change. - Raise
levelinphpstan.neon.distto 9 in the last checkpoint, when the analysis is clean; CI stays on level 8 until then. No baseline file and no@phpstan-ignorefor real type gaps.
Every checkpoint keeps the tests green and adds tests where a check changes behaviour (for example a config value of the wrong type).
Out of scope
- Level 10 (implicit
mixedfrom missing types). - The tests in
tests/, which PHPStan does not analyse.
- Lingua principale
- PHP
- Stelle
- 43
- Fork
- 22
- Merge medio
- 54m
- PR unite (30g)
- 57
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
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/framework
-
bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
quantum-php/framework#692 ·
I maintainer di solito rispondono entro 1 giorno
-
routing testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
quantum-php/framework#547 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
quantum-php/framework#694 ·
I maintainer di solito rispondono entro 1 giorno
-
install:debugbar reads the package folder from the working directory and uses the default storage adapterForse già presa @armanist l’ha presa oggi. Apertabug console debugbar good first issue
quantum-php/framework#691 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
console enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 74/100
quantum-php/framework#688 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di quantum-php/framework
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 70/100
ajeetraina/awesome-docker-sbx#559 ·
-
dependencies enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
novalo-dev/Prestashop-MCP-Server#329 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
I maintainer di solito rispondono entro 1 giorno
-
bug origin:interactive status:available
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
Ultimate-Multisite/ultimate-multisite#2131 ·
I maintainer di solito rispondono entro 1 giorno
-
sync-en
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno