diff --git a/composer.json b/composer.json index 4eff613..7d3295e 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,8 @@ }, "require-dev": { "pestphp/pest": "^2.0", - "php-di/php-di": "^7.0" + "php-di/php-di": "^7.0", + "vimeo/psalm": "^5.13" }, "license": "MIT", "autoload": { diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 0000000..b86be40 --- /dev/null +++ b/psalm.xml @@ -0,0 +1,17 @@ + + + + + + + + + diff --git a/src/Container.php b/src/Container.php index 01a20ea..eb85c21 100644 --- a/src/Container.php +++ b/src/Container.php @@ -79,8 +79,8 @@ public function delegateTo(ContainerInterface $container): void } /** - * @param string $class - * @return object|string|null + * @param string $class + * * @throws ContainerException * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface diff --git a/src/Definition.php b/src/Definition.php index eadf465..70a6020 100644 --- a/src/Definition.php +++ b/src/Definition.php @@ -18,7 +18,7 @@ public function __construct( ) { } - public function singleton(): self + public function singleton(): static { $this->shared = true; return $this; @@ -29,7 +29,7 @@ public function hasInstance(): bool return $this->instance !== null; } - public function getInstance(): object + public function getInstance(): object|null { return $this->instance; }