We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 19252c9 commit 1925322Copy full SHA for 1925322
utils/src/StaticClass.php
@@ -16,12 +16,10 @@
16
trait StaticClass
17
{
18
/**
19
- * @return never
20
- * @throws \Error
+ * Class is static and cannot be instantiated.
21
*/
22
- final public function __construct()
+ final private function __construct()
23
24
- throw new \Error('Class ' . static::class . ' is static and cannot be instantiated.');
25
}
26
27
utils/tests/Utils/StaticClass.phpt
@@ -23,7 +23,7 @@ class TestClass
Assert::exception(
fn() => new TestClass,
Error::class,
- 'Class TestClass is static and cannot be instantiated.',
+ 'Call to private TestClass::__construct() from global scope',
);
28
29
0 commit comments