diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f33285d..977cb6a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,7 +38,5 @@ jobs: run: php -v - name: Install Dependencies run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist - - name: Downloading - run: wget https://github.com/vimeo/psalm/releases/download/5.9.0/psalm.phar - name: Typechecking - run: php psalm.phar + run: php ./vendor/bin/psalm diff --git a/composer.json b/composer.json index 868eb35..ce9fc62 100644 --- a/composer.json +++ b/composer.json @@ -6,16 +6,17 @@ "description": "A PHP client library for 'Vault by HashiCorp'", "require": { "ext-json": "*", - "guzzlehttp/psr7": "^2.4.4", - "php": "^7.0 || ^8.0", - "php-http/httplug": ">=1.1.0" + "guzzlehttp/psr7": "2.6.2", + "php": "^7.2.5 || ^8.0", + "php-http/httplug": "2.4.0" }, "suggest": { "php-http/curl-client": "CURL Client Adapter", "tuupola/http-factory": "HTTP Factory" }, "require-dev": { - "phpunit/phpunit": ">=5.0.0" + "phpunit/phpunit": "9.6.19", + "vimeo/psalm": "5.23.1" }, "authors": [ { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 18ded4c..7b8d966 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,13 +1,9 @@ - + ./tests - - - ./src/ - - diff --git a/src/VaultPHP/Authentication/Provider/AppRole.php b/src/VaultPHP/Authentication/Provider/AppRole.php index 7b90cd6..cc7e893 100644 --- a/src/VaultPHP/Authentication/Provider/AppRole.php +++ b/src/VaultPHP/Authentication/Provider/AppRole.php @@ -28,10 +28,10 @@ class AppRole extends AbstractAuthenticationProvider /** * AppRole constructor. - * @param $roleId - * @param $secretId + * @param string $roleId + * @param string $secretId */ - public function __construct($roleId, $secretId) + public function __construct(string $roleId, string $secretId) { $this->roleId = $roleId; $this->secretId= $secretId; diff --git a/src/VaultPHP/Response/BulkEndpointResponse.php b/src/VaultPHP/Response/BulkEndpointResponse.php index c8b040f..c842c03 100644 --- a/src/VaultPHP/Response/BulkEndpointResponse.php +++ b/src/VaultPHP/Response/BulkEndpointResponse.php @@ -45,7 +45,8 @@ public function hasErrors() { /** * @return array */ - public function getBatchResults() { + public function getBatchResults(): array + { return $this->batch_results; } diff --git a/src/VaultPHP/Response/EndpointResponse.php b/src/VaultPHP/Response/EndpointResponse.php index 67c6e23..cd32bf5 100644 --- a/src/VaultPHP/Response/EndpointResponse.php +++ b/src/VaultPHP/Response/EndpointResponse.php @@ -28,7 +28,8 @@ final public function __construct($data = [], $meta = []) * @param $response * @return array */ - protected static function getResponseContent(ResponseInterface $response) { + protected static function getResponseContent(ResponseInterface $response): array + { $responseBody = $response->getBody(); $responseBody->rewind(); $responseBodyContents = $responseBody->getContents(); diff --git a/src/VaultPHP/SecretEngines/Engines/Transit/Transit.php b/src/VaultPHP/SecretEngines/Engines/Transit/Transit.php index a40fb64..9d9749a 100644 --- a/src/VaultPHP/SecretEngines/Engines/Transit/Transit.php +++ b/src/VaultPHP/SecretEngines/Engines/Transit/Transit.php @@ -29,8 +29,15 @@ */ final class Transit extends AbstractSecretEngine { - private string $APIPath = 'transit'; + /** + * @var string + */ + private $APIPath = 'transit'; + /** + * @param string $path + * @return void + */ public function setAPIPath(string $path) { $this->APIPath = $path; diff --git a/src/VaultPHP/VaultClient.php b/src/VaultPHP/VaultClient.php index 38061ff..48b645a 100644 --- a/src/VaultPHP/VaultClient.php +++ b/src/VaultPHP/VaultClient.php @@ -3,7 +3,7 @@ namespace VaultPHP; use GuzzleHttp\Psr7\Request; -use Http\Client\HttpClient; +use Psr\Http\Client\ClientInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use VaultPHP\Authentication\AuthenticationMetaData; @@ -27,7 +27,7 @@ class VaultClient /** @var string */ private $apiHost; - /** @var HttpClient */ + /** @var ClientInterface */ private $httpClient; /** @var AuthenticationProviderInterface */ @@ -38,12 +38,12 @@ class VaultClient /** * VaultClient constructor. - * @param HttpClient $httpClient + * @param ClientInterface $httpClient * @param AuthenticationProviderInterface $authProvider * @param string $apiHost */ public function __construct( - HttpClient $httpClient, + ClientInterface $httpClient, AuthenticationProviderInterface $authProvider, $apiHost )