1<?php 2 3/** 4 * This file is part of the Nette Framework (https://nette.org) 5 * Copyright (c) 2004 David Grudl (https://davidgrudl.com) 6 */ 7 8declare(strict_types=1); 9 10namespace Nette; 11 12 13/** 14 * Static class. 15 */ 16trait StaticClass 17{ 18 /** 19 * @return never 20 * @throws \Error 21 */ 22 final public function __construct() 23 { 24 throw new \Error('Class ' . static::class . ' is static and cannot be instantiated.'); 25 } 26 27 28 /** 29 * Call to undefined static method. 30 * @throws MemberAccessException 31 */ 32 public static function __callStatic(string $name, array $args): mixed 33 { 34 Utils\ObjectHelpers::strictStaticCall(static::class, $name); 35 } 36} 37