mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-02 11:48:08 +08:00
Removed framework dependency of di, command and dispatcher.
This commit is contained in:
parent
bf3617acd5
commit
d619fa7033
@ -16,23 +16,23 @@
|
||||
"php": ">=7.2",
|
||||
"ext-swoole": ">=4.3",
|
||||
"fig/http-message-util": "^1.1.2",
|
||||
"hyperf/contract": "~1.0.0",
|
||||
"hyperf/utils": "~1.0.0",
|
||||
"psr/container": "^1.0",
|
||||
"psr/event-dispatcher": "^1.0",
|
||||
"psr/log": "^1.0",
|
||||
"hyperf/command": "~1.0.0",
|
||||
"hyperf/contract": "~1.0.0",
|
||||
"hyperf/di": "~1.0.0",
|
||||
"hyperf/dispatcher": "~1.0.0",
|
||||
"hyperf/utils": "~1.0.0"
|
||||
"psr/log": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/common": "@stable",
|
||||
"friendsofphp/php-cs-fixer": "^2.9",
|
||||
"malukenho/docheader": "^0.1.6",
|
||||
"mockery/mockery": "^1.0",
|
||||
"phpunit/phpunit": "^7.0.0",
|
||||
"friendsofphp/php-cs-fixer": "^2.9",
|
||||
"doctrine/common": "@stable"
|
||||
"phpunit/phpunit": "^7.0.0"
|
||||
},
|
||||
"suggest": {
|
||||
"hyperf/di": "Required to use Command annotation.",
|
||||
"hyperf/dispatcher": "Required to use BootApplication event.",
|
||||
"hyperf/command": "Required to use Command annotation."
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
|
@ -32,8 +32,12 @@ class ApplicationFactory
|
||||
$config = $container->get(ConfigInterface::class);
|
||||
$commands = $config->get('commands', []);
|
||||
// Append commands that defined by annotation.
|
||||
$annotationCommands = AnnotationCollector::getClassByAnnotation(Command::class);
|
||||
$annotationCommands = array_keys($annotationCommands);
|
||||
$annotationCommands = [];
|
||||
if (class_exists(AnnotationCollector::class) && class_exists(Command::class)) {
|
||||
$annotationCommands = AnnotationCollector::getClassByAnnotation(Command::class);
|
||||
$annotationCommands = array_keys($annotationCommands);
|
||||
}
|
||||
|
||||
$commands = array_unique(array_merge($commands, $annotationCommands));
|
||||
$application = new Application();
|
||||
foreach ($commands as $command) {
|
||||
|
@ -13,22 +13,15 @@ declare(strict_types=1);
|
||||
namespace Hyperf\Framework\Bootstrap;
|
||||
|
||||
use Hyperf\Contract\StdoutLoggerInterface;
|
||||
use Hyperf\Di\Container;
|
||||
use Hyperf\Framework\Event\AfterWorkerStart;
|
||||
use Hyperf\Framework\Event\BeforeWorkerStart;
|
||||
use Hyperf\Framework\Event\MainWorkerStart;
|
||||
use Hyperf\Framework\Event\OtherWorkerStart;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
use Swoole\Server as SwooleServer;
|
||||
|
||||
class WorkerStartCallback
|
||||
{
|
||||
/**
|
||||
* @var Container
|
||||
*/
|
||||
private $container;
|
||||
|
||||
/**
|
||||
* @var StdoutLoggerInterface
|
||||
*/
|
||||
@ -39,9 +32,8 @@ class WorkerStartCallback
|
||||
*/
|
||||
private $eventDispatcher;
|
||||
|
||||
public function __construct(ContainerInterface $container, StdoutLoggerInterface $logger, EventDispatcherInterface $eventDispatcher)
|
||||
public function __construct(StdoutLoggerInterface $logger, EventDispatcherInterface $eventDispatcher)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->logger = $logger;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user