From 2ef840f8ee677d9f74fe4b4d7394d0444384682a Mon Sep 17 00:00:00 2001 From: fenric Date: Sun, 18 Nov 2018 14:03:32 +0300 Subject: [PATCH] All exceptions inherit RuntimeException --- src/Exception/Exception.php | 23 ------------------- .../UnableToCreateTransliteratorException.php | 7 +++++- .../UnableToTransliterateException.php | 7 +++++- ...ortedTransliteratorIdentifierException.php | 7 +++++- tests/SluggerTest.php | 8 +++---- 5 files changed, 21 insertions(+), 31 deletions(-) delete mode 100644 src/Exception/Exception.php diff --git a/src/Exception/Exception.php b/src/Exception/Exception.php deleted file mode 100644 index 893abf8..0000000 --- a/src/Exception/Exception.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @copyright Copyright (c) 2018, Anatoly Fenric - * @license https://github.com/sunrise-php/slugger/blob/master/LICENSE - * @link https://github.com/sunrise-php/slugger - */ - -namespace Sunrise\Slugger\Exception; - -/** - * Import classes - */ -use RuntimeException; - -/** - * Exception - */ -class Exception extends RuntimeException -{} diff --git a/src/Exception/UnableToCreateTransliteratorException.php b/src/Exception/UnableToCreateTransliteratorException.php index e4ff66e..59ed094 100644 --- a/src/Exception/UnableToCreateTransliteratorException.php +++ b/src/Exception/UnableToCreateTransliteratorException.php @@ -11,8 +11,13 @@ namespace Sunrise\Slugger\Exception; +/** + * Import classes + */ +use RuntimeException; + /** * UnableToCreateTransliteratorException */ -class UnableToCreateTransliteratorException extends Exception +class UnableToCreateTransliteratorException extends RuntimeException {} diff --git a/src/Exception/UnableToTransliterateException.php b/src/Exception/UnableToTransliterateException.php index a6b09cd..2b1b5c2 100644 --- a/src/Exception/UnableToTransliterateException.php +++ b/src/Exception/UnableToTransliterateException.php @@ -11,8 +11,13 @@ namespace Sunrise\Slugger\Exception; +/** + * Import classes + */ +use RuntimeException; + /** * UnableToTransliterateException */ -class UnableToTransliterateException extends Exception +class UnableToTransliterateException extends RuntimeException {} diff --git a/src/Exception/UnsupportedTransliteratorIdentifierException.php b/src/Exception/UnsupportedTransliteratorIdentifierException.php index ca3fc90..68743eb 100644 --- a/src/Exception/UnsupportedTransliteratorIdentifierException.php +++ b/src/Exception/UnsupportedTransliteratorIdentifierException.php @@ -11,8 +11,13 @@ namespace Sunrise\Slugger\Exception; +/** + * Import classes + */ +use RuntimeException; + /** * UnsupportedTransliteratorIdentifierException */ -class UnsupportedTransliteratorIdentifierException extends Exception +class UnsupportedTransliteratorIdentifierException extends RuntimeException {} diff --git a/tests/SluggerTest.php b/tests/SluggerTest.php index b5c221f..471ed60 100644 --- a/tests/SluggerTest.php +++ b/tests/SluggerTest.php @@ -3,7 +3,6 @@ namespace Sunrise\Slugger\Tests; use PHPUnit\Framework\TestCase; -use Sunrise\Slugger\Exception\Exception; use Sunrise\Slugger\Exception\UnableToCreateTransliteratorException; use Sunrise\Slugger\Exception\UnableToTransliterateException; use Sunrise\Slugger\Exception\UnsupportedTransliteratorIdentifierException; @@ -137,9 +136,8 @@ public function testTransliterateWithInvalidCompound() public function testExceptions() { - $this->assertInstanceOf(\RuntimeException::class, new Exception('')); - $this->assertInstanceOf(Exception::class, new UnableToCreateTransliteratorException('')); - $this->assertInstanceOf(Exception::class, new UnableToTransliterateException('')); - $this->assertInstanceOf(Exception::class, new UnsupportedTransliteratorIdentifierException('')); + $this->assertInstanceOf(\RuntimeException::class, new UnableToCreateTransliteratorException('')); + $this->assertInstanceOf(\RuntimeException::class, new UnableToTransliterateException('')); + $this->assertInstanceOf(\RuntimeException::class, new UnsupportedTransliteratorIdentifierException('')); } }