mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Use null instead of false for failure.
null is better to indicate that a thing doesn't exist.
This commit is contained in:
parent
ba9f62a7a0
commit
bbb87b3e87
2 changed files with 4 additions and 6 deletions
|
@ -621,14 +621,13 @@ class Cache {
|
||||||
* Fetch the engine attached to a specific configuration name.
|
* Fetch the engine attached to a specific configuration name.
|
||||||
*
|
*
|
||||||
* @param string $config Optional string configuration name to get an engine for. Defaults to 'default'.
|
* @param string $config Optional string configuration name to get an engine for. Defaults to 'default'.
|
||||||
* @return bool|CacheEngine False if the engine has not been initialized else the engine
|
* @return null|CacheEngine Null if the engine has not been initialized or the engine.
|
||||||
*/
|
*/
|
||||||
public static function engine($config = 'default') {
|
public static function engine($config = 'default') {
|
||||||
if (self::isInitialized($config)) {
|
if (self::isInitialized($config)) {
|
||||||
return self::$_engines[$config];
|
return self::$_engines[$config];
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,11 +593,10 @@ class CacheTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testEngineFailure() {
|
public function testEngineFailure() {
|
||||||
$actual = Cache::engine('some_config_that_does_not_exist');
|
$actual = Cache::engine('some_config_that_does_not_exist');
|
||||||
$this->assertFalse($actual);
|
$this->assertNull($actual);
|
||||||
|
|
||||||
Configure::write('Cache.disable', true);
|
Configure::write('Cache.disable', true);
|
||||||
$actual = Cache::engine();
|
$actual = Cache::engine();
|
||||||
$this->assertFalse($actual);
|
$this->assertNull($actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue