Skip to content

Commit f889a65

Browse files
authored
Merge pull request #21 from SpacePossum/3_0_deprecated
Deprecate flag not being bool.
2 parents cef27f6 + a22f40b commit f889a65

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/Caching/MemcachedServiceProvider.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public function register(Container $app)
7070
}
7171

7272
$client = new $client();
73+
7374
break;
7475
}
7576

@@ -109,7 +110,15 @@ public function register(Container $app)
109110
*/
110111
private function getLogger(Container $app, $name)
111112
{
112-
if (!isset($app[$name.'.enable_log']) || !interface_exists('Psr\Log\LoggerInterface')) {
113+
if (!isset($app[$name.'.enable_log'])) {
114+
return null;
115+
}
116+
117+
if (!is_bool($app[$name.'.enable_log'])) {
118+
@trigger_error(sprintf('Using a non-boolean value for \'%s.enable_log\' is deprecated and will be removed in v4.0.', $name), E_USER_DEPRECATED);
119+
}
120+
121+
if (!interface_exists('Psr\Log\LoggerInterface')) {
113122
return null;
114123
}
115124

tests/Caching/Tests/MemcachedServiceProviderTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,19 @@ public function provideLoggerByConfiguration()
211211
];
212212
}
213213

214+
/**
215+
* @group legacy
216+
*/
217+
public function testDeprecatedConfig()
218+
{
219+
$app = new Application();
220+
$app->register(new MemcachedServiceProvider(), [
221+
'memcache.enable_log' => null,
222+
'memcache.client' => 'mock',
223+
]);
224+
$app['memcache']->setPrefix('1');
225+
}
226+
214227
/**
215228
* @expectedException \UnexpectedValueException
216229
* @expectedExceptionMessageRegExp #^Cannot use string\#"\\Foo\\Bar" as class for memcache client.$#

0 commit comments

Comments
 (0)