diff --git a/include/generic/Singleton.php b/include/generic/Singleton.php index 77a6fcb..4f40fef 100644 --- a/include/generic/Singleton.php +++ b/include/generic/Singleton.php @@ -1,58 +1,59 @@ . # generic stuff namespace generic; /** * A singleton gives an #instance() method */ trait Singleton { /** * Get an instance of this class * * @return self */ public static function instance() { static $instance; if( ! $instance ) { $instance = static::create(); } return $instance; } /** * Function to be overrided to create an instance of this class * * @return self */ protected static function create() { return new static(); } /** - * Throw an usage error - */ - protected static function throwSingletonUsage() { + * Throw an usage error + * @return never + */ + protected static function throwSingletonUsage() { throw new \Exception( sprintf( 'wrong singleton usage, you must call %s::instance()', static::class ) ); } }