Skip to content

load WyriHaximus/TwigView Plugin through new way#454

Merged
markstory merged 3 commits intomasterfrom
plugin-load
Jul 6, 2018
Merged

load WyriHaximus/TwigView Plugin through new way#454
markstory merged 3 commits intomasterfrom
plugin-load

Conversation

@saeideng
Copy link
Copy Markdown
Member

@saeideng saeideng commented Jul 1, 2018

No description provided.

@saeideng saeideng added this to the 1.8.0 milestone Jul 1, 2018
@saeideng
Copy link
Copy Markdown
Member Author

saeideng commented Jul 1, 2018

now it works with both way
when user uses Plugin::load('Bake');

         if (!Plugin::loaded('WyriHaximus/TwigView')) {
             Plugin::load('WyriHaximus/TwigView', ['bootstrap' => true]);
         }

runs

and when user uses $this->addPlugin('Bake'); , bootstrap hook

there is not conflict between 2 way

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 1, 2018

Codecov Report

Merging #454 into master will decrease coverage by 0.08%.
The diff coverage is 0%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
src/Shell/BakeShell.php 84.44% <ø> (ø) 41 <0> (ø) ⬇️
src/Plugin.php 33.33% <0%> (-66.67%) 2 <1> (+1)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 73073c2...8867c1a. Read the comment docs.

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);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you disabling the bootstrap hook when calling addPlugin() but then calling it here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed

@markstory markstory self-assigned this Jul 2, 2018
src/Plugin.php Outdated
*/
public function bootstrap(PluginApplicationInterface $app)
{
if (!$app->getPlugins()->has('WyriHaximus/TwigView')) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHPstan is sad about getPlugins(). I'm not sure we need this check. It should be safe to always add the plugin.

@markstory markstory merged commit b57ff1d into master Jul 6, 2018
@markstory markstory deleted the plugin-load branch July 6, 2018 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants