Load the helper files through Composer autoload instead of a boot stage
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 52/100
Rechercherichtung
Start with composer.json (add the 30 helper paths under autoload.files) and LoadHelpersStage, which currently globs src/*/Helpers and runs require_once on each file; keep only the application and module helper loading there. Add a test that compares the files in src/*/Helpers with the autoload.files list in both directions, then run composer dump-autoload and the test suite. Done when every helper is callable after vendor/autoload.php, the boot no longer scans src/*/Helpers, and the CI checks pass.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
Declare the framework's 30 helper files in autoload.files of composer.json, and stop scanning for them in LoadHelpersStage.
Why
LoadHelpersStagefinds the component helpers on every boot: it scanssrc/*/Helperswithgloband runsrequire_onceon each file. The rootcomposer.jsonhas nofilesentry today.- The helper files are plain function definitions. They have no constants and no code that runs when the file is included, and only two files have guards (the
cron_*functions and thegetallheaderspolyfill), which is the shape Composerfilesexpects. - A static list from Composer replaces about 26 directory scans on every boot, and tools such as PHPStan and IDEs see the functions without booting the application.
- The packages are to be extracted into separate Composer packages from 4.0, each with its own
composer.jsonand its own helpers. If the helpers are already declared withautoload.filesin the monorepo, extraction only moves each package's list into its owncomposer.json.
Scope
- Add the 30 helper files (26 packages:
Apphas 4,Environmenthas 2, every other package has 1) toautoload.filesincomposer.json. - Remove the component part of
LoadHelpersStage. It keeps loading the application'shelpers/and each module'shelpers/, which are the application's own files. - Add a test that fails when a file in
src/*/Helpersis not listed inautoload.files, or when a listed file does not exist. Without it, a new helper file that is not added tocomposer.jsonshows up only as "undefined function". - Update the documentation that describes helper loading at boot (the App architecture page) when this is released.
Notes
- The helpers become available as soon as
vendor/autoload.phpis included, not at boot. They useDSonly inside function bodies, so loading earlier is safe. - Adding a helper file needs an entry in
composer.jsonand acomposer dump-autoload, instead of being picked up by the scan. - When a package is later extracted, the paths in its list may change if its folder layout differs from
src/<Package>/Helpers/.
Out of scope
- Extracting any package.
- Loading the application's and the modules' helpers.
- Changing what any helper function does.
Acceptance criteria
- every helper function is available right after
vendor/autoload.php, without booting the application - the boot no longer scans
src/*/Helpers - the application's and the modules' helpers still load, in the same order after the framework's
- the new test fails for an unlisted helper file
composer test,composer cs:check,composer phpstanandcomposer rector:checkpass on every PHP version in the CI matrix
- 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
-
Raise PHPStan to level 9Offenrefactoring tech debt
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 20/100
quantum-php/framework#693 ·
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
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