Load the helper files through Composer autoload instead of a boot stage
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- PHP
- スター
- 43
- フォーク
- 22
- 平均マージ
- 54分
- マージ済み PR(30日)
- 57
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
quantum-php/framework のほかの issue
-
bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
quantum-php/framework#692 ·
メンテナーはふだん 1 日以内に返信
-
routing testing
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
quantum-php/framework#547 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
quantum-php/framework#694 ·
メンテナーはふだん 1 日以内に返信
-
refactoring tech debt
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
quantum-php/framework#693 ·
メンテナーはふだん 1 日以内に返信
-
install:debugbar reads the package folder from the working directory and uses the default storage adapter対応中かも @armanist が今日担当しました。 オープンbug console debugbar good first issue
quantum-php/framework#691 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
quantum-php/framework の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 70/100
ajeetraina/awesome-docker-sbx#559 ·
-
dependencies enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
novalo-dev/Prestashop-MCP-Server#329 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信
-
bug origin:interactive status:available
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Ultimate-Multisite/ultimate-multisite#2131 ·
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信