Browse Source

[Routing] renamed some exceptions

Fabien Potencier 14 years ago
parent
commit
2cd04547fd

+ 1 - 1
src/Symfony/Component/Routing/Exception/NotFoundException.php

@@ -18,6 +18,6 @@ namespace Symfony\Component\Routing\Exception;
  *
  * @author Kris Wallsmith <kris@symfony.com>
  */
-class NotFoundException extends \RuntimeException implements Exception
+class ResourceNotFoundException extends \RuntimeException implements Exception
 {
 }

+ 1 - 1
src/Symfony/Component/Routing/Exception/NotExistingRouteException.php

@@ -16,6 +16,6 @@ namespace Symfony\Component\Routing\Exception;
  *
  * @author Alexandre Salomé <alexandre.salome@gmail.com>
  */
-class NotExistingRouteException extends \InvalidArgumentException implements Exception
+class RouteNotFoundException extends \InvalidArgumentException implements Exception
 {
 }

+ 2 - 2
src/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php

@@ -77,7 +77,7 @@ EOF
     public function generate(\$name, array \$parameters = array(), \$absolute = false)
     {
         if (!isset(self::\$declaredRouteNames[\$name])) {
-            throw new NotExistingRouteException(sprintf('Route "%s" does not exist.', \$name));
+            throw new RouteNotFoundException(sprintf('Route "%s" does not exist.', \$name));
         }
 
         \$escapedName = str_replace('.', '__', \$name);
@@ -103,7 +103,7 @@ EOF;
 <?php
 
 use Symfony\Component\Routing\RequestContext;
-use Symfony\Component\Routing\Exception\NotExistingRouteException;
+use Symfony\Component\Routing\Exception\RouteNotFoundException;
 
 
 /**

+ 3 - 3
src/Symfony/Component/Routing/Generator/UrlGenerator.php

@@ -15,7 +15,7 @@ use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
 use Symfony\Component\Routing\RequestContext;
 use Symfony\Component\Routing\Exception\InvalidParameterException;
-use Symfony\Component\Routing\Exception\NotExistingRouteException;
+use Symfony\Component\Routing\Exception\RouteNotFoundException;
 use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
 
 /**
@@ -72,12 +72,12 @@ class UrlGenerator implements UrlGeneratorInterface
      *
      * @return string The generated URL
      *
-     * @throws Symfony\Component\Routing\Exception\NotExistingRouteException When route doesn't exist
+     * @throws Symfony\Component\Routing\Exception\RouteNotFoundException When route doesn't exist
      */
     public function generate($name, array $parameters = array(), $absolute = false)
     {
         if (null === $route = $this->routes->get($name)) {
-            throw new NotExistingRouteException(sprintf('Route "%s" does not exist.', $name));
+            throw new RouteNotFoundException(sprintf('Route "%s" does not exist.', $name));
         }
 
         if (!isset($this->cache[$name])) {

+ 2 - 2
src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php

@@ -63,7 +63,7 @@ class PhpMatcherDumper extends MatcherDumper
         \$allow = array();
 
 $code
-        throw 0 < count(\$allow) ? new MethodNotAllowedException(array_unique(\$allow)) : new NotFoundException();
+        throw 0 < count(\$allow) ? new MethodNotAllowedException(array_unique(\$allow)) : new ResourceNotFoundException();
     }
 
 EOF;
@@ -207,7 +207,7 @@ EOF
 <?php
 
 use Symfony\Component\Routing\Exception\MethodNotAllowedException;
-use Symfony\Component\Routing\Exception\NotFoundException;
+use Symfony\Component\Routing\Exception\ResourceNotFoundException;
 use Symfony\Component\Routing\RequestContext;
 
 /**

+ 2 - 2
src/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php

@@ -11,7 +11,7 @@
 
 namespace Symfony\Component\Routing\Matcher;
 
-use Symfony\Component\Routing\Exception\NotFoundException;
+use Symfony\Component\Routing\Exception\ResourceNotFoundException;
 
 /**
  * @author Fabien Potencier <fabien@symfony.com>
@@ -27,7 +27,7 @@ abstract class RedirectableUrlMatcher extends UrlMatcher implements Redirectable
     {
         try {
             $parameters = parent::match($pathinfo);
-        } catch (NotFoundException $e) {
+        } catch (ResourceNotFoundException $e) {
             if ('/' === substr($pathinfo, -1)) {
                 throw $e;
             }

+ 3 - 3
src/Symfony/Component/Routing/Matcher/UrlMatcher.php

@@ -12,7 +12,7 @@
 namespace Symfony\Component\Routing\Matcher;
 
 use Symfony\Component\Routing\Exception\MethodNotAllowedException;
-use Symfony\Component\Routing\Exception\NotFoundException;
+use Symfony\Component\Routing\Exception\ResourceNotFoundException;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
 use Symfony\Component\Routing\RequestContext;
@@ -67,7 +67,7 @@ class UrlMatcher implements UrlMatcherInterface
      *
      * @return array An array of parameters
      *
-     * @throws NotFoundException         If the resource could not be found
+     * @throws ResourceNotFoundException If the resource could not be found
      * @throws MethodNotAllowedException If the resource was found but the request method is not allowed
      */
     public function match($pathinfo)
@@ -80,7 +80,7 @@ class UrlMatcher implements UrlMatcherInterface
 
         throw 0 < count($this->allow)
             ? new MethodNotAllowedException(array_unique(array_map('strtolower', $this->allow)))
-            : new NotFoundException();
+            : new ResourceNotFoundException();
     }
 
     protected function matchCollection($pathinfo, RouteCollection $routes)

+ 1 - 1
src/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php

@@ -27,7 +27,7 @@ interface UrlMatcherInterface extends RequestContextAwareInterface
      *
      * @return array An array of parameters
      *
-     * @throws NotFoundException         If the resource could not be found
+     * @throws ResourceNotFoundException If the resource could not be found
      * @throws MethodNotAllowedException If the resource was found but the request method is not allowed
      */
     function match($pathinfo);

+ 2 - 2
tests/Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher1.php

@@ -1,7 +1,7 @@
 <?php
 
 use Symfony\Component\Routing\Exception\MethodNotAllowedException;
-use Symfony\Component\Routing\Exception\NotFoundException;
+use Symfony\Component\Routing\Exception\ResourceNotFoundException;
 use Symfony\Component\Routing\RequestContext;
 
 /**
@@ -106,6 +106,6 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
     
         }
 
-        throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new NotFoundException();
+        throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
     }
 }

+ 2 - 2
tests/Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher2.php

@@ -1,7 +1,7 @@
 <?php
 
 use Symfony\Component\Routing\Exception\MethodNotAllowedException;
-use Symfony\Component\Routing\Exception\NotFoundException;
+use Symfony\Component\Routing\Exception\ResourceNotFoundException;
 use Symfony\Component\Routing\RequestContext;
 
 /**
@@ -134,6 +134,6 @@ class ProjectUrlMatcher extends Symfony\Tests\Component\Routing\Fixtures\Redirec
             return array('_route' => 'nonsecure');
         }
 
-        throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new NotFoundException();
+        throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
     }
 }

+ 1 - 1
tests/Symfony/Tests/Component/Routing/Generator/Dumper/PhpGeneratorDumperTest.php

@@ -85,7 +85,7 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
     }
 
     /**
-     * @expectedException Symfony\Component\Routing\Exception\NotExistingRouteException
+     * @expectedException Symfony\Component\Routing\Exception\RouteNotFoundException
      */
     public function testGenerateNonExistingRoute()
     {

+ 1 - 1
tests/Symfony/Tests/Component/Routing/Generator/UrlGeneratorTest.php

@@ -131,7 +131,7 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase
     }
 
     /**
-     * @expectedException Symfony\Component\Routing\Exception\NotExistingRouteException
+     * @expectedException Symfony\Component\Routing\Exception\RouteNotFoundException
      */
     public function testGenerateWithoutRoutes()
     {

+ 3 - 3
tests/Symfony/Tests/Component/Routing/Matcher/UrlMatcherTest.php

@@ -12,7 +12,7 @@
 namespace Symfony\Tests\Component\Routing\Matcher;
 
 use Symfony\Component\Routing\Exception\MethodNotAllowedException;
-use Symfony\Component\Routing\Exception\NotFoundException;
+use Symfony\Component\Routing\Exception\ResourceNotFoundException;
 use Symfony\Component\Routing\Matcher\UrlMatcher;
 use Symfony\Component\Routing\Route;
 use Symfony\Component\Routing\RouteCollection;
@@ -69,7 +69,7 @@ class UrlMatcherTest extends \PHPUnit_Framework_TestCase
         try {
             $matcher->match('/no-match');
             $this->fail();
-        } catch (NotFoundException $e) {}
+        } catch (ResourceNotFoundException $e) {}
         $this->assertEquals(array('_route' => 'foo', 'bar' => 'baz'), $matcher->match('/foo/baz'));
 
         // test that defaults are merged
@@ -141,7 +141,7 @@ class UrlMatcherTest extends \PHPUnit_Framework_TestCase
         try {
             $matcher->match('/');
             $this->fail();
-        } catch (NotFoundException $e) {
+        } catch (ResourceNotFoundException $e) {
         }
     }
 }