diff --git a/src/Exception.php b/src/Exception/ExceptionInterface.php similarity index 93% rename from src/Exception.php rename to src/Exception/ExceptionInterface.php index 2737cc4..03e4ed2 100644 --- a/src/Exception.php +++ b/src/Exception/ExceptionInterface.php @@ -19,7 +19,7 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -namespace Zend\File; +namespace Zend\File\Exception; /** * Marker interface for exceptions found in this component @@ -28,6 +28,6 @@ * @subpackage Exception * @license New BSD {@link http://framework.zend.com/license/new-bsd} */ -interface Exception +interface ExceptionInterface { } diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php index 3c312b1..7c982bd 100644 --- a/src/Exception/InvalidArgumentException.php +++ b/src/Exception/InvalidArgumentException.php @@ -21,8 +21,6 @@ namespace Zend\File\Exception; -use Zend\File\Exception; - /** * Exception class raised when invalid arguments are discovered * @@ -31,6 +29,6 @@ */ class InvalidArgumentException extends \InvalidArgumentException - implements Exception + implements ExceptionInterface { } diff --git a/src/Transfer/Adapter/AbstractAdapter.php b/src/Transfer/Adapter/AbstractAdapter.php index bd3d0e8..d88f4be 100644 --- a/src/Transfer/Adapter/AbstractAdapter.php +++ b/src/Transfer/Adapter/AbstractAdapter.php @@ -371,7 +371,7 @@ public function addPrefixPaths(array $spec) /** * Adds a new validator for this class * - * @param string|Validator\Validator $validator Type of validator to add + * @param string|Validator\ValidatorInterface $validator Type of validator to add * @param boolean $breakChainOnFailure If the validation chain should stop an failure * @param string|array $options Options to set for the validator * @param string|array $files Files to limit this validator to @@ -380,7 +380,7 @@ public function addPrefixPaths(array $spec) */ public function addValidator($validator, $breakChainOnFailure = false, $options = null, $files = null) { - if ($validator instanceof Validator\Validator) { + if ($validator instanceof Validator\ValidatorInterface) { $name = get_class($validator); } elseif (is_string($validator)) { $name = $this->getPluginLoader(self::VALIDATOR)->load($validator); @@ -395,7 +395,7 @@ public function addValidator($validator, $breakChainOnFailure = false, $options unset($options['messages']); } } else { - throw new Exception\InvalidArgumentException('Invalid validator provided to addValidator; must be string or Zend\Validator\Validator'); + throw new Exception\InvalidArgumentException('Invalid validator provided to addValidator; must be string or Zend\Validator\ValidatorInterface'); } $this->validators[$name] = $validator; @@ -427,7 +427,7 @@ public function addValidator($validator, $breakChainOnFailure = false, $options public function addValidators(array $validators, $files = null) { foreach ($validators as $name => $validatorInfo) { - if ($validatorInfo instanceof Validator\Validator) { + if ($validatorInfo instanceof Validator\ValidatorInterface) { $this->addValidator($validatorInfo, null, null, $files); } else if (is_string($validatorInfo)) { if (!is_int($name)) { diff --git a/src/Transfer/Exception/BadMethodCallException.php b/src/Transfer/Exception/BadMethodCallException.php index 399da84..278d39e 100644 --- a/src/Transfer/Exception/BadMethodCallException.php +++ b/src/Transfer/Exception/BadMethodCallException.php @@ -28,5 +28,5 @@ */ class BadMethodCallException extends \BadMethodCallException - implements \Zend\File\Transfer\Exception + implements ExceptionInterface {} diff --git a/src/Transfer/Exception.php b/src/Transfer/Exception/ExceptionInterface.php similarity index 85% rename from src/Transfer/Exception.php rename to src/Transfer/Exception/ExceptionInterface.php index f3b22dd..84f464f 100644 --- a/src/Transfer/Exception.php +++ b/src/Transfer/Exception/ExceptionInterface.php @@ -18,7 +18,9 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -namespace Zend\File\Transfer; +namespace Zend\File\Transfer\Exception; + +use Zend\File\Exception\ExceptionInterface as FileException; /** * Exception class for Zend\File\Transfer @@ -28,7 +30,8 @@ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -interface Exception +interface ExceptionInterface + extends FileException { } diff --git a/src/Transfer/Exception/InvalidArgumentException.php b/src/Transfer/Exception/InvalidArgumentException.php index c088eff..522d00f 100644 --- a/src/Transfer/Exception/InvalidArgumentException.php +++ b/src/Transfer/Exception/InvalidArgumentException.php @@ -28,5 +28,5 @@ */ class InvalidArgumentException extends \InvalidArgumentException - implements \Zend\File\Transfer\Exception + implements ExceptionInterface {} \ No newline at end of file diff --git a/src/Transfer/Exception/PhpEnvironmentException.php b/src/Transfer/Exception/PhpEnvironmentException.php index ea9647f..bbf809a 100644 --- a/src/Transfer/Exception/PhpEnvironmentException.php +++ b/src/Transfer/Exception/PhpEnvironmentException.php @@ -28,5 +28,5 @@ */ class PhpEnvironmentException extends \RuntimeException - implements \Zend\File\Transfer\Exception + implements ExceptionInterface {} \ No newline at end of file diff --git a/src/Transfer/Exception/RuntimeException.php b/src/Transfer/Exception/RuntimeException.php index 9e5fcfb..ef85b31 100644 --- a/src/Transfer/Exception/RuntimeException.php +++ b/src/Transfer/Exception/RuntimeException.php @@ -28,5 +28,5 @@ */ class RuntimeException extends \RuntimeException - implements \Zend\File\Transfer\Exception + implements ExceptionInterface {} \ No newline at end of file diff --git a/test/Transfer/Adapter/HttpTest.php b/test/Transfer/Adapter/HttpTest.php index 55be712..bbb70b6 100644 --- a/test/Transfer/Adapter/HttpTest.php +++ b/test/Transfer/Adapter/HttpTest.php @@ -23,7 +23,7 @@ namespace ZendTest\File\Transfer\Adapter; use Zend\File\Transfer\Adapter, - Zend\File\Transfer\Exception, + Zend\File\Transfer\Exception\RuntimeException, Zend\ProgressBar, Zend\ProgressBar\Adapter as AdapterProgressBar, Zend\Validator\File as FileValidator; @@ -124,7 +124,7 @@ public function testReceiveUnknownFile() { try { $this->assertFalse($this->adapter->receive('unknownFile')); - } catch (Exception $e) { + } catch (RuntimeException $e) { $this->assertContains('not find', $e->getMessage()); } }