Fix method documentation

1.x 1.5.0
Julien Rosset 2 years ago
parent c72346dfab
commit 2901667111

@ -2,6 +2,16 @@
"name": "jrosset/singleton", "name": "jrosset/singleton",
"description": "PHP Trait to implements the singleton design pattern", "description": "PHP Trait to implements the singleton design pattern",
"keywords": [ ], "keywords": [ ],
"type": "library",
"config": {
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"minimum-stability": "stable", "minimum-stability": "stable",
"require": { "require": {

@ -35,8 +35,8 @@ trait TRegistry {
/** /**
* Register a new entry * Register a new entry
* *
* @param string $name The entry name * @param string $name The entry name
* @param array $args The instance constructor arguments * @param mixed ...$args The instance constructor arguments
* *
* @return void * @return void
* *

@ -4,12 +4,12 @@
/** @noinspection PhpIllegalPsrClassPathInspection */ /** @noinspection PhpIllegalPsrClassPathInspection */
use jrosset\Singleton\IRegistry; use jrosset\Singleton\IRegistry;
use jrosset\Singleton\TRegistryExternal; use jrosset\Singleton\TRegistry;
require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/../vendor/autoload.php';
class RegistryTest implements IRegistry { class RegistryTest implements IRegistry {
use TRegistryExternal; use TRegistry;
private int $cpt; private int $cpt;
@ -23,10 +23,15 @@ class RegistryTest implements IRegistry {
public function increment (): void { public function increment (): void {
$this->cpt++; $this->cpt++;
} }
}
RegistryTest::addEntry('cpt_1', 0); /**
RegistryTest::addEntry('cpt_2', 5); * @inheritDoc
*/
protected static function initializeEntries (): void {
self::addEntry('cpt_1', 0);
self::addEntry('cpt_2', 5);
}
}
var_dump(RegistryTest::getInstance('cpt_1')->getCpt()); var_dump(RegistryTest::getInstance('cpt_1')->getCpt());
var_dump(RegistryTest::getInstance('cpt_2')->getCpt()); var_dump(RegistryTest::getInstance('cpt_2')->getCpt());

Loading…
Cancel
Save