Skip to content

Commit

Permalink
Remove parameters in ApplicationRunner methods runBootstrap() and…
Browse files Browse the repository at this point in the history
… `checkEvents()` (#37)
  • Loading branch information
vjik committed Jan 12, 2023
1 parent 53ee5aa commit 2ebd731
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,8 @@

## 2.0.0 under development

- Сhg #37: Remove parameters in `ApplicationRunner` methods `runBootstrap()` and `checkEvents()`, instead are used
internal container and config instances (@vjik)
- Chg #36: Add ability to configure container configuration group (@vjik)

## 1.2.1 November 07, 2022
Expand Down
10 changes: 5 additions & 5 deletions src/ApplicationRunner.php
Expand Up @@ -116,23 +116,23 @@ public function withContainer(ContainerInterface $container): static
/**
* @throws ErrorException|RuntimeException
*/
protected function runBootstrap(ConfigInterface $config, ContainerInterface $container): void
protected function runBootstrap(): void
{
if ($this->bootstrapGroup !== null) {
(new BootstrapRunner($container, $config->get($this->bootstrapGroup)))->run();
(new BootstrapRunner($this->getContainer(), $this->getConfig()->get($this->bootstrapGroup)))->run();
}
}

/**
* @throws ContainerExceptionInterface|ErrorException|NotFoundExceptionInterface
*/
protected function checkEvents(ConfigInterface $config, ContainerInterface $container): void
protected function checkEvents(): void
{
if ($this->debug && $this->eventsGroup !== null) {
/** @psalm-suppress MixedMethodCall */
$container
$this->getContainer()
->get(ListenerConfigurationChecker::class)
->check($config->get($this->eventsGroup));
->check($this->getConfig()->get($this->eventsGroup));
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/ApplicationRunnerTest.php
Expand Up @@ -124,7 +124,7 @@ public function testRunBootstrap(): void

$this->expectOutputString('Bootstrapping');

$runner->runBootstrap($this->createConfig(), $this->createContainer());
$runner->runBootstrap();
}

public function testCheckEvents(): void
Expand All @@ -135,7 +135,7 @@ public function testCheckEvents(): void

$this->expectException(InvalidListenerConfigurationException::class);

$runner->checkEvents($config, $container);
$runner->checkEvents();
}

public function testRun(): void
Expand Down
12 changes: 6 additions & 6 deletions tests/Support/ApplicationRunner/ApplicationRunner.php
Expand Up @@ -20,18 +20,18 @@ public function run(): void
{
$config = $this->getConfig();
$container = $this->getContainer();
$this->runBootstrap($config, $container);
$this->checkEvents($config, $container);
$this->runBootstrap();
$this->checkEvents();
}

public function runBootstrap(ConfigInterface $config, ContainerInterface $container): void
public function runBootstrap(): void
{
parent::runBootstrap($config, $container);
parent::runBootstrap();
}

public function checkEvents(ConfigInterface $config, ContainerInterface $container): void
public function checkEvents(): void
{
parent::checkEvents($config, $container);
parent::checkEvents();
}

public function getConfig(): ConfigInterface
Expand Down

0 comments on commit 2ebd731

Please sign in to comment.