Skip to content

Commit 7fe07fa

Browse files
Cs fixes
1 parent 2b7acc8 commit 7fe07fa

File tree

6 files changed

+51
-81
lines changed

6 files changed

+51
-81
lines changed

src/Configuration/Cache/ApcCacheProvider.php

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,10 @@
22

33
namespace LaravelDoctrine\ORM\Configuration\Cache;
44

5-
use Illuminate\Contracts\Cache\Factory;
6-
use LaravelDoctrine\ORM\Configuration\Driver;
7-
8-
class ApcCacheProvider implements Driver
5+
class ApcCacheProvider extends IlluminateCacheProvider
96
{
107
/**
11-
* @var Factory
12-
*/
13-
protected $cache;
14-
15-
/**
16-
* @param Factory $cache
17-
*/
18-
public function __construct(Factory $cache)
19-
{
20-
$this->cache = $cache;
21-
}
22-
23-
/**
24-
* @param array $settings
25-
*
26-
* @return ApcCache
8+
* @var string
279
*/
28-
public function resolve(array $settings = [])
29-
{
30-
return new IlluminateCacheAdapter(
31-
$this->cache->store('apc')
32-
);
33-
}
10+
protected $store = 'apc';
3411
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace LaravelDoctrine\ORM\Configuration\Cache;
4+
5+
use Illuminate\Contracts\Cache\Factory;
6+
use LaravelDoctrine\ORM\Configuration\Driver;
7+
8+
abstract class IlluminateCacheProvider implements Driver
9+
{
10+
/**
11+
* @var Factory
12+
*/
13+
protected $cache;
14+
15+
/**
16+
* @var string
17+
*/
18+
protected $store;
19+
20+
/**
21+
* @param Factory $cache
22+
*/
23+
public function __construct(Factory $cache)
24+
{
25+
$this->cache = $cache;
26+
}
27+
28+
/**
29+
* @param array $settings
30+
*
31+
* @return MemcachedCache
32+
*/
33+
public function resolve(array $settings = [])
34+
{
35+
return new IlluminateCacheAdapter(
36+
$this->cache->store($this->store)
37+
);
38+
}
39+
}

src/Configuration/Cache/MemcachedCacheProvider.php

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,10 @@
22

33
namespace LaravelDoctrine\ORM\Configuration\Cache;
44

5-
use Illuminate\Contracts\Cache\Factory;
6-
use LaravelDoctrine\ORM\Configuration\Driver;
7-
8-
class MemcachedCacheProvider implements Driver
5+
class MemcachedCacheProvider extends IlluminateCacheProvider
96
{
107
/**
11-
* @var Factory
12-
*/
13-
protected $cache;
14-
15-
/**
16-
* @param Factory $cache
17-
*/
18-
public function __construct(Factory $cache)
19-
{
20-
$this->cache = $cache;
21-
}
22-
23-
/**
24-
* @param array $settings
25-
*
26-
* @return MemcachedCache
8+
* @var string
279
*/
28-
public function resolve(array $settings = [])
29-
{
30-
return new IlluminateCacheAdapter(
31-
$this->cache->store('memcached')
32-
);
33-
}
10+
protected $store = 'memcached';
3411
}

src/Configuration/Cache/RedisCacheProvider.php

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,10 @@
22

33
namespace LaravelDoctrine\ORM\Configuration\Cache;
44

5-
use Illuminate\Contracts\Cache\Factory;
6-
use LaravelDoctrine\ORM\Configuration\Driver;
7-
8-
class RedisCacheProvider implements Driver
5+
class RedisCacheProvider extends IlluminateCacheProvider
96
{
107
/**
11-
* @var Factory
12-
*/
13-
protected $cache;
14-
15-
/**
16-
* @param Factory $cache
17-
*/
18-
public function __construct(Factory $cache)
19-
{
20-
$this->cache = $cache;
21-
}
22-
23-
/**
24-
* @param array $settings
25-
*
26-
* @return RedisCache
8+
* @var string
279
*/
28-
public function resolve(array $settings = [])
29-
{
30-
return new IlluminateCacheAdapter(
31-
$this->cache->store('redis')
32-
);
33-
}
10+
protected $store = 'redis';
3411
}

src/Configuration/MetaData/Fluent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace LaravelDoctrine\ORM\Configuration\MetaData;
44

5-
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
65
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
6+
use Doctrine\ORM\Mapping\ClassMetadataInfo;
77
use Illuminate\Contracts\Container\Container;
88
use LaravelDoctrine\Fluent\Builders\Builder;
99
use LaravelDoctrine\Fluent\Extensions\ExtensibleClassMetadataFactory;
@@ -36,7 +36,7 @@ public function resolve(array $settings = [])
3636

3737
$namingStrategy = $this->getNamingStrategy($settings);
3838

39-
$driver->setFluentFactory(function (ClassMetadata $meta) use ($namingStrategy) {
39+
$driver->setFluentFactory(function (ClassMetadataInfo $meta) use ($namingStrategy) {
4040
return new Builder(new ClassMetadataBuilder($meta), $namingStrategy);
4141
});
4242

src/EntityManagerFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ protected function decorateManager(array $settings = [], EntityManagerInterface
385385
/**
386386
* @param array $settings
387387
*
388-
* @return string|null
388+
* @return array
389389
*/
390390
protected function getConnectionDriver(array $settings = [])
391391
{

0 commit comments

Comments
 (0)