Browse Source

Use UnexpectedValueException as it is more specific.

Mark Story 4 years ago
parent
commit
32f0afafde
2 changed files with 4 additions and 4 deletions
  1. 2 2
      src/Http/Uri.php
  2. 2 2
      tests/TestCase/Http/UriTest.php

+ 2 - 2
src/Http/Uri.php

@@ -16,8 +16,8 @@ declare(strict_types=1);
  */
 namespace Cake\Http;
 
-use Error;
 use Psr\Http\Message\UriInterface;
+use UnexpectedValueException;
 
 /**
  * The base and webroot properties have piggybacked on the Uri for
@@ -71,7 +71,7 @@ class Uri implements UriInterface
         if ($name === 'base' || $name === 'webroot') {
             return $this->{$name};
         }
-        throw new Error("Undefined property via __get('{$name}')");
+        throw new UnexpectedValueException("Undefined property via __get('{$name}')");
     }
 
     /**

+ 2 - 2
tests/TestCase/Http/UriTest.php

@@ -18,8 +18,8 @@ namespace Cake\Test\TestCase\Http;
 
 use Cake\Http\Uri;
 use Cake\TestSuite\TestCase;
-use Error;
 use Laminas\Diactoros\Uri as LaminasUri;
+use UnexpectedValueException;
 
 /**
  * Test case for the Uri Shim
@@ -43,7 +43,7 @@ class UriTest extends TestCase
         $this->assertSame('/base', $uri->base);
         $this->assertSame('/base/', $uri->webroot);
 
-        $this->expectException(Error::class);
+        $this->expectException(UnexpectedValueException::class);
         $this->expectExceptionMessage('Undefined property via __get');
         $uri->uri;
     }