Skip to content

Commit

Permalink
Merge pull request #165 from gsteel/qa/psr-stub
Browse files Browse the repository at this point in the history
Improve type inference for Plugin Managers
  • Loading branch information
Ocramius authored Jul 10, 2022
2 parents 110c1d3 + fc209b8 commit b25e4a4
Show file tree
Hide file tree
Showing 32 changed files with 407 additions and 535 deletions.
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
}
}
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
Loading

0 comments on commit b25e4a4

Please sign in to comment.