Skip to content

Commit 68d27ff

Browse files
committed
removed StaticClassException, StaticClass throws Error
1 parent 28d4e3e commit 68d27ff

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

src/Utils/StaticClass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ trait StaticClass
1717
{
1818

1919
/**
20-
* @throws \LogicException
20+
* @throws \Error
2121
*/
2222
final public function __construct()
2323
{
24-
throw new \LogicException('Class ' . get_class($this) . ' is static and cannot be instantiated.');
24+
throw new \Error('Class ' . get_class($this) . ' is static and cannot be instantiated.');
2525
}
2626

2727

src/Utils/exceptions.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,6 @@ class UnexpectedValueException extends \UnexpectedValueException
108108
{
109109
}
110110

111-
112-
/**
113-
* The exception that is thrown when static class is instantiated.
114-
*/
115-
class StaticClassException extends \LogicException
116-
{
117-
}
118-
119111
namespace Nette\Utils;
120112

121113

tests/Utils/StaticClass.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class TestClass
2222

2323
Assert::exception(function () {
2424
new TestClass;
25-
}, LogicException::class, 'Class TestClass is static and cannot be instantiated.');
25+
}, Error::class, 'Class TestClass is static and cannot be instantiated.');
2626

2727
Assert::exception(function () {
2828
TestClass::methodA();

0 commit comments

Comments
 (0)