spiral / framework

High-Performance PHP Framework
https://spiral.dev
MIT License
1.8k stars 87 forks source link

[spiral/prototype] Initialize PrototypeRegistry only when registry requires from container #1005

Closed msmakouz closed 11 months ago

msmakouz commented 11 months ago
Q A
Bugfix?
Breaks BC?
New feature? ✔️

This Pull Request improves the way Spiral\Prototype\PrototypeRegistry initializes. Previously, it was initialized upon application bootstrap, even when not in use, leading to inefficient resource consumption. The change introduced Spiral\Prototype\Config\PrototypeConfig, which serves as a central configuration file for managing bindings. Third-party packages can now easily contribute their own bindings to this configuration via bootloader.

The PrototypeRegistry is now created only when first requested from the container and utilizes the bindings defined in PrototypeConfig.

codecov[bot] commented 11 months ago

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (67363ef) 89.40% compared to head (6c607b6) 89.14%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1005 +/- ## ============================================ - Coverage 89.40% 89.14% -0.27% - Complexity 6122 6124 +2 ============================================ Files 811 812 +1 Lines 17314 17312 -2 ============================================ - Hits 15480 15433 -47 - Misses 1834 1879 +45 ``` | [Files](https://app.codecov.io/gh/spiral/framework/pull/1005?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spiral) | Coverage Δ | | |---|---|---| | [src/Prototype/src/Annotation/Line.php](https://app.codecov.io/gh/spiral/framework/pull/1005?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spiral#diff-c3JjL1Byb3RvdHlwZS9zcmMvQW5ub3RhdGlvbi9MaW5lLnBocA==) | `0.00% <ø> (-60.00%)` | :arrow_down: | | [src/Prototype/src/Annotation/Parser.php](https://app.codecov.io/gh/spiral/framework/pull/1005?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spiral#diff-c3JjL1Byb3RvdHlwZS9zcmMvQW5ub3RhdGlvbi9QYXJzZXIucGhw) | `0.00% <ø> (-90.48%)` | :arrow_down: | | [...c/Prototype/src/Bootloader/PrototypeBootloader.php](https://app.codecov.io/gh/spiral/framework/pull/1005?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spiral#diff-c3JjL1Byb3RvdHlwZS9zcmMvQm9vdGxvYWRlci9Qcm90b3R5cGVCb290bG9hZGVyLnBocA==) | `92.85% <100.00%> (+1.42%)` | :arrow_up: | | [src/Prototype/src/Command/AbstractCommand.php](https://app.codecov.io/gh/spiral/framework/pull/1005?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spiral#diff-c3JjL1Byb3RvdHlwZS9zcmMvQ29tbWFuZC9BYnN0cmFjdENvbW1hbmQucGhw) | `100.00% <100.00%> (ø)` | | | [src/Prototype/src/Command/InjectCommand.php](https://app.codecov.io/gh/spiral/framework/pull/1005?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spiral#diff-c3JjL1Byb3RvdHlwZS9zcmMvQ29tbWFuZC9JbmplY3RDb21tYW5kLnBocA==) | `87.23% <100.00%> (ø)` | | | [src/Prototype/src/Command/ListCommand.php](https://app.codecov.io/gh/spiral/framework/pull/1005?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spiral#diff-c3JjL1Byb3RvdHlwZS9zcmMvQ29tbWFuZC9MaXN0Q29tbWFuZC5waHA=) | `80.00% <100.00%> (ø)` | | | [src/Prototype/src/Config/PrototypeConfig.php](https://app.codecov.io/gh/spiral/framework/pull/1005?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spiral#diff-c3JjL1Byb3RvdHlwZS9zcmMvQ29uZmlnL1Byb3RvdHlwZUNvbmZpZy5waHA=) | `100.00% <100.00%> (ø)` | | | [src/Prototype/src/PrototypeLocatorListener.php](https://app.codecov.io/gh/spiral/framework/pull/1005?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spiral#diff-c3JjL1Byb3RvdHlwZS9zcmMvUHJvdG90eXBlTG9jYXRvckxpc3RlbmVyLnBocA==) | `90.00% <100.00%> (ø)` | | | [src/Prototype/src/Traits/PrototypeTrait.php](https://app.codecov.io/gh/spiral/framework/pull/1005?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spiral#diff-c3JjL1Byb3RvdHlwZS9zcmMvVHJhaXRzL1Byb3RvdHlwZVRyYWl0LnBocA==) | `100.00% <ø> (ø)` | | | [src/Reactor/src/FileDeclaration.php](https://app.codecov.io/gh/spiral/framework/pull/1005?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spiral#diff-c3JjL1JlYWN0b3Ivc3JjL0ZpbGVEZWNsYXJhdGlvbi5waHA=) | `100.00% <100.00%> (ø)` | | | ... and [1 more](https://app.codecov.io/gh/spiral/framework/pull/1005?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spiral) | | ... and [4 files with indirect coverage changes](https://app.codecov.io/gh/spiral/framework/pull/1005/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=spiral)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.