From 9da8d3047125365c6551ac86e49ef3ad83f5fc07 Mon Sep 17 00:00:00 2001 From: Sergio Brighenti Date: Tue, 27 Jun 2023 18:13:42 +0200 Subject: [PATCH] add psalm --- composer.json | 3 ++- psalm.xml | 17 +++++++++++++++++ src/Container.php | 4 ++-- src/Definition.php | 4 ++-- 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 psalm.xml 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; }