Skip to content

Commit 51b8447

Browse files
committed
use ::class instead of strings in src
1 parent f8cdd85 commit 51b8447

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

src/ConfigProvider.php

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace DoctrineModule;
66

7+
use Doctrine\Common\Cache;
8+
use Laminas\Authentication\Storage\Session as LaminasSessionStorage;
9+
710
/**
811
* Config provider for DoctrineORMModule config
912
*/
@@ -30,9 +33,9 @@ public function __invoke(): array
3033
public function getDependencyConfig(): array
3134
{
3235
return [
33-
'invokables' => ['DoctrineModule\Authentication\Storage\Session' => 'Laminas\Authentication\Storage\Session'],
34-
'factories' => ['doctrine.cli' => 'DoctrineModule\Service\CliFactory'],
35-
'abstract_factories' => ['DoctrineModule' => 'DoctrineModule\ServiceFactory\AbstractDoctrineServiceFactory'],
36+
'invokables' => ['DoctrineModule\Authentication\Storage\Session' => LaminasSessionStorage::class],
37+
'factories' => ['doctrine.cli' => Service\CliFactory::class],
38+
'abstract_factories' => ['DoctrineModule' => ServiceFactory\AbstractDoctrineServiceFactory::class],
3639
];
3740
}
3841

@@ -46,52 +49,52 @@ public function getDoctrineConfig(): array
4649
return [
4750
'cache' => [
4851
'apc' => [
49-
'class' => 'Doctrine\Common\Cache\ApcCache',
52+
'class' => Cache\ApcCache::class,
5053
'namespace' => 'DoctrineModule',
5154
],
5255
'apcu' => [
53-
'class' => 'Doctrine\Common\Cache\ApcuCache',
56+
'class' => Cache\ApcuCache::class,
5457
'namespace' => 'DoctrineModule',
5558
],
5659
'array' => [
57-
'class' => 'Doctrine\Common\Cache\ArrayCache',
60+
'class' => Cache\ArrayCache::class,
5861
'namespace' => 'DoctrineModule',
5962
],
6063
'filesystem' => [
61-
'class' => 'Doctrine\Common\Cache\FilesystemCache',
64+
'class' => Cache\FilesystemCache::class,
6265
'directory' => 'data/DoctrineModule/cache',
6366
'namespace' => 'DoctrineModule',
6467
],
6568
'memcache' => [
66-
'class' => 'Doctrine\Common\Cache\MemcacheCache',
69+
'class' => Cache\MemcacheCache::class,
6770
'instance' => 'my_memcache_alias',
6871
'namespace' => 'DoctrineModule',
6972
],
7073
'memcached' => [
71-
'class' => 'Doctrine\Common\Cache\MemcachedCache',
74+
'class' => Cache\MemcachedCache::class,
7275
'instance' => 'my_memcached_alias',
7376
'namespace' => 'DoctrineModule',
7477
],
7578
'predis' => [
76-
'class' => 'Doctrine\Common\Cache\PredisCache',
79+
'class' => Cache\PredisCache::class,
7780
'instance' => 'my_predis_alias',
7881
'namespace' => 'DoctrineModule',
7982
],
8083
'redis' => [
81-
'class' => 'Doctrine\Common\Cache\RedisCache',
84+
'class' => Cache\RedisCache::class,
8285
'instance' => 'my_redis_alias',
8386
'namespace' => 'DoctrineModule',
8487
],
8588
'wincache' => [
86-
'class' => 'Doctrine\Common\Cache\WinCacheCache',
89+
'class' => Cache\WinCacheCache::class,
8790
'namespace' => 'DoctrineModule',
8891
],
8992
'xcache' => [
90-
'class' => 'Doctrine\Common\Cache\XcacheCache',
93+
'class' => Cache\XcacheCache::class,
9194
'namespace' => 'DoctrineModule',
9295
],
9396
'zenddata' => [
94-
'class' => 'Doctrine\Common\Cache\ZendDataCache',
97+
'class' => Cache\ZendDataCache::class,
9598
'namespace' => 'DoctrineModule',
9699
],
97100
],
@@ -126,12 +129,12 @@ public function getDoctrineConfig(): array
126129
public function getDoctrineFactoryConfig(): array
127130
{
128131
return [
129-
'cache' => 'DoctrineModule\Service\CacheFactory',
130-
'eventmanager' => 'DoctrineModule\Service\EventManagerFactory',
131-
'driver' => 'DoctrineModule\Service\DriverFactory',
132-
'authenticationadapter' => 'DoctrineModule\Service\Authentication\AdapterFactory',
133-
'authenticationstorage' => 'DoctrineModule\Service\Authentication\StorageFactory',
134-
'authenticationservice' => 'DoctrineModule\Service\Authentication\AuthenticationServiceFactory',
132+
'cache' => Service\CacheFactory::class,
133+
'eventmanager' => Service\EventManagerFactory::class,
134+
'driver' => Service\DriverFactory::class,
135+
'authenticationadapter' => Service\Authentication\AdapterFactory::class,
136+
'authenticationstorage' => Service\Authentication\StorageFactory::class,
137+
'authenticationservice' => Service\Authentication\AuthenticationServiceFactory::class,
135138
];
136139
}
137140

src/Options/Cache.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace DoctrineModule\Options;
66

7+
use Doctrine\Common\Cache\ArrayCache;
78
use Laminas\Stdlib\AbstractOptions;
89

910
/**
@@ -14,7 +15,7 @@ final class Cache extends AbstractOptions
1415
/**
1516
* Class used to instantiate the cache.
1617
*/
17-
protected string $class = 'Doctrine\Common\Cache\ArrayCache';
18+
protected string $class = ArrayCache::class;
1819

1920
/**
2021
* Namespace to prefix all cache ids with.

0 commit comments

Comments
 (0)