diff --git a/src/Exception/BadMethodCallException.php b/src/Exception/BadMethodCallException.php index 50602b634..b29a56e91 100644 --- a/src/Exception/BadMethodCallException.php +++ b/src/Exception/BadMethodCallException.php @@ -14,7 +14,7 @@ * @category Zend * @package Zend_Cache */ -class BadMethodCallException extends \BadMethodCallException implements +class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface { } diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php index f479a856a..0d70ca359 100644 --- a/src/Exception/InvalidArgumentException.php +++ b/src/Exception/InvalidArgumentException.php @@ -14,7 +14,7 @@ * @category Zend * @package Zend_Cache */ -class InvalidArgumentException extends \InvalidArgumentException implements +class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface { } diff --git a/src/Exception/UnexpectedValueException.php b/src/Exception/UnexpectedValueException.php index 9c8d428d7..de4f5f9f1 100644 --- a/src/Exception/UnexpectedValueException.php +++ b/src/Exception/UnexpectedValueException.php @@ -14,7 +14,7 @@ * @category Zend * @package Zend_Cache */ -class UnexpectedValueException extends \UnexpectedValueException implements +class UnexpectedValueException extends \UnexpectedValueException implements ExceptionInterface { } diff --git a/src/Exception/UnsupportedMethodCallException.php b/src/Exception/UnsupportedMethodCallException.php index a1bc111dd..29d773993 100644 --- a/src/Exception/UnsupportedMethodCallException.php +++ b/src/Exception/UnsupportedMethodCallException.php @@ -14,7 +14,7 @@ * @category Zend * @package Zend_Cache */ -class UnsupportedMethodCallException extends \BadMethodCallException implements +class UnsupportedMethodCallException extends \BadMethodCallException implements ExceptionInterface { } diff --git a/src/Pattern/CaptureCache.php b/src/Pattern/CaptureCache.php index 6fd40a2b3..07a86f9d8 100644 --- a/src/Pattern/CaptureCache.php +++ b/src/Pattern/CaptureCache.php @@ -11,6 +11,7 @@ namespace Zend\Cache\Pattern; use Zend\Cache\Exception; +use Zend\Stdlib\ErrorHandler; /** * @category Zend @@ -80,7 +81,10 @@ public function get($pageId = null, array $options = array()) . DIRECTORY_SEPARATOR . $this->pageId2Filename($pageId); if (file_exists($file)) { - if (($content = @file_get_contents($file)) === false) { + ErrorHandler::start(E_WARNING); + $content = file_get_contents($file); + ErrorHandler::stop(); + if ($content === false) { $lastErr = error_get_last(); throw new Exception\RuntimeException("Failed to read cached pageId '{$pageId}': {$lastErr['message']}"); } @@ -268,10 +272,14 @@ protected function putFileContent($file, $data) $flags = $flags | LOCK_EX; } - $put = @file_put_contents($file, $data, $flags); + ErrorHandler::start(E_WARNING); + $put = file_put_contents($file, $data, $flags); + ErrorHandler::stop(); if ( $put < strlen((binary)$data) ) { $lastErr = error_get_last(); - @unlink($file); // remove old or incomplete written file + ErrorHandler::start(E_WARNING); + unlink($file); // remove old or incomplete written file + ErrorHandler::stop(); throw new Exception\RuntimeException($lastErr['message']); } } diff --git a/src/PatternPluginManager.php b/src/PatternPluginManager.php index f3d267b05..70cba3e54 100644 --- a/src/PatternPluginManager.php +++ b/src/PatternPluginManager.php @@ -16,7 +16,7 @@ * Plugin manager implementation for cache pattern adapters * * Enforces that adatpers retrieved are instances of - * Pattern\PatternInterface. Additionally, it registers a number of default + * Pattern\PatternInterface. Additionally, it registers a number of default * patterns available. * * @category Zend @@ -26,7 +26,7 @@ class PatternPluginManager extends AbstractPluginManager { /** * Default set of adapters - * + * * @var array */ protected $invokableClasses = array( @@ -40,7 +40,7 @@ class PatternPluginManager extends AbstractPluginManager /** * Don't share by default - * + * * @var array */ protected $shareByDefault = false; @@ -49,8 +49,8 @@ class PatternPluginManager extends AbstractPluginManager * Validate the plugin * * Checks that the pattern adapter loaded is an instance of Pattern\PatternInterface. - * - * @param mixed $plugin + * + * @param mixed $plugin * @return void * @throws Exception\RuntimeException if invalid */ diff --git a/src/Storage/Adapter/AdapterOptions.php b/src/Storage/Adapter/AdapterOptions.php index 5a6cd22fb..8f2a467ac 100644 --- a/src/Storage/Adapter/AdapterOptions.php +++ b/src/Storage/Adapter/AdapterOptions.php @@ -16,6 +16,7 @@ use Zend\Cache\Storage\StorageInterface; use Zend\EventManager\EventsCapableInterface; use Zend\Stdlib\AbstractOptions; +use Zend\Stdlib\ErrorHandler; /** * Unless otherwise marked, all options in this class affect all adapters. @@ -112,7 +113,10 @@ public function setKeyPattern($keyPattern) if ($this->keyPattern !== $keyPattern) { // validate pattern if ($keyPattern !== '') { - if (@preg_match($keyPattern, '') === false) { + ErrorHandler::start(E_WARNING); + $result = preg_match($keyPattern, ''); + ErrorHandler::stop(); + if ($result === false) { $err = error_get_last(); throw new Exception\InvalidArgumentException("Invalid pattern '{$keyPattern}': {$err['message']}"); } diff --git a/src/Storage/Adapter/ApcIterator.php b/src/Storage/Adapter/ApcIterator.php index 80f2576c1..66baa8276 100644 --- a/src/Storage/Adapter/ApcIterator.php +++ b/src/Storage/Adapter/ApcIterator.php @@ -98,10 +98,10 @@ public function setMode($mode) /* Iterator */ - /** - * Get current key, value or metadata. - * - * @return mixed + /** + * Get current key, value or metadata. + * + * @return mixed */ public function current() { @@ -120,10 +120,10 @@ public function current() return $key; } - /** - * Get current key - * - * @return string + /** + * Get current key + * + * @return string */ public function key() { @@ -143,20 +143,20 @@ public function next() $this->baseIterator->next(); } - /** - * Checks if current position is valid - * - * @return boolean + /** + * Checks if current position is valid + * + * @return boolean */ public function valid() { return $this->baseIterator->valid(); } - /** - * Rewind the Iterator to the first element. - * - * @return void + /** + * Rewind the Iterator to the first element. + * + * @return void */ public function rewind() { diff --git a/src/Storage/Adapter/Dba.php b/src/Storage/Adapter/Dba.php index 9dbb5845c..9d09aacff 100644 --- a/src/Storage/Adapter/Dba.php +++ b/src/Storage/Adapter/Dba.php @@ -516,7 +516,9 @@ protected function _open() protected function _close() { if ($this->handle) { - @dba_close($this->handle); + ErrorHandler::start(E_WARNING); + dba_close($this->handle); + ErrorHandler::stop(); $this->handle = null; } } diff --git a/src/Storage/Adapter/FilesystemIterator.php b/src/Storage/Adapter/FilesystemIterator.php index c745ac033..fa4d635dd 100644 --- a/src/Storage/Adapter/FilesystemIterator.php +++ b/src/Storage/Adapter/FilesystemIterator.php @@ -106,10 +106,10 @@ public function setMode($mode) /* Iterator */ - /** - * Get current key, value or metadata. - * - * @return mixed + /** + * Get current key, value or metadata. + * + * @return mixed */ public function current() { @@ -128,10 +128,10 @@ public function current() return $key; } - /** - * Get current key - * - * @return string + /** + * Get current key + * + * @return string */ public function key() { @@ -151,10 +151,10 @@ public function next() $this->globIterator->next(); } - /** - * Checks if current position is valid - * - * @return boolean + /** + * Checks if current position is valid + * + * @return boolean */ public function valid() { @@ -168,10 +168,10 @@ public function valid() } } - /** - * Rewind the Iterator to the first element. - * - * @return void + /** + * Rewind the Iterator to the first element. + * + * @return void */ public function rewind() { diff --git a/src/Storage/Adapter/KeyListIterator.php b/src/Storage/Adapter/KeyListIterator.php index 800089f18..21de7d5f1 100644 --- a/src/Storage/Adapter/KeyListIterator.php +++ b/src/Storage/Adapter/KeyListIterator.php @@ -103,10 +103,10 @@ public function setMode($mode) return $this; } - /** - * Get current key, value or metadata. - * - * @return mixed + /** + * Get current key, value or metadata. + * + * @return mixed */ public function current() { @@ -125,20 +125,20 @@ public function current() return $key; } - /** - * Get current key - * - * @return string + /** + * Get current key + * + * @return string */ public function key() { return $this->keys[$this->position]; } - /** - * Checks if current position is valid - * - * @return boolean + /** + * Checks if current position is valid + * + * @return boolean */ public function valid() { @@ -155,10 +155,10 @@ public function next() $this->position++; } - /** - * Rewind the Iterator to the first element. - * - * @return void + /** + * Rewind the Iterator to the first element. + * + * @return void */ public function rewind() { diff --git a/src/Storage/Adapter/ZendServerDisk.php b/src/Storage/Adapter/ZendServerDisk.php index b8c8d28aa..6669f9151 100644 --- a/src/Storage/Adapter/ZendServerDisk.php +++ b/src/Storage/Adapter/ZendServerDisk.php @@ -23,10 +23,10 @@ * @package Zend_Cache * @subpackage Storage */ -class ZendServerDisk extends AbstractZendServer implements - AvailableSpaceCapableInterface, +class ZendServerDisk extends AbstractZendServer implements + AvailableSpaceCapableInterface, ClearByNamespaceInterface, - FlushableInterface, + FlushableInterface, TotalSpaceCapableInterface { diff --git a/src/Storage/Adapter/ZendServerShm.php b/src/Storage/Adapter/ZendServerShm.php index 9d2ebba9c..5b9c3bbd6 100644 --- a/src/Storage/Adapter/ZendServerShm.php +++ b/src/Storage/Adapter/ZendServerShm.php @@ -21,7 +21,7 @@ * @package Zend_Cache * @subpackage Storage */ -class ZendServerShm extends AbstractZendServer implements +class ZendServerShm extends AbstractZendServer implements ClearByNamespaceInterface, FlushableInterface, TotalSpaceCapableInterface diff --git a/src/Storage/AdapterPluginManager.php b/src/Storage/AdapterPluginManager.php index 5cb8fa1b2..c10305dd8 100644 --- a/src/Storage/AdapterPluginManager.php +++ b/src/Storage/AdapterPluginManager.php @@ -17,7 +17,7 @@ * Plugin manager implementation for cache storage adapters * * Enforces that adapters retrieved are instances of - * StorageInterface. Additionally, it registers a number of default + * StorageInterface. Additionally, it registers a number of default * adapters available. * * @category Zend @@ -28,7 +28,7 @@ class AdapterPluginManager extends AbstractPluginManager { /** * Default set of adapters - * + * * @var array */ protected $invokableClasses = array( @@ -48,7 +48,7 @@ class AdapterPluginManager extends AbstractPluginManager /** * Do not share by default - * + * * @var array */ protected $shareByDefault = false; @@ -57,8 +57,8 @@ class AdapterPluginManager extends AbstractPluginManager * Validate the plugin * * Checks that the adapter loaded is an instance of StorageInterface. - * - * @param mixed $plugin + * + * @param mixed $plugin * @return void * @throws Exception\RuntimeException if invalid */ diff --git a/src/Storage/PluginManager.php b/src/Storage/PluginManager.php index 9499dfc04..d7746383c 100644 --- a/src/Storage/PluginManager.php +++ b/src/Storage/PluginManager.php @@ -17,7 +17,7 @@ * Plugin manager implementation for cache plugins * * Enforces that plugins retrieved are instances of - * Plugin\PluginInterface. Additionally, it registers a number of default + * Plugin\PluginInterface. Additionally, it registers a number of default * plugins available. * * @category Zend @@ -28,7 +28,7 @@ class PluginManager extends AbstractPluginManager { /** * Default set of plugins - * + * * @var array */ protected $invokableClasses = array( @@ -41,7 +41,7 @@ class PluginManager extends AbstractPluginManager /** * Do not share by default - * + * * @var array */ protected $shareByDefault = false; @@ -50,8 +50,8 @@ class PluginManager extends AbstractPluginManager * Validate the plugin * * Checks that the plugin loaded is an instance of Plugin\PluginInterface. - * - * @param mixed $plugin + * + * @param mixed $plugin * @return void * @throws Exception\RuntimeException if invalid */ diff --git a/test/Pattern/CallbackCacheTest.php b/test/Pattern/CallbackCacheTest.php index 487e05055..7cd8fbf81 100644 --- a/test/Pattern/CallbackCacheTest.php +++ b/test/Pattern/CallbackCacheTest.php @@ -39,7 +39,8 @@ public static function emptyMethod() {} * Test function * @see ZendTest\Cache\Pattern\Foo::bar */ -function bar () { +function bar () +{ return call_user_func_array(__NAMESPACE__ . '\TestCallbackCache::bar', func_get_args()); } diff --git a/test/Pattern/CaptureCacheTest.php b/test/Pattern/CaptureCacheTest.php index 104e00128..36cc3d863 100644 --- a/test/Pattern/CaptureCacheTest.php +++ b/test/Pattern/CaptureCacheTest.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\Pattern; + use Zend\Cache; /** diff --git a/test/Pattern/ClassCacheTest.php b/test/Pattern/ClassCacheTest.php index 1de4308bf..bf70833ec 100644 --- a/test/Pattern/ClassCacheTest.php +++ b/test/Pattern/ClassCacheTest.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\Pattern; + use Zend\Cache; /** diff --git a/test/Pattern/ObjectCacheTest.php b/test/Pattern/ObjectCacheTest.php index f88623186..ca07bb976 100644 --- a/test/Pattern/ObjectCacheTest.php +++ b/test/Pattern/ObjectCacheTest.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\Pattern; + use Zend\Cache; /** diff --git a/test/Storage/Adapter/AbstractDbaTest.php b/test/Storage/Adapter/AbstractDbaTest.php index 121450f2c..1dae323f3 100644 --- a/test/Storage/Adapter/AbstractDbaTest.php +++ b/test/Storage/Adapter/AbstractDbaTest.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\Storage\Adapter; + use Zend\Cache; /** diff --git a/test/Storage/Adapter/ApcTest.php b/test/Storage/Adapter/ApcTest.php index 1fd89dcdf..25621604a 100644 --- a/test/Storage/Adapter/ApcTest.php +++ b/test/Storage/Adapter/ApcTest.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\Storage\Adapter; + use Zend\Cache; /** diff --git a/test/Storage/Adapter/DbaDb2Test.php b/test/Storage/Adapter/DbaDb2Test.php index 45442251f..d137785b7 100644 --- a/test/Storage/Adapter/DbaDb2Test.php +++ b/test/Storage/Adapter/DbaDb2Test.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\Storage\Adapter; + use Zend\Cache; /** diff --git a/test/Storage/Adapter/DbaDb3Test.php b/test/Storage/Adapter/DbaDb3Test.php index c260eda32..f10efc06b 100644 --- a/test/Storage/Adapter/DbaDb3Test.php +++ b/test/Storage/Adapter/DbaDb3Test.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\Storage\Adapter; + use Zend\Cache; /** diff --git a/test/Storage/Adapter/DbaDb4Test.php b/test/Storage/Adapter/DbaDb4Test.php index 6eecc8e39..f82b2768c 100644 --- a/test/Storage/Adapter/DbaDb4Test.php +++ b/test/Storage/Adapter/DbaDb4Test.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\Storage\Adapter; + use Zend\Cache; /** diff --git a/test/Storage/Adapter/DbaFlatfileTest.php b/test/Storage/Adapter/DbaFlatfileTest.php index 68732b8da..c56df792f 100644 --- a/test/Storage/Adapter/DbaFlatfileTest.php +++ b/test/Storage/Adapter/DbaFlatfileTest.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\Storage\Adapter; + use Zend\Cache; /** diff --git a/test/Storage/Adapter/DbaGdbmTest.php b/test/Storage/Adapter/DbaGdbmTest.php index 13fa79a92..65967d996 100644 --- a/test/Storage/Adapter/DbaGdbmTest.php +++ b/test/Storage/Adapter/DbaGdbmTest.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\Storage\Adapter; + use Zend\Cache; /** diff --git a/test/Storage/Adapter/DbaInifileTest.php b/test/Storage/Adapter/DbaInifileTest.php index ec4c74d96..2b33a2c6a 100644 --- a/test/Storage/Adapter/DbaInifileTest.php +++ b/test/Storage/Adapter/DbaInifileTest.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\Storage\Adapter; + use Zend\Cache; /** diff --git a/test/Storage/Adapter/DbaQdbmTest.php b/test/Storage/Adapter/DbaQdbmTest.php index 172a5bc80..66d08ecb4 100644 --- a/test/Storage/Adapter/DbaQdbmTest.php +++ b/test/Storage/Adapter/DbaQdbmTest.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\Storage\Adapter; + use Zend\Cache; /** diff --git a/test/Storage/Adapter/MemoryTest.php b/test/Storage/Adapter/MemoryTest.php index 5b0ddc461..e404080b9 100644 --- a/test/Storage/Adapter/MemoryTest.php +++ b/test/Storage/Adapter/MemoryTest.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\Storage\Adapter; + use Zend\Cache; /** diff --git a/test/Storage/Adapter/WinCacheTest.php b/test/Storage/Adapter/WinCacheTest.php index cd789c4de..8d3fd39c8 100644 --- a/test/Storage/Adapter/WinCacheTest.php +++ b/test/Storage/Adapter/WinCacheTest.php @@ -9,8 +9,9 @@ */ namespace ZendTest\Cache\Storage\Adapter; -use \Zend\Cache; -use \Zend\Cache\Exception; + +use Zend\Cache; +use Zend\Cache\Exception; /** * @category Zend diff --git a/test/Storage/Plugin/ClearExpiredByFactorTest.php b/test/Storage/Plugin/ClearExpiredByFactorTest.php index c37293b04..cad736fa8 100644 --- a/test/Storage/Plugin/ClearExpiredByFactorTest.php +++ b/test/Storage/Plugin/ClearExpiredByFactorTest.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\Storage\Plugin; + use Zend\Cache; use Zend\Cache\Storage\PostEvent; use ZendTest\Cache\Storage\TestAsset\ClearExpiredMockAdapter; diff --git a/test/Storage/Plugin/ExceptionHandlerTest.php b/test/Storage/Plugin/ExceptionHandlerTest.php index 050f33665..16e414ec4 100644 --- a/test/Storage/Plugin/ExceptionHandlerTest.php +++ b/test/Storage/Plugin/ExceptionHandlerTest.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\Storage\Plugin; + use Zend\Cache; use Zend\Cache\Storage\ExceptionEvent; use ZendTest\Cache\Storage\TestAsset\MockAdapter; diff --git a/test/Storage/Plugin/IgnoreUserAbortTest.php b/test/Storage/Plugin/IgnoreUserAbortTest.php index c5503659a..e97d687c2 100644 --- a/test/Storage/Plugin/IgnoreUserAbortTest.php +++ b/test/Storage/Plugin/IgnoreUserAbortTest.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\Storage\Plugin; + use Zend\Cache; use Zend\Cache\Storage\Event; use Zend\Cache\Storage\PostEvent; diff --git a/test/Storage/Plugin/OptimizeByFactorTest.php b/test/Storage/Plugin/OptimizeByFactorTest.php index 6a74a5f27..99563d80c 100644 --- a/test/Storage/Plugin/OptimizeByFactorTest.php +++ b/test/Storage/Plugin/OptimizeByFactorTest.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\Storage\Plugin; + use Zend\Cache; use Zend\Cache\Storage\PostEvent; use ZendTest\Cache\Storage\TestAsset\OptimizableMockAdapter; diff --git a/test/Storage/Plugin/SerializerTest.php b/test/Storage/Plugin/SerializerTest.php index ebf0aca43..c089b07c0 100644 --- a/test/Storage/Plugin/SerializerTest.php +++ b/test/Storage/Plugin/SerializerTest.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\Storage\Plugin; + use Zend\Cache; use Zend\Cache\Storage\Event; use Zend\Cache\Storage\PostEvent; diff --git a/test/Storage/TestAsset/MockAdapter.php b/test/Storage/TestAsset/MockAdapter.php index 4d6227b5b..7642334d6 100644 --- a/test/Storage/TestAsset/MockAdapter.php +++ b/test/Storage/TestAsset/MockAdapter.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\Storage\TestAsset; + use Zend\Cache\Storage\Adapter\AbstractAdapter; class MockAdapter extends AbstractAdapter diff --git a/test/TestAsset/DummyPattern.php b/test/TestAsset/DummyPattern.php index 4b98c47ae..7cc461e73 100644 --- a/test/TestAsset/DummyPattern.php +++ b/test/TestAsset/DummyPattern.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\TestAsset; + use Zend\Cache; class DummyPattern extends Cache\Pattern\AbstractPattern diff --git a/test/TestAsset/DummyStorageAdapter.php b/test/TestAsset/DummyStorageAdapter.php index f3ea7707f..f8e333fcd 100644 --- a/test/TestAsset/DummyStorageAdapter.php +++ b/test/TestAsset/DummyStorageAdapter.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\TestAsset; + use Zend\Cache\Storage\Adapter\AbstractAdapter; class DummyStorageAdapter extends AbstractAdapter diff --git a/test/TestAsset/DummyStoragePlugin.php b/test/TestAsset/DummyStoragePlugin.php index 397a2fbb9..8c7e27391 100644 --- a/test/TestAsset/DummyStoragePlugin.php +++ b/test/TestAsset/DummyStoragePlugin.php @@ -9,6 +9,7 @@ */ namespace ZendTest\Cache\TestAsset; + use Zend\Cache\Storage\Plugin\AbstractPlugin; class DummyStoragePlugin extends AbstractPlugin