mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-29 18:27:44 +08:00
Preferentially use configuration to improve startup speed (#5020)
This commit is contained in:
parent
7c0ec6f7e9
commit
ce52a04419
@ -30,13 +30,6 @@ class ConfigProvider
|
||||
BeforeMainServerStartListener::class => 99,
|
||||
MainWorkerStartListener::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
'id' => 'config',
|
||||
|
@ -15,12 +15,10 @@ use Hyperf\AsyncQueue\Annotation\AsyncQueueMessage;
|
||||
use Hyperf\AsyncQueue\AnnotationJob;
|
||||
use Hyperf\AsyncQueue\Driver\DriverFactory;
|
||||
use Hyperf\AsyncQueue\Environment;
|
||||
use Hyperf\Di\Annotation\Aspect;
|
||||
use Hyperf\Di\Aop\AbstractAspect;
|
||||
use Hyperf\Di\Aop\ProceedingJoinPoint;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
#[Aspect]
|
||||
class AsyncQueueAspect extends AbstractAspect
|
||||
{
|
||||
public array $annotations = [
|
||||
|
@ -12,13 +12,11 @@ declare(strict_types=1);
|
||||
namespace Hyperf\AsyncQueue\Command;
|
||||
|
||||
use Hyperf\AsyncQueue\Driver\DriverFactory;
|
||||
use Hyperf\Command\Annotation\Command;
|
||||
use Hyperf\Command\Command as HyperfCommand;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
#[Command]
|
||||
class FlushFailedMessageCommand extends HyperfCommand
|
||||
{
|
||||
protected ContainerInterface $container;
|
||||
|
@ -12,12 +12,10 @@ declare(strict_types=1);
|
||||
namespace Hyperf\AsyncQueue\Command;
|
||||
|
||||
use Hyperf\AsyncQueue\Driver\DriverFactory;
|
||||
use Hyperf\Command\Annotation\Command;
|
||||
use Hyperf\Command\Command as HyperfCommand;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
|
||||
#[Command]
|
||||
class InfoCommand extends HyperfCommand
|
||||
{
|
||||
protected ContainerInterface $container;
|
||||
|
@ -12,13 +12,11 @@ declare(strict_types=1);
|
||||
namespace Hyperf\AsyncQueue\Command;
|
||||
|
||||
use Hyperf\AsyncQueue\Driver\DriverFactory;
|
||||
use Hyperf\Command\Annotation\Command;
|
||||
use Hyperf\Command\Command as HyperfCommand;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
#[Command]
|
||||
class ReloadFailedMessageCommand extends HyperfCommand
|
||||
{
|
||||
protected ContainerInterface $container;
|
||||
|
@ -11,17 +11,23 @@ declare(strict_types=1);
|
||||
*/
|
||||
namespace Hyperf\AsyncQueue;
|
||||
|
||||
use Hyperf\AsyncQueue\Aspect\AsyncQueueAspect;
|
||||
use Hyperf\AsyncQueue\Command\FlushFailedMessageCommand;
|
||||
use Hyperf\AsyncQueue\Command\InfoCommand;
|
||||
use Hyperf\AsyncQueue\Command\ReloadFailedMessageCommand;
|
||||
|
||||
class ConfigProvider
|
||||
{
|
||||
public function __invoke(): array
|
||||
{
|
||||
return [
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
'aspects' => [
|
||||
AsyncQueueAspect::class,
|
||||
],
|
||||
'commands' => [
|
||||
FlushFailedMessageCommand::class,
|
||||
InfoCommand::class,
|
||||
ReloadFailedMessageCommand::class,
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
|
2
src/cache/src/Aspect/CacheEvictAspect.php
vendored
2
src/cache/src/Aspect/CacheEvictAspect.php
vendored
@ -15,11 +15,9 @@ use Hyperf\Cache\Annotation\CacheEvict;
|
||||
use Hyperf\Cache\AnnotationManager;
|
||||
use Hyperf\Cache\CacheManager;
|
||||
use Hyperf\Cache\Driver\KeyCollectorInterface;
|
||||
use Hyperf\Di\Annotation\Aspect;
|
||||
use Hyperf\Di\Aop\AbstractAspect;
|
||||
use Hyperf\Di\Aop\ProceedingJoinPoint;
|
||||
|
||||
#[Aspect]
|
||||
class CacheEvictAspect extends AbstractAspect
|
||||
{
|
||||
public array $annotations = [
|
||||
|
2
src/cache/src/Aspect/CachePutAspect.php
vendored
2
src/cache/src/Aspect/CachePutAspect.php
vendored
@ -14,11 +14,9 @@ namespace Hyperf\Cache\Aspect;
|
||||
use Hyperf\Cache\Annotation\CachePut;
|
||||
use Hyperf\Cache\AnnotationManager;
|
||||
use Hyperf\Cache\CacheManager;
|
||||
use Hyperf\Di\Annotation\Aspect;
|
||||
use Hyperf\Di\Aop\AbstractAspect;
|
||||
use Hyperf\Di\Aop\ProceedingJoinPoint;
|
||||
|
||||
#[Aspect]
|
||||
class CachePutAspect extends AbstractAspect
|
||||
{
|
||||
public array $annotations = [
|
||||
|
2
src/cache/src/Aspect/CacheableAspect.php
vendored
2
src/cache/src/Aspect/CacheableAspect.php
vendored
@ -15,11 +15,9 @@ use Hyperf\Cache\Annotation\Cacheable;
|
||||
use Hyperf\Cache\AnnotationManager;
|
||||
use Hyperf\Cache\CacheManager;
|
||||
use Hyperf\Cache\Driver\KeyCollectorInterface;
|
||||
use Hyperf\Di\Annotation\Aspect;
|
||||
use Hyperf\Di\Aop\AbstractAspect;
|
||||
use Hyperf\Di\Aop\ProceedingJoinPoint;
|
||||
|
||||
#[Aspect]
|
||||
class CacheableAspect extends AbstractAspect
|
||||
{
|
||||
public array $classes = [];
|
||||
|
2
src/cache/src/Aspect/FailCacheAspect.php
vendored
2
src/cache/src/Aspect/FailCacheAspect.php
vendored
@ -15,11 +15,9 @@ use Hyperf\Cache\Annotation\FailCache;
|
||||
use Hyperf\Cache\AnnotationManager;
|
||||
use Hyperf\Cache\CacheManager;
|
||||
use Hyperf\Contract\StdoutLoggerInterface;
|
||||
use Hyperf\Di\Annotation\Aspect;
|
||||
use Hyperf\Di\Aop\AbstractAspect;
|
||||
use Hyperf\Di\Aop\ProceedingJoinPoint;
|
||||
|
||||
#[Aspect]
|
||||
class FailCacheAspect extends AbstractAspect
|
||||
{
|
||||
public array $classes = [];
|
||||
|
13
src/cache/src/ConfigProvider.php
vendored
13
src/cache/src/ConfigProvider.php
vendored
@ -11,6 +11,10 @@ declare(strict_types=1);
|
||||
*/
|
||||
namespace Hyperf\Cache;
|
||||
|
||||
use Hyperf\Cache\Aspect\CacheableAspect;
|
||||
use Hyperf\Cache\Aspect\CacheEvictAspect;
|
||||
use Hyperf\Cache\Aspect\CachePutAspect;
|
||||
use Hyperf\Cache\Aspect\FailCacheAspect;
|
||||
use Hyperf\Cache\Listener\DeleteListener;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
|
||||
@ -27,14 +31,17 @@ class ConfigProvider
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
'collectors' => [
|
||||
CacheListenerCollector::class,
|
||||
],
|
||||
],
|
||||
],
|
||||
'aspects' => [
|
||||
CacheableAspect::class,
|
||||
CacheEvictAspect::class,
|
||||
CachePutAspect::class,
|
||||
FailCacheAspect::class,
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
'id' => 'config',
|
||||
|
@ -13,12 +13,10 @@ namespace Hyperf\CircuitBreaker\Aspect;
|
||||
|
||||
use Hyperf\CircuitBreaker\Annotation\CircuitBreaker;
|
||||
use Hyperf\CircuitBreaker\Handler\HandlerInterface;
|
||||
use Hyperf\Di\Annotation\Aspect;
|
||||
use Hyperf\Di\Aop\AbstractAspect;
|
||||
use Hyperf\Di\Aop\ProceedingJoinPoint;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
#[Aspect]
|
||||
class BreakerAnnotationAspect extends AbstractAspect
|
||||
{
|
||||
public array $annotations = [
|
||||
|
@ -11,17 +11,15 @@ declare(strict_types=1);
|
||||
*/
|
||||
namespace Hyperf\CircuitBreaker;
|
||||
|
||||
use Hyperf\CircuitBreaker\Aspect\BreakerAnnotationAspect;
|
||||
|
||||
class ConfigProvider
|
||||
{
|
||||
public function __invoke(): array
|
||||
{
|
||||
return [
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
'aspects' => [
|
||||
BreakerAnnotationAspect::class,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@ -18,9 +18,9 @@ class ConfigFactory
|
||||
{
|
||||
public function __invoke(ContainerInterface $container)
|
||||
{
|
||||
$configPath = BASE_PATH . '/config/';
|
||||
$config = $this->readConfig($configPath . 'config.php');
|
||||
$autoloadConfig = $this->readPaths([BASE_PATH . '/config/autoload']);
|
||||
$configPath = BASE_PATH . '/config';
|
||||
$config = $this->readConfig($configPath . '/config.php');
|
||||
$autoloadConfig = $this->readPaths([$configPath . '/autoload']);
|
||||
$merged = array_merge_recursive(ProviderConfig::load(), $config, ...$autoloadConfig);
|
||||
return new Config($merged);
|
||||
}
|
||||
@ -34,7 +34,7 @@ class ConfigFactory
|
||||
return is_array($config) ? $config : [];
|
||||
}
|
||||
|
||||
private function readPaths(array $paths)
|
||||
private function readPaths(array $paths): array
|
||||
{
|
||||
$configs = [];
|
||||
$finder = new Finder();
|
||||
|
@ -29,13 +29,6 @@ class ConfigProvider
|
||||
'listeners' => [
|
||||
RegisterPropertyHandlerListener::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -28,13 +28,6 @@ class ConfigProvider
|
||||
CrontabRegisterListener::class,
|
||||
OnPipeMessageListener::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
'id' => 'config',
|
||||
|
@ -27,13 +27,6 @@ class ConfigProvider
|
||||
'listeners' => [
|
||||
RegisterConnectionListener::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -14,12 +14,10 @@ namespace Hyperf\DbConnection\Aspect;
|
||||
use Hyperf\DbConnection\Annotation\Transactional;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Hyperf\Di\Annotation\AnnotationCollector;
|
||||
use Hyperf\Di\Annotation\Aspect;
|
||||
use Hyperf\Di\Aop\AbstractAspect;
|
||||
use Hyperf\Di\Aop\ProceedingJoinPoint;
|
||||
use Hyperf\Di\Exception\AnnotationException;
|
||||
|
||||
#[Aspect]
|
||||
class TransactionAspect extends AbstractAspect
|
||||
{
|
||||
public array $annotations = [
|
||||
|
@ -15,6 +15,7 @@ use Hyperf\Database\ConnectionResolverInterface;
|
||||
use Hyperf\Database\Connectors\ConnectionFactory;
|
||||
use Hyperf\Database\Connectors\MySqlConnector;
|
||||
use Hyperf\Database\Migrations\MigrationRepositoryInterface;
|
||||
use Hyperf\DbConnection\Aspect\TransactionAspect;
|
||||
use Hyperf\DbConnection\Listener\RegisterConnectionResolverListener;
|
||||
use Hyperf\DbConnection\Pool\PoolFactory;
|
||||
|
||||
@ -33,12 +34,8 @@ class ConfigProvider
|
||||
'listeners' => [
|
||||
RegisterConnectionResolverListener::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
'aspects' => [
|
||||
TransactionAspect::class,
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
|
@ -20,13 +20,6 @@ class ConfigProvider
|
||||
],
|
||||
'commands' => [
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
'id' => 'db',
|
||||
|
@ -16,13 +16,6 @@ class ConfigProvider
|
||||
public function __invoke(): array
|
||||
{
|
||||
return [
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -19,13 +19,6 @@ class ConfigProvider
|
||||
'dependencies' => [
|
||||
KVInterface::class => KVFactory::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
'id' => 'config',
|
||||
|
@ -23,13 +23,6 @@ class ConfigProvider
|
||||
ListenerProviderInterface::class => ListenerProviderFactory::class,
|
||||
EventDispatcherInterface::class => EventDispatcherFactory::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -31,13 +31,6 @@ class ConfigProviderTest extends TestCase
|
||||
ListenerProviderInterface::class => ListenerProviderFactory::class,
|
||||
EventDispatcherInterface::class => EventDispatcherFactory::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
str_replace('/tests', '/src', __DIR__),
|
||||
],
|
||||
],
|
||||
],
|
||||
], (new ConfigProvider())());
|
||||
}
|
||||
}
|
||||
|
@ -26,13 +26,6 @@ class ConfigProvider
|
||||
'listeners' => [
|
||||
ExceptionHandlerListener::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -23,13 +23,6 @@ class ConfigProvider
|
||||
],
|
||||
'commands' => [
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
'id' => 'config',
|
||||
|
@ -24,13 +24,6 @@ class ConfigProvider
|
||||
ApplicationInterface::class => ApplicationFactory::class,
|
||||
StdoutLoggerInterface::class => StdoutLogger::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -16,13 +16,6 @@ class ConfigProvider
|
||||
public function __invoke(): array
|
||||
{
|
||||
return [
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -16,13 +16,6 @@ class ConfigProvider
|
||||
public function __invoke()
|
||||
{
|
||||
return [
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -25,13 +25,6 @@ class ConfigProvider
|
||||
ServerRequestInterface::class => Request::class,
|
||||
ResponseInterface::class => Response::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -32,13 +32,6 @@ class ConfigProvider
|
||||
return null;
|
||||
}),
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -27,13 +27,6 @@ class ConfigProvider
|
||||
],
|
||||
'commands' => [
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
'id' => 'config',
|
||||
|
@ -16,13 +16,6 @@ class ConfigProvider
|
||||
public function __invoke(): array
|
||||
{
|
||||
return [
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
'id' => 'config',
|
||||
|
@ -25,13 +25,6 @@ class ConfigProviderTest extends TestCase
|
||||
$dir = str_replace('/tests', '/src', __DIR__);
|
||||
|
||||
$this->assertSame([
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
$dir,
|
||||
],
|
||||
],
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
'id' => 'config',
|
||||
|
@ -16,13 +16,6 @@ class ConfigProvider
|
||||
public function __invoke(): array
|
||||
{
|
||||
return [
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -11,13 +11,11 @@ declare(strict_types=1);
|
||||
*/
|
||||
namespace Hyperf\Metric\Aspect;
|
||||
|
||||
use Hyperf\Di\Annotation\Aspect;
|
||||
use Hyperf\Di\Aop\AbstractAspect;
|
||||
use Hyperf\Di\Aop\ProceedingJoinPoint;
|
||||
use Hyperf\Metric\Annotation\Counter;
|
||||
use Hyperf\Metric\Contract\MetricFactoryInterface;
|
||||
|
||||
#[Aspect]
|
||||
class CounterAnnotationAspect extends AbstractAspect
|
||||
{
|
||||
public array $classes = [];
|
||||
|
@ -11,13 +11,11 @@ declare(strict_types=1);
|
||||
*/
|
||||
namespace Hyperf\Metric\Aspect;
|
||||
|
||||
use Hyperf\Di\Annotation\Aspect;
|
||||
use Hyperf\Di\Aop\AbstractAspect;
|
||||
use Hyperf\Di\Aop\ProceedingJoinPoint;
|
||||
use Hyperf\Metric\Annotation\Histogram;
|
||||
use Hyperf\Metric\Timer;
|
||||
|
||||
#[Aspect]
|
||||
class HistogramAnnotationAspect extends AbstractAspect
|
||||
{
|
||||
public array $classes = [];
|
||||
|
@ -13,6 +13,8 @@ namespace Hyperf\Metric;
|
||||
|
||||
use Domnikl\Statsd\Connection;
|
||||
use Domnikl\Statsd\Connection\UdpSocket;
|
||||
use Hyperf\Metric\Aspect\CounterAnnotationAspect;
|
||||
use Hyperf\Metric\Aspect\HistogramAnnotationAspect;
|
||||
use Hyperf\Metric\Contract\MetricFactoryInterface;
|
||||
use Hyperf\Metric\Listener\OnBeforeHandle;
|
||||
use Hyperf\Metric\Listener\OnMetricFactoryReady;
|
||||
@ -35,12 +37,9 @@ class ConfigProvider
|
||||
Connection::class => UdpSocket::class,
|
||||
DriverInterface::class => Guzzle::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
'aspects' => [
|
||||
CounterAnnotationAspect::class,
|
||||
HistogramAnnotationAspect::class,
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
|
@ -23,13 +23,6 @@ class ConfigProvider
|
||||
DeleteCacheListener::class,
|
||||
DeleteCacheInTransactionListener::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
'id' => 'config',
|
||||
|
@ -30,13 +30,6 @@ class ConfigProvider
|
||||
'listeners' => [
|
||||
BeforeMainServerStartListener::class => 99,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
'id' => 'config',
|
||||
|
@ -45,9 +45,9 @@ class ConfigFactory
|
||||
{
|
||||
public function __invoke(ContainerInterface \$container)
|
||||
{
|
||||
\$configPath = BASE_PATH . '/config/';
|
||||
\$config = \$this->readConfig(\$configPath . 'config.php');
|
||||
\$autoloadConfig = \$this->readPaths([BASE_PATH . '/config/autoload']);
|
||||
\$configPath = BASE_PATH . '/config';
|
||||
\$config = \$this->readConfig(\$configPath . '/config.php');
|
||||
\$autoloadConfig = \$this->readPaths([\$configPath . '/autoload']);
|
||||
\$merged = array_merge_recursive(ProviderConfig::load(), \$config, ...\$autoloadConfig);
|
||||
return new Config(\$merged);
|
||||
}
|
||||
|
@ -16,13 +16,6 @@ class ConfigProvider
|
||||
public function __invoke(): array
|
||||
{
|
||||
return [
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -25,13 +25,6 @@ class ConfigProvider
|
||||
LogAfterProcessStoppedListener::class,
|
||||
LogBeforeProcessStartListener::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ namespace Hyperf\RateLimit\Aspect;
|
||||
|
||||
use bandwidthThrottle\tokenBucket\storage\StorageException;
|
||||
use Hyperf\Contract\ConfigInterface;
|
||||
use Hyperf\Di\Annotation\Aspect;
|
||||
use Hyperf\Di\Aop\AroundInterface;
|
||||
use Hyperf\Di\Aop\ProceedingJoinPoint;
|
||||
use Hyperf\HttpServer\Contract\RequestInterface;
|
||||
@ -22,7 +21,6 @@ use Hyperf\RateLimit\Exception\RateLimitException;
|
||||
use Hyperf\RateLimit\Handler\RateLimitHandler;
|
||||
use Swoole\Coroutine;
|
||||
|
||||
#[Aspect]
|
||||
class RateLimitAnnotationAspect implements AroundInterface
|
||||
{
|
||||
public array $classes = [];
|
||||
|
@ -11,17 +11,15 @@ declare(strict_types=1);
|
||||
*/
|
||||
namespace Hyperf\RateLimit;
|
||||
|
||||
use Hyperf\RateLimit\Aspect\RateLimitAnnotationAspect;
|
||||
|
||||
class ConfigProvider
|
||||
{
|
||||
public function __invoke(): array
|
||||
{
|
||||
return [
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
'aspects' => [
|
||||
RateLimitAnnotationAspect::class,
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
|
@ -19,13 +19,6 @@ class ConfigProvider
|
||||
'dependencies' => [
|
||||
\Redis::class => Redis::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
'id' => 'config',
|
||||
|
@ -16,13 +16,6 @@ class ConfigProvider
|
||||
public function __invoke(): array
|
||||
{
|
||||
return [
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -16,13 +16,6 @@ class ConfigProvider
|
||||
public function __invoke(): array
|
||||
{
|
||||
return [
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -11,14 +11,12 @@ declare(strict_types=1);
|
||||
*/
|
||||
namespace Hyperf\Retry\Aspect;
|
||||
|
||||
use Hyperf\Di\Annotation\Aspect;
|
||||
use Hyperf\Di\Aop\AbstractAspect;
|
||||
use Hyperf\Di\Aop\ProceedingJoinPoint;
|
||||
use Hyperf\Retry\Annotation\AbstractRetry;
|
||||
use Hyperf\Retry\Annotation\Retry;
|
||||
use Hyperf\Retry\Policy\HybridRetryPolicy;
|
||||
|
||||
#[Aspect]
|
||||
class RetryAnnotationAspect extends AbstractAspect
|
||||
{
|
||||
public array $annotations = [
|
||||
|
@ -11,17 +11,15 @@ declare(strict_types=1);
|
||||
*/
|
||||
namespace Hyperf\Retry;
|
||||
|
||||
use Hyperf\Retry\Aspect\RetryAnnotationAspect;
|
||||
|
||||
class ConfigProvider
|
||||
{
|
||||
public function __invoke(): array
|
||||
{
|
||||
return [
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
'aspects' => [
|
||||
RetryAnnotationAspect::class,
|
||||
],
|
||||
'dependencies' => [
|
||||
SleepStrategyInterface::class => FlatStrategy::class,
|
||||
|
@ -21,13 +21,6 @@ class ConfigProvider
|
||||
'listeners' => [
|
||||
AddConsumerDefinitionListener::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -34,13 +34,6 @@ class ConfigProvider
|
||||
'listeners' => [
|
||||
RegisterProtocolListener::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -16,13 +16,6 @@ class ConfigProvider
|
||||
public function __invoke(): array
|
||||
{
|
||||
return [
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -20,13 +20,6 @@ class ConfigProvider
|
||||
],
|
||||
'commands' => [
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -33,13 +33,6 @@ class ConfigProvider
|
||||
'commands' => [
|
||||
StartServer::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
'id' => 'config',
|
||||
|
@ -24,13 +24,6 @@ class ConfigProvider
|
||||
'listeners' => [
|
||||
RegisterDriverListener::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -26,13 +26,6 @@ class ConfigProvider
|
||||
'listeners' => [
|
||||
RegisterServiceListener::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
'id' => 'config',
|
||||
|
@ -24,13 +24,6 @@ class ConfigProvider
|
||||
public function __invoke(): array
|
||||
{
|
||||
return [
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
'dependencies' => [
|
||||
FileHandler::class => FileHandlerFactory::class,
|
||||
DatabaseHandler::class => DatabaseHandlerFactory::class,
|
||||
|
@ -23,7 +23,7 @@ class ConfigProviderTest extends TestCase
|
||||
public function testConfigProvider()
|
||||
{
|
||||
$provider = new ConfigProvider();
|
||||
$this->assertArrayHasKey('annotations', $provider());
|
||||
$this->assertArrayHasKey('dependencies', $provider());
|
||||
$this->assertArrayHasKey('publish', $provider());
|
||||
}
|
||||
}
|
||||
|
@ -19,13 +19,6 @@ class ConfigProvider
|
||||
public function __invoke(): array
|
||||
{
|
||||
return [
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
'listeners' => [
|
||||
SignalRegisterListener::class => PHP_INT_MAX,
|
||||
SignalDeregisterListener::class,
|
||||
|
@ -11,7 +11,6 @@ declare(strict_types=1);
|
||||
*/
|
||||
namespace Hyperf\Task\Aspect;
|
||||
|
||||
use Hyperf\Di\Annotation\Aspect;
|
||||
use Hyperf\Di\Aop\AbstractAspect;
|
||||
use Hyperf\Di\Aop\ProceedingJoinPoint;
|
||||
use Hyperf\Task\Annotation\Task;
|
||||
@ -19,7 +18,6 @@ use Hyperf\Task\Task as TaskMessage;
|
||||
use Hyperf\Task\TaskExecutor;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
#[Aspect]
|
||||
class TaskAspect extends AbstractAspect
|
||||
{
|
||||
public array $annotations = [
|
||||
|
@ -11,24 +11,22 @@ declare(strict_types=1);
|
||||
*/
|
||||
namespace Hyperf\Task;
|
||||
|
||||
use Hyperf\Task\Aspect\TaskAspect;
|
||||
|
||||
class ConfigProvider
|
||||
{
|
||||
public function __invoke(): array
|
||||
{
|
||||
return [
|
||||
'aspects' => [
|
||||
TaskAspect::class,
|
||||
],
|
||||
'listeners' => [
|
||||
Listener\AfterWorkerStartListener::class,
|
||||
Listener\InitServerListener::class,
|
||||
Listener\OnFinishListener::class,
|
||||
Listener\OnTaskListener::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ declare(strict_types=1);
|
||||
namespace Hyperf\Tracer\Aspect;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use Hyperf\Di\Annotation\Aspect;
|
||||
use Hyperf\Di\Aop\AbstractAspect;
|
||||
use Hyperf\Di\Aop\ProceedingJoinPoint;
|
||||
use Hyperf\Tracer\SpanStarter;
|
||||
@ -22,7 +21,6 @@ use OpenTracing\Tracer;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use const OpenTracing\Formats\TEXT_MAP;
|
||||
|
||||
#[Aspect]
|
||||
class HttpClientAspect extends AbstractAspect
|
||||
{
|
||||
use SpanStarter;
|
||||
|
@ -11,7 +11,6 @@ declare(strict_types=1);
|
||||
*/
|
||||
namespace Hyperf\Tracer\Aspect;
|
||||
|
||||
use Hyperf\Di\Annotation\Aspect;
|
||||
use Hyperf\Di\Aop\AbstractAspect;
|
||||
use Hyperf\Di\Aop\ProceedingJoinPoint;
|
||||
use Hyperf\Redis\Redis;
|
||||
@ -20,7 +19,6 @@ use Hyperf\Tracer\SpanTagManager;
|
||||
use Hyperf\Tracer\SwitchManager;
|
||||
use OpenTracing\Tracer;
|
||||
|
||||
#[Aspect]
|
||||
class RedisAspect extends AbstractAspect
|
||||
{
|
||||
use SpanStarter;
|
||||
|
@ -11,14 +11,12 @@ declare(strict_types=1);
|
||||
*/
|
||||
namespace Hyperf\Tracer\Aspect;
|
||||
|
||||
use Hyperf\Di\Annotation\Aspect;
|
||||
use Hyperf\Di\Aop\AbstractAspect;
|
||||
use Hyperf\Di\Aop\ProceedingJoinPoint;
|
||||
use Hyperf\Tracer\Annotation\Trace;
|
||||
use Hyperf\Tracer\SpanStarter;
|
||||
use OpenTracing\Tracer;
|
||||
|
||||
#[Aspect]
|
||||
class TraceAnnotationAspect extends AbstractAspect
|
||||
{
|
||||
use SpanStarter;
|
||||
|
@ -12,6 +12,9 @@ declare(strict_types=1);
|
||||
namespace Hyperf\Tracer;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use Hyperf\Tracer\Aspect\HttpClientAspect;
|
||||
use Hyperf\Tracer\Aspect\RedisAspect;
|
||||
use Hyperf\Tracer\Aspect\TraceAnnotationAspect;
|
||||
use Hyperf\Tracer\Listener\DbQueryExecutedListener;
|
||||
use Jaeger\ThriftUdpTransport;
|
||||
use OpenTracing\Tracer;
|
||||
@ -32,14 +35,16 @@ class ConfigProvider
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
'class_map' => [
|
||||
ThriftUdpTransport::class => __DIR__ . '/../class_map/ThriftUdpTransport.php',
|
||||
],
|
||||
],
|
||||
],
|
||||
'aspects' => [
|
||||
HttpClientAspect::class,
|
||||
RedisAspect::class,
|
||||
TraceAnnotationAspect::class,
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
'id' => 'config',
|
||||
|
@ -23,13 +23,6 @@ class ConfigProvider
|
||||
TranslatorLoaderInterface::class => FileLoaderFactory::class,
|
||||
TranslatorInterface::class => TranslatorFactory::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
'id' => 'config',
|
||||
|
@ -25,13 +25,6 @@ class ConfigProvider
|
||||
Serializer::class => SerializerFactory::class,
|
||||
NormalizerInterface::class => SimpleNormalizer::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -30,13 +30,6 @@ class ConfigProvider
|
||||
PresenceVerifierInterface::class => DatabasePresenceVerifierFactory::class,
|
||||
FactoryInterface::class => ValidatorFactoryFactory::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
'id' => 'zh_CN',
|
||||
|
@ -19,13 +19,6 @@ class ConfigProvider
|
||||
'dependencies' => [
|
||||
RenderInterface::class => Render::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
'id' => 'config',
|
||||
|
@ -23,13 +23,6 @@ class ConfigProvider
|
||||
'commands' => [
|
||||
WatchCommand::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
'publish' => [
|
||||
[
|
||||
'id' => 'config',
|
||||
|
@ -16,13 +16,6 @@ class ConfigProvider
|
||||
public function __invoke(): array
|
||||
{
|
||||
return [
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -20,13 +20,6 @@ class ConfigProvider
|
||||
Listener\InitSenderListener::class,
|
||||
Listener\OnPipeMessageListener::class,
|
||||
],
|
||||
'annotations' => [
|
||||
'scan' => [
|
||||
'paths' => [
|
||||
__DIR__,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user