Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changing the exceptions thrown by some methods in ClassMapLoader.

  • Loading branch information...
commit 23af49718d4ac0e002731f4464eb239cc69cae09 1 parent 74a8ac0
@zyxist zyxist authored
View
5 src/Opl/Autoloader/ClassMapLoader.php
@@ -10,6 +10,7 @@
* and other contributors. See website for details.
*/
namespace Opl\Autoloader;
+use DomainException;
use RuntimeException;
/**
@@ -85,7 +86,7 @@ public function addNamespace($namespace, $path = null)
{
if(isset($this->namespaces[(string)$namespace]))
{
- throw new RuntimeException('The namespace '.$namespace.' is already added.');
+ throw new DomainException('The namespace '.$namespace.' is already added.');
}
if($path !== null)
{
@@ -122,7 +123,7 @@ public function removeNamespace($namespace)
{
if(!isset($this->namespaces[(string)$namespace]))
{
- throw new RuntimeException('The namespace '.$namespace.' is not available.');
+ throw new DomainException('The namespace '.$namespace.' is not available.');
}
unset($this->namespaces[(string)$namespace]);
} // end removeNamespace();
View
4 tests/TestSuite/ClassMapLoaderTest.php
@@ -96,7 +96,7 @@ public function testAddNamespaceSetsCustomPath()
} // end testAddNamespaceSetsCustomPath();
/**
- * @expectedException RuntimeException
+ * @expectedException DomainException
*/
public function testAddNamespaceThrowsExceptionWhenNamespaceExists()
{
@@ -126,7 +126,7 @@ public function testRemoveNamespace()
/**
* @depends testRemoveNamespace
- * @expectedException RuntimeException
+ * @expectedException DomainException
*/
public function testRemoveNamespaceThrowsExceptionWhenNamespaceDoesNotExist()
{
Please sign in to comment.
Something went wrong with that request. Please try again.