Skip to content

Commit b9aa8ca

Browse files
committed
Phpstan: fix warnings on sfAPCiCache implementation, add docblocks and returns
1 parent c1b411f commit b9aa8ca

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

lib/cache/sfAPCuCache.class.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ public function clean($mode = sfCache::ALL)
102102
if (sfCache::ALL === $mode) {
103103
return apcu_clear_cache();
104104
}
105+
106+
return true;
105107
}
106108

107109
/**
@@ -139,24 +141,26 @@ public function removePattern($pattern)
139141

140142
$infos = apcu_cache_info();
141143
if (!is_array($infos['cache_list'])) {
142-
return;
144+
return true;
143145
}
144146

145-
$regexp = self::patternToRegexp($this->getOption('prefix').$pattern);
147+
$regexp = $this->patternToRegexp($this->getOption('prefix').$pattern);
146148

147149
foreach ($infos['cache_list'] as $info) {
148150
if (preg_match($regexp, $info['info'])) {
149151
apcu_delete($info['info']);
150152
}
151153
}
154+
155+
return true;
152156
}
153157

154158
/**
155159
* Gets the cache info.
156160
*
157161
* @param string $key The cache key
158162
*
159-
* @return string
163+
* @return string|false|array
160164
*/
161165
protected function getCacheInfo($key)
162166
{
@@ -177,6 +181,13 @@ protected function getCacheInfo($key)
177181
return null;
178182
}
179183

184+
/**
185+
* @param string $key
186+
*
187+
* @param-out bool $success
188+
*
189+
* @return false|mixed
190+
*/
180191
private function fetch($key, &$success)
181192
{
182193
$has = null;

0 commit comments

Comments
 (0)