Skip to content

Commit 53cd0d2

Browse files
Remove class validation
Do not validate the config on creation. This has some negative implications for config handling without propper bootstrapping. Since we do not want to depend on bootstrapping just because we handle the configuration the validation is removed. The validation still takes place during the actual plugin creation inside the hook runner. Fixes issue #307
1 parent 1c8a351 commit 53cd0d2

3 files changed

Lines changed: 0 additions & 17 deletions

File tree

src/Config/Plugin.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111

1212
namespace CaptainHook\App\Config;
1313

14-
use CaptainHook\App\Exception\InvalidPlugin;
15-
use CaptainHook\App\Plugin\CaptainHook;
16-
1714
/**
1815
* Class Plugin
1916
*
@@ -46,10 +43,6 @@ class Plugin
4643
*/
4744
public function __construct(string $plugin, array $options = [])
4845
{
49-
if (!is_a($plugin, CaptainHook::class, true)) {
50-
throw new InvalidPlugin("{$plugin} is not a valid CaptainHook plugin.");
51-
}
52-
5346
$this->plugin = $plugin;
5447
$this->setupOptions($options);
5548
}

src/Console/Command/Info.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
100100

101101
$this->determineVerbosity($output, $config);
102102

103-
BootstrapUtil::handleBootstrap($config, $this->resolver);
104-
105103
$editor = new Reader($io, $config, $repo);
106104
$editor->setHook(IOUtil::argToString($input->getArgument('hook')))
107105
->display(Reader::OPT_ACTIONS, $input->getOption('list-actions'))

tests/unit/Config/PluginTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,4 @@ public function testPopulatedOptions(): void
5858

5959
$this->assertSame(['foo' => 'bar'], $config['options']);
6060
}
61-
62-
public function testThrowsExceptionForInvalidPlugin(): void
63-
{
64-
$this->expectException(InvalidPlugin::class);
65-
$this->expectExceptionMessage('\\Foo\\Bar is not a valid CaptainHook plugin.');
66-
67-
new Plugin('\\Foo\\Bar');
68-
}
6961
}

0 commit comments

Comments
 (0)