Skip to content

Commit 4b99ecd

Browse files
Added suggest requirement ext-pcntl for di.
Co-authored-by: 李铭昕 <[email protected]>
1 parent 214170f commit 4b99ecd

File tree

5 files changed

+63
-1
lines changed

5 files changed

+63
-1
lines changed

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"vlucas/phpdotenv": "^5.0"
2828
},
2929
"suggest": {
30-
"hyperf/config": "Require this component for annotation scan progress to retrieve the scan path."
30+
"hyperf/config": "Require this component for annotation scan progress to retrieve the scan path.",
31+
"ext-pcntl": "Required to scan annotations."
3132
},
3233
"autoload": {
3334
"psr-4": {

tests/ContainerTest.php

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Hyperf\Di\Container;
1515
use Hyperf\Di\Definition\DefinitionSource;
1616
use HyperfTest\Di\Stub\Bar;
17+
use HyperfTest\Di\Stub\Container\ContainerProxy;
1718
use HyperfTest\Di\Stub\Foo;
1819
use HyperfTest\Di\Stub\FooInterface;
1920
use Mockery;
@@ -57,4 +58,9 @@ public function testDefine()
5758
});
5859
$this->assertInstanceOf(Bar::class, $foo = $container->make(FooInterface::class));
5960
}
61+
62+
public function testPsrContainer()
63+
{
64+
$this->assertInstanceOf(Container::class, new ContainerProxy());
65+
}
6066
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file is part of Hyperf.
6+
*
7+
* @link https://www.hyperf.io
8+
* @document https://hyperf.wiki
9+
* @contact [email protected]
10+
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
11+
*/
12+
namespace HyperfTest\Di\Stub\Container;
13+
14+
interface Container1HasInterface
15+
{
16+
public function has(string $name);
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file is part of Hyperf.
6+
*
7+
* @link https://www.hyperf.io
8+
* @document https://hyperf.wiki
9+
* @contact [email protected]
10+
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
11+
*/
12+
namespace HyperfTest\Di\Stub\Container;
13+
14+
interface Container2HasInterface
15+
{
16+
public function has(string $name): bool;
17+
}
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* This file is part of Hyperf.
6+
*
7+
* @link https://www.hyperf.io
8+
* @document https://hyperf.wiki
9+
* @contact [email protected]
10+
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
11+
*/
12+
namespace HyperfTest\Di\Stub\Container;
13+
14+
use Hyperf\Di\Container;
15+
16+
class ContainerProxy extends Container implements Container1HasInterface, Container2HasInterface
17+
{
18+
public function __construct()
19+
{
20+
}
21+
}

0 commit comments

Comments
 (0)