Skip to content

Commit

Permalink
Merge pull request #151 from boesing/bugfix/laminas-cli-commands
Browse files Browse the repository at this point in the history
Only provide CLI commands to configuration when `symfony/console` is available
  • Loading branch information
boesing committed Aug 1, 2021
2 parents 302a91e + 7a6baa1 commit 0b7ef4d
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
use Laminas\Cache\Service\StoragePluginFactory;
use Laminas\Cache\Service\StoragePluginFactoryFactory;
use Laminas\Cache\Service\StoragePluginFactoryInterface;
use Symfony\Component\Console\Command\Command;
use function class_exists;

class ConfigProvider
{
Expand All @@ -33,7 +35,7 @@ public function __invoke()
*/
public function getDependencyConfig()
{
return [
$dependencies = [
// Legacy Zend Framework aliases
'aliases' => [
\Zend\Cache\PatternPluginManager::class => PatternPluginManager::class,
Expand All @@ -49,19 +51,30 @@ public function getDependencyConfig()
PatternPluginManager::class => Service\PatternPluginManagerFactory::class,
Storage\AdapterPluginManager::class => Service\StorageAdapterPluginManagerFactory::class,
Storage\PluginManager::class => Service\StoragePluginManagerFactory::class,
DeprecatedStorageFactoryConfigurationCheckCommand::class =>
DeprecatedStorageFactoryConfigurationCheckCommandFactory::class,
StoragePluginFactory::class => StoragePluginFactoryFactory::class,
StorageAdapterFactory::class => StorageAdapterFactoryFactory::class,
],
];

if (class_exists(Command::class)) {
$dependencies['factories'] += [
DeprecatedStorageFactoryConfigurationCheckCommand::class =>
DeprecatedStorageFactoryConfigurationCheckCommandFactory::class,
];
}

return $dependencies;
}

/**
* @return array<string,mixed>
*/
public function getCliConfig(): array
{
if (! class_exists(Command::class)) {
return [];
}

return [
'commands' => [
DeprecatedStorageFactoryConfigurationCheckCommand::NAME =>
Expand Down

0 comments on commit 0b7ef4d

Please sign in to comment.