Skip to content

Commit

Permalink
Suppress Psalm warning and ensure type safety
Browse files Browse the repository at this point in the history
Suppressed a Psalm warning in the httpCache conditional check in Bootstrap.php. Ensured type safety in TestModule.php and HttpLinkFactory.php by explicitly casting environment variable to string and specifying function parameter and return types.
  • Loading branch information
koriym committed Jun 14, 2024
1 parent 60d26a8 commit 38f12ca
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Asd/HttpLinkFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function __construct(
#[Override]
public function __invoke(Created $created): AlpsLink
{
$url = fn ($path): array|string => str_replace($this->alpsDir, $this->host, $path);
$url = fn (string $path): string => str_replace($this->alpsDir, $this->host, $path);

return new AlpsLink(
$url($created->profileFile),
Expand Down
1 change: 1 addition & 0 deletions src/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public function __invoke(string $context, array $globals, array $server): int
{
$app = Injector::getInstance($context)->getInstance(AppInterface::class);
assert($app instanceof App);
/** @psalm-suppress InvalidArgument */
if ($app->httpCache->isNotModified($server)) {
$app->httpCache->transfer();

Expand Down
2 changes: 1 addition & 1 deletion src/Module/TestModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected function configure(): void
(new Dotenv())->load(dirname(__DIR__, 2));
$this->install(
new AuraSqlModule(
getenv('MA_DB_DSN') . '_test',
(string) getenv('MA_DB_DSN') . '_test',
(string) getenv('MA_DB_USER'),
(string) getenv('MA_DB_PASS'),
(string) getenv('MA_DB_SLAVE')
Expand Down

0 comments on commit 38f12ca

Please sign in to comment.