Skip to content

Commit 6903299

Browse files
authored
Some services may not be mapped by MVC, like Mezzio ones (#22)
1 parent 6d815cb commit 6903299

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
],
2020
"require": {
2121
"php": "^7.4 || ^8.0",
22-
"phpstan/phpstan": "^0.12.86"
22+
"phpstan/phpstan": "^0.12.88"
2323
},
2424
"conflict": {
2525
"laminas/laminas-cache": "<2.11",

src/UnmappedAliasServiceLocatorProxy.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,17 @@ public function __construct(ServiceLocatorInterface $serviceLocator)
3636

3737
public function get($id)
3838
{
39+
if ($this->serviceLocator->has($id)) {
40+
return $this->serviceLocator->get($id);
41+
}
42+
3943
return $this->serviceLocator->get($this->knownUnmappedAliasToClassServices[$id] ?? $id);
4044
}
4145

4246
public function has($id)
4347
{
44-
return $this->serviceLocator->has($this->knownUnmappedAliasToClassServices[$id] ?? $id);
48+
return $this->serviceLocator->has($id)
49+
|| $this->serviceLocator->has($this->knownUnmappedAliasToClassServices[$id] ?? $id);
4550
}
4651

4752
/**

0 commit comments

Comments
 (0)