Skip to content

Commit 64acfd2

Browse files
authored
Merge pull request #770 from driehle/feature/cleanup
Change return type to int for Countable implementations
2 parents 37b41fa + 51b8447 commit 64acfd2

File tree

4 files changed

+27
-33
lines changed

4 files changed

+27
-33
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.

src/Paginator/Adapter/Collection.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use Doctrine\Common\Collections\Collection as DoctrineCollection;
88
use Laminas\Paginator\Adapter\AdapterInterface;
9-
use ReturnTypeWillChange;
109

1110
use function array_values;
1211
use function count;
@@ -38,11 +37,7 @@ public function getItems($offset, $itemCountPerPage)
3837
return array_values($this->collection->slice($offset, $itemCountPerPage));
3938
}
4039

41-
/**
42-
* {@inheritDoc}
43-
*/
44-
#[ReturnTypeWillChange]
45-
public function count()
40+
public function count(): int
4641
{
4742
return count($this->collection);
4843
}

src/Paginator/Adapter/Selectable.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Doctrine\Common\Collections\Criteria;
88
use Doctrine\Common\Collections\Selectable as DoctrineSelectable;
99
use Laminas\Paginator\Adapter\AdapterInterface;
10-
use ReturnTypeWillChange;
1110

1211
use function count;
1312

@@ -48,11 +47,7 @@ public function getItems($offset, $itemCountPerPage)
4847
return $this->selectable->matching($this->criteria)->toArray();
4948
}
5049

51-
/**
52-
* {@inheritDoc}
53-
*/
54-
#[ReturnTypeWillChange]
55-
public function count()
50+
public function count(): int
5651
{
5752
$criteria = clone $this->criteria;
5853

0 commit comments

Comments
 (0)