Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bump static analysis level #5

Merged
merged 5 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-22.04",
"features": {
"ghcr.io/devcontainers/features/php:1": {
"version": "8.0"
"version": "8.2"
}
},
"containerEnv": {
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
level: 4
level: 7
paths:
- src
- test
3 changes: 2 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<psalm
errorLevel="7"
errorLevel="5"
JoshuaLicense marked this conversation as resolved.
Show resolved Hide resolved
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
Expand All @@ -10,6 +10,7 @@
>
<projectFiles>
<directory name="src"/>
<directory name="test"/>
<ignoreFiles>
<directory name="vendor"/>
</ignoreFiles>
Expand Down
4 changes: 3 additions & 1 deletion src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function onMergeConfig(ModuleEvent $e): void

$provider = $fqcn::create($config);

$parameters = array_merge($parameters, ...array_map(fn($id) => $provider($id), $ids));
$parameters = array_merge($parameters, ...array_map(fn(string $id) => $provider($id), $ids));
}

$bag = new ParameterBag($parameters);
Expand All @@ -66,6 +66,8 @@ public function onMergeConfig(ModuleEvent $e): void

/**
* @return array<string, mixed>
*
* @psalm-return array{config_parameters: array{providers: array<string, string[]>}}
*/
public function getConfig(): array
{
Expand Down
10 changes: 8 additions & 2 deletions test/Functional/ModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
use Laminas\ServiceManager\ServiceManager;
use PHPUnit\Framework\TestCase;

/**
* @psalm-api
*/
class ModuleTest extends TestCase
{
public function testProcessParameters(): void
Expand Down Expand Up @@ -60,8 +63,8 @@ public function testProcessParameters(): void

$config = $application->getConfig();

$this->assertEquals('secret', $config['secret']);
$this->assertEquals('parameter', $config['parameter']);
$this->assertEquals('secret', $config['secret'] ?? null);
$this->assertEquals('parameter', $config['parameter'] ?? null);
JoshuaLicense marked this conversation as resolved.
Show resolved Hide resolved
}

public function testMissingParametersThrowException(): void
Expand Down Expand Up @@ -96,6 +99,9 @@ public function testMissingParametersThrowException(): void
$application->getConfig();
}

/**
* @param array<string, mixed> $moduleConfig
*/
protected function createApplication(array $moduleConfig): Application
{
$configuration = [
Expand Down
3 changes: 3 additions & 0 deletions test/Unit/ParameterProvider/Aws/ParameterStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use Dvsa\LaminasConfigCloudParameters\ParameterProvider\Aws\ParameterStore;
use PHPUnit\Framework\TestCase;

/**
* @psalm-api
*/
class ParameterStoreTest extends TestCase
{
public function testThrowsLibraryException(): void
Expand Down
3 changes: 3 additions & 0 deletions test/Unit/ParameterProvider/Aws/SecretsManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use Dvsa\LaminasConfigCloudParameters\ParameterProvider\Aws\SecretsManager;
use PHPUnit\Framework\TestCase;

/**
* @psalm-api
*/
class SecretsManagerTest extends TestCase
{
public function testThrowsLibraryException(): void
Expand Down
Loading