load WyriHaximus/TwigView Plugin through new way#454
Conversation
|
now it works with both way if (!Plugin::loaded('WyriHaximus/TwigView')) {
Plugin::load('WyriHaximus/TwigView', ['bootstrap' => true]);
}runs and when user uses there is not conflict between 2 way |
Codecov Report
@@ Coverage Diff @@
## master #454 +/- ##
============================================
- Coverage 94.27% 94.18% -0.09%
- Complexity 689 690 +1
============================================
Files 27 27
Lines 2200 2202 +2
============================================
Hits 2074 2074
- Misses 126 128 +2
Continue to review full report at Codecov.
|
src/Plugin.php
Outdated
| if (!CorePlugin::getCollection()->has('WyriHaximus/TwigView')) { | ||
| $app->addPlugin('WyriHaximus/TwigView', ['bootstrap' => false]); | ||
| $plugin = CorePlugin::getCollection()->get('WyriHaximus/TwigView'); | ||
| $plugin->bootstrap($app); |
There was a problem hiding this comment.
Why are you disabling the bootstrap hook when calling addPlugin() but then calling it here?
There was a problem hiding this comment.
just for ensuring that bootstrap() calls correctly
I had a problem with pluginbootstrap here cakephp/cakephp@cbe166dbbc
and we can not calls pluginBootstrap(); again to cover new plugins
There was a problem hiding this comment.
There was a problem hiding this comment.
Ok. Previously when I did testing the iterator implementation in PluginCollection allowed newly added plugins to be part of the loop without requiring additional loops. Perhaps I broke something in the meantime.
src/Plugin.php
Outdated
| */ | ||
| public function bootstrap(PluginApplicationInterface $app) | ||
| { | ||
| if (!$app->getPlugins()->has('WyriHaximus/TwigView')) { |
There was a problem hiding this comment.
PHPstan is sad about getPlugins(). I'm not sure we need this check. It should be safe to always add the plugin.
No description provided.