diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d2cee0..802a82f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ # Changelog All notable changes to this project will be documented in this file. -## [1.0.0] - 06.01.2020 +## 1.1.1 + +Fixed return comment so class can be properly analysed by PHPStan + +## 1.1.0 + +Added arguments passing from `get` method to constructor + +## 1.0.0 Initial release diff --git a/README.md b/README.md index c5ea646..8caf33f 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ [![Total Downloads](https://poser.pugx.org/micropackage/singleton/downloads)](https://packagist.org/packages/micropackage/singleton) [![License](https://poser.pugx.org/micropackage/singleton/license)](https://packagist.org/packages/micropackage/singleton) +
+ +
+ ## 💾 Installation ``` bash @@ -15,7 +19,7 @@ composer require micropackage/singleton ## 🕹 Usage ```php -use Micropackage\Singleton; +use Micropackage\Singleton\Singleton; class Example extends Singleton {} diff --git a/composer.json b/composer.json index 8020a32..daa9361 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,7 @@ { "name": "micropackage/singleton", "description": "Singleton implementation", + "version": "1.1.1", "license": "GPL-3.0-or-later", "authors": [ { diff --git a/src/Singleton.php b/src/Singleton.php index be4d20e..3998497 100644 --- a/src/Singleton.php +++ b/src/Singleton.php @@ -48,13 +48,14 @@ public function __wakeup() { * Gets the instance * * @since 1.0.0 - * @return Singleton + * @return static */ public static function get() { $class = get_called_class(); + $args = func_get_args(); if ( ! isset( self::$instances[ $class ] ) ) { - self::$instances[ $class ] = new static(); + self::$instances[ $class ] = new static( ...$args ); } return self::$instances[ $class ];