Skip to content

Commit f99bab6

Browse files
authored
Merge pull request #30 from bigcommerce/loosen_psr_container
Loosen psr/container dependency version
2 parents 2bb818f + 72d9eae commit f99bab6

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"php": "^8.2",
2525
"pimple/pimple": "*",
2626
"friendsofphp/proxy-manager-lts": "^1.0",
27-
"psr/container": "^1.0"
27+
"psr/container": "^1.0 || ^2.0"
2828
},
2929
"require-dev": {
3030
"phpunit/phpunit": "^11.5",

src/Adapter/ArrayContainerAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function get($id)
5252
*
5353
* @return boolean
5454
*/
55-
public function has($id)
55+
public function has($id): bool
5656
{
5757
return isset($this->arrayContainer[$id]);
5858
}

tests/InjectorTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Bigcommerce\Injector\Reflection\ClassInspector;
77
use PHPUnit\Framework\Attributes\CoversClass;
88
use PHPUnit\Framework\TestCase;
9+
use Prophecy\Argument;
910
use Prophecy\PhpUnit\ProphecyTrait;
1011
use Prophecy\Prophecy\ObjectProphecy;
1112
use Psr\Container\ContainerInterface;
@@ -227,6 +228,7 @@ public function testAutoCreate()
227228
$this->mockDummyDependencySignature();
228229
$this->mockDummySubDependencySignature();
229230

231+
$this->container->has(Argument::any())->willReturn(false);
230232
$injector = new Injector($this->container->reveal(), $this->inspector->reveal());
231233
$injector->addAutoCreate(".*?Dummy.*?");
232234
$instance = $injector->create(
@@ -262,6 +264,7 @@ public function testAutoCreateStackWrap()
262264
$this->mockDummySimpleSignature();
263265
$this->mockDummyDependencySignature();
264266

267+
$this->container->has(Argument::any())->willReturn(false);
265268
$injector = new Injector($this->container->reveal(), $this->inspector->reveal());
266269
$injector->addAutoCreate(".*?DummyDependency");
267270
$instance = $injector->create(
@@ -283,6 +286,7 @@ public function testCreateMissingParameter()
283286
);
284287
$this->mockDummySimpleSignature();
285288

289+
$this->container->has(Argument::any())->willReturn(false);
286290
$injector = new Injector($this->container->reveal(), $this->inspector->reveal());
287291
$instance = $injector->create(
288292
DummySimpleConstructor::class

0 commit comments

Comments
 (0)