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

Improve type inference for Plugin Managers #165

Merged
merged 14 commits into from
Jul 10, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .laminas-ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"intl"
],
"ignore_php_platform_requirements": {
"8.0": true,
"8.1": true
gsteel marked this conversation as resolved.
Show resolved Hide resolved
}
}
24 changes: 24 additions & 0 deletions .psr-container.php.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace Psr\Container {
/**
* Provides automatic type inference for Psalm when retrieving a service from a container using a FQCN
*/
interface ContainerInterface
{
/**
* @param string|class-string $id
* @return bool
*/
public function has(string $id);

/**
* @template T
* @psalm-param string|class-string<T> $id
* @psalm-return ($id is class-string ? T : mixed)
*/
public function get(string $id);
}
}
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"laminas/laminas-escaper": "^2.5",
"laminas/laminas-eventmanager": "^3.4",
"laminas/laminas-json": "^3.3",
"laminas/laminas-servicemanager": "^3.10",
"laminas/laminas-stdlib": "^3.6",
"laminas/laminas-servicemanager": "^3.14.0",
"laminas/laminas-stdlib": "^3.10.1",
"psr/container": "^1 || ^2"
},
"require-dev": {
Expand Down