-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lazy definition #58
base: master
Are you sure you want to change the base?
Lazy definition #58
Conversation
xepozz
commented
Nov 20, 2022
Q | A |
---|---|
Is bugfix? | ❌ |
New feature? | ✔️ |
Breaks BC? | ❌ |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #58 +/- ##
============================================
+ Coverage 98.43% 99.55% +1.11%
- Complexity 230 243 +13
============================================
Files 14 17 +3
Lines 510 667 +157
============================================
+ Hits 502 664 +162
+ Misses 8 3 -5 ☔ View full report in Codecov by Sentry. |
Tests fail because of |
Need README update describing the feature and when it should be useful. |
And a CHANGELOG entry. |
# Conflicts: # src/DynamicReferencesArray.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also need:
- fix static analysis;
- add classes from new optional dependency to composer require checker configuration for ignore;
- add lines to changelog (new definition and change normalizier behavior)
Co-authored-by: Sergei Predvoditelev <sergei@predvoditelev.ru>
It remains only to add information to changelog. |
# Conflicts: # .github/workflows/build.yml # .github/workflows/mutation.yml # tests/Unit/Helpers/DefinitionResolverTest.php # tests/Unit/Helpers/DefinitionValidatorTest.php
Suggestion for lazy definition
@mougrim Yeah. Testing it. |
@samdark I've got error:
Maybe need to add some fix to \Yiisoft\Definitions\Helpers\DefinitionValidator::isValidObject, like:
|
@xepozz can you take a look? |
Quite the same trace, if I use lazy-services from yiisoft/di:
I'm using the following config: MyClass::class => new LazyDefinition(
MyClass::class,
MyClass::class,
), |
@xepozz, thank you! MyClass::class => new LazyDefinition(
[ArrayDefinition::CLASS_NAME => MyClass::class],
MyClass::class,
), And got the same error:
Maybe I do something wrong. Array-like definition is working 👍 : MyClass::class => [
'lazy' => true,
], But if I forgot to install friendsofphp/proxy-manager-lts, then I got error:
Maybe better to show suggestion about installing friendsofphp/proxy-manager-lts. |
MyClass::class => new LazyDefinition(
[ArrayDefinition::CLASS_NAME => MyClass::class],
MyClass::class,
), It's the way if you want to use laziness directly with the
Hmm, it must be shown https://github.com/yiisoft/definitions/pull/58/files#diff-d2ab9925cad7eac58e0ff4cc0d251a937ecf49e4b6bf57f8b95aab76648a9d34R42-R44 |
Yes, but if you don't need lazy at once, you don't install suggested dependency.
So, you could check if validation is enabled:
Anyway I think it's not critical. |