Raise PHPStan to level 9
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 20/100
- Issue-Typ
- Refactoring
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- php
- Bereich
- developer-experience, tooling
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- PHP
- Sterne
- 43
- Forks
- 22
- Ø Merge
- 54 Min.
- Gemergte PRs (30 T.)
- 57
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus quantum-php/framework
-
bug good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
quantum-php/framework#692 ·
Maintainer antworten meist innerhalb von 1 Tag
-
routing testing
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
quantum-php/framework#547 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 72/100
quantum-php/framework#694 ·
Maintainer antworten meist innerhalb von 1 Tag
-
install:debugbar reads the package folder from the working directory and uses the default storage adapterEvtl. vergeben @armanist hat das heute übernommen. Offenbug console debugbar good first issue
quantum-php/framework#691 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
console enhancement
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 74/100
quantum-php/framework#688 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in quantum-php/framework
Ähnliche Issues
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 70/100
ajeetraina/awesome-docker-sbx#559 ·
-
dependencies enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
novalo-dev/Prestashop-MCP-Server#329 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug origin:interactive status:available
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
Ultimate-Multisite/ultimate-multisite#2131 ·
Maintainer antworten meist innerhalb von 1 Tag
-
sync-en
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag