mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-03 12:17:48 +08:00
Upgrade the minimum php version to 8.0 for circuit-breaker and command. (#4206)
This commit is contained in:
parent
c93cb99784
commit
c1d175a502
@ -12,50 +12,35 @@ declare(strict_types=1);
|
||||
namespace Hyperf\CircuitBreaker\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\Target;
|
||||
use Hyperf\CircuitBreaker\Handler\TimeoutHandler;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
* @property float $timeout
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class CircuitBreaker extends AbstractAnnotation
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $handler = TimeoutHandler::class;
|
||||
public string $handler = TimeoutHandler::class;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $fallback;
|
||||
public ?string $fallback = null;
|
||||
|
||||
/**
|
||||
* The duration required to reset to a half open or close state.
|
||||
* @var float
|
||||
*/
|
||||
public $duration = 10;
|
||||
public float $duration = 10;
|
||||
|
||||
/**
|
||||
* The counter required to reset to a close state.
|
||||
* @var int
|
||||
*/
|
||||
public $successCounter = 10;
|
||||
public int $successCounter = 10;
|
||||
|
||||
/**
|
||||
* The counter required to reset to a open state.
|
||||
* @var int
|
||||
* The counter required to reset to an open state.
|
||||
*/
|
||||
public $failCounter = 10;
|
||||
public int $failCounter = 10;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $value;
|
||||
public array $value;
|
||||
|
||||
public function __construct(...$value)
|
||||
{
|
||||
|
@ -18,20 +18,15 @@ use Hyperf\Di\Aop\AbstractAspect;
|
||||
use Hyperf\Di\Aop\ProceedingJoinPoint;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
/**
|
||||
* @Aspect
|
||||
*/
|
||||
#[Aspect]
|
||||
class BreakerAnnotationAspect extends AbstractAspect
|
||||
{
|
||||
public $annotations = [
|
||||
CircuitBreaker::class,
|
||||
];
|
||||
|
||||
protected $container;
|
||||
|
||||
public function __construct(ContainerInterface $container)
|
||||
public function __construct(protected ContainerInterface $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
public function process(ProceedingJoinPoint $proceedingJoinPoint)
|
||||
|
@ -15,41 +15,24 @@ use Psr\Container\ContainerInterface;
|
||||
|
||||
class CircuitBreaker implements CircuitBreakerInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
protected string $name;
|
||||
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
protected $container;
|
||||
protected State $state;
|
||||
|
||||
/**
|
||||
* @var State
|
||||
*/
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
protected $timestamp;
|
||||
protected float $timestamp;
|
||||
|
||||
/**
|
||||
* Failure count.
|
||||
* @var int
|
||||
*/
|
||||
protected $failCounter;
|
||||
protected int $failCounter;
|
||||
|
||||
/**
|
||||
* Success count.
|
||||
* @var int
|
||||
*/
|
||||
protected $successCounter;
|
||||
protected int $successCounter;
|
||||
|
||||
public function __construct(ContainerInterface $container, string $name)
|
||||
public function __construct(protected ContainerInterface $container, string $name)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->name = $name;
|
||||
$this->state = make(State::class);
|
||||
$this->init();
|
||||
@ -62,9 +45,7 @@ class CircuitBreaker implements CircuitBreakerInterface
|
||||
|
||||
public function attempt(): bool
|
||||
{
|
||||
/** @var Attempt $attempt */
|
||||
$attempt = $this->container->get(Attempt::class);
|
||||
return $attempt->attempt();
|
||||
return $this->container->get(Attempt::class)->attempt();
|
||||
}
|
||||
|
||||
public function open(): void
|
||||
|
@ -15,13 +15,13 @@ use Psr\Container\ContainerInterface;
|
||||
|
||||
class CircuitBreakerFactory
|
||||
{
|
||||
protected $container;
|
||||
/**
|
||||
* @var CircuitBreakerInterface[]
|
||||
*/
|
||||
protected array $breakers = [];
|
||||
|
||||
protected $breakers = [];
|
||||
|
||||
public function __construct(ContainerInterface $container)
|
||||
public function __construct(protected ContainerInterface $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
public function get(string $name): ?CircuitBreakerInterface
|
||||
|
@ -15,18 +15,12 @@ class CircuitBreakerException extends \RuntimeException
|
||||
{
|
||||
public $result;
|
||||
|
||||
/**
|
||||
* @param mixed $result
|
||||
*/
|
||||
public function setResult($result): self
|
||||
public function setResult($result): static
|
||||
{
|
||||
$this->result = $result;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getResult()
|
||||
{
|
||||
return $this->result;
|
||||
|
@ -20,27 +20,16 @@ use Hyperf\CircuitBreaker\FallbackInterface;
|
||||
use Hyperf\Contract\StdoutLoggerInterface;
|
||||
use Hyperf\Di\Aop\ProceedingJoinPoint;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
abstract class AbstractHandler implements HandlerInterface
|
||||
{
|
||||
/**
|
||||
* @var CircuitBreakerFactory
|
||||
*/
|
||||
protected $factory;
|
||||
protected CircuitBreakerFactory $factory;
|
||||
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
protected $container;
|
||||
protected LoggerInterface $logger;
|
||||
|
||||
/**
|
||||
* @var StdoutLoggerInterface
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
public function __construct(ContainerInterface $container)
|
||||
public function __construct(protected ContainerInterface $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->factory = $container->get(CircuitBreakerFactory::class);
|
||||
$this->logger = $container->get(StdoutLoggerInterface::class);
|
||||
}
|
||||
@ -139,10 +128,7 @@ abstract class AbstractHandler implements HandlerInterface
|
||||
);
|
||||
$this->logger->debug($info);
|
||||
$breaker->halfOpen();
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ class State
|
||||
|
||||
public const OPEN = 2;
|
||||
|
||||
protected $state;
|
||||
protected int $state;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -14,10 +14,6 @@ namespace Hyperf\Command\Annotation;
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class Command extends AbstractAnnotation
|
||||
{
|
||||
|
@ -19,6 +19,7 @@ use Swoole\ExitException;
|
||||
use Symfony\Component\Console\Command\Command as SymfonyCommand;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
||||
use Symfony\Component\Console\Helper\Table;
|
||||
use Symfony\Component\Console\Helper\TableStyle;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
@ -32,58 +33,39 @@ abstract class Command extends SymfonyCommand
|
||||
|
||||
/**
|
||||
* The name of the command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
protected ?string $name = null;
|
||||
|
||||
protected ?InputInterface $input = null;
|
||||
|
||||
/**
|
||||
* @var InputInterface
|
||||
* @var null|SymfonyStyle
|
||||
*/
|
||||
protected $input;
|
||||
|
||||
/**
|
||||
* @var SymfonyStyle
|
||||
*/
|
||||
protected $output;
|
||||
protected ?OutputInterface $output = null;
|
||||
|
||||
/**
|
||||
* The default verbosity of output commands.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $verbosity = OutputInterface::VERBOSITY_NORMAL;
|
||||
protected int $verbosity = OutputInterface::VERBOSITY_NORMAL;
|
||||
|
||||
/**
|
||||
* Execution in a coroutine environment.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $coroutine = true;
|
||||
protected bool $coroutine = true;
|
||||
|
||||
/**
|
||||
* @var null|EventDispatcherInterface
|
||||
*/
|
||||
protected $eventDispatcher;
|
||||
protected ?EventDispatcherInterface $eventDispatcher = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $hookFlags;
|
||||
protected int $hookFlags = -1;
|
||||
|
||||
/**
|
||||
* The name and signature of the command.
|
||||
*
|
||||
* @var null|string
|
||||
*/
|
||||
protected $signature;
|
||||
protected ?string $signature = null;
|
||||
|
||||
/**
|
||||
* The mapping between human readable verbosity levels and Symfony's OutputInterface.
|
||||
*
|
||||
* @var array
|
||||
* The mapping between human-readable verbosity levels and Symfony's OutputInterface.
|
||||
*/
|
||||
protected $verbosityMap
|
||||
protected array $verbosityMap
|
||||
= [
|
||||
'v' => OutputInterface::VERBOSITY_VERBOSE,
|
||||
'vv' => OutputInterface::VERBOSITY_VERY_VERBOSE,
|
||||
@ -94,25 +76,21 @@ abstract class Command extends SymfonyCommand
|
||||
|
||||
/**
|
||||
* The exit code of the command.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $exitCode = 0;
|
||||
protected int $exitCode = 0;
|
||||
|
||||
public function __construct(string $name = null)
|
||||
{
|
||||
if (! $name && $this->name) {
|
||||
$name = $this->name;
|
||||
}
|
||||
$this->name = $name ?? $this->name;
|
||||
|
||||
if (! is_int($this->hookFlags)) {
|
||||
if ($this->hookFlags < 0) {
|
||||
$this->hookFlags = swoole_hook_flags();
|
||||
}
|
||||
|
||||
if (isset($this->signature)) {
|
||||
$this->configureUsingFluentDefinition();
|
||||
} else {
|
||||
parent::__construct($name);
|
||||
parent::__construct($this->name);
|
||||
}
|
||||
|
||||
$this->addEnableDispatcherOption();
|
||||
@ -138,18 +116,16 @@ abstract class Command extends SymfonyCommand
|
||||
|
||||
/**
|
||||
* Prompt the user for input.
|
||||
*
|
||||
* @param null|mixed $default
|
||||
*/
|
||||
public function ask(string $question, $default = null)
|
||||
public function ask(string $question, string $default = null)
|
||||
{
|
||||
return $this->output->ask($question, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prompt the user for input with auto completion.
|
||||
* Prompt the user for input with auto-completion.
|
||||
*
|
||||
* @param null|mixed $default
|
||||
* @param null|bool|float|int|string $default
|
||||
*/
|
||||
public function anticipate(string $question, array $choices, $default = null)
|
||||
{
|
||||
@ -157,9 +133,9 @@ abstract class Command extends SymfonyCommand
|
||||
}
|
||||
|
||||
/**
|
||||
* Prompt the user for input with auto completion.
|
||||
* Prompt the user for input with auto-completion.
|
||||
*
|
||||
* @param null|mixed $default
|
||||
* @param null|bool|float|int|string $default
|
||||
*/
|
||||
public function askWithCompletion(string $question, array $choices, $default = null)
|
||||
{
|
||||
@ -184,7 +160,7 @@ abstract class Command extends SymfonyCommand
|
||||
|
||||
/**
|
||||
* Give the user a multiple choice from an array of answers.
|
||||
* @param null|mixed $default
|
||||
* @param mixed $default
|
||||
*/
|
||||
public function choiceMultiple(
|
||||
string $question,
|
||||
@ -202,7 +178,7 @@ abstract class Command extends SymfonyCommand
|
||||
/**
|
||||
* Give the user a single choice from an array of answers.
|
||||
*
|
||||
* @param null|mixed $default
|
||||
* @param mixed $default
|
||||
*/
|
||||
public function choice(
|
||||
string $question,
|
||||
@ -215,11 +191,8 @@ abstract class Command extends SymfonyCommand
|
||||
|
||||
/**
|
||||
* Format input to textual table.
|
||||
*
|
||||
* @param mixed $rows
|
||||
* @param mixed $tableStyle
|
||||
*/
|
||||
public function table(array $headers, $rows, $tableStyle = 'default', array $columnStyles = []): void
|
||||
public function table(array $headers, array|Arrayable $rows, TableStyle|string $tableStyle = 'default', array $columnStyles = []): void
|
||||
{
|
||||
$table = new Table($this->output);
|
||||
|
||||
@ -227,7 +200,7 @@ abstract class Command extends SymfonyCommand
|
||||
$rows = $rows->toArray();
|
||||
}
|
||||
|
||||
$table->setHeaders((array) $headers)->setRows($rows)->setStyle($tableStyle);
|
||||
$table->setHeaders($headers)->setRows($rows)->setStyle($tableStyle);
|
||||
|
||||
foreach ($columnStyles as $columnIndex => $columnStyle) {
|
||||
$table->setColumnStyle($columnIndex, $columnStyle);
|
||||
@ -375,7 +348,7 @@ abstract class Command extends SymfonyCommand
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the context passed to the command.
|
||||
* Get all the context passed to the command.
|
||||
*/
|
||||
protected function context(): array
|
||||
{
|
||||
@ -395,9 +368,9 @@ abstract class Command extends SymfonyCommand
|
||||
*/
|
||||
protected function specifyParameters(): void
|
||||
{
|
||||
// We will loop through all of the arguments and options for the command and
|
||||
// We will loop through all the arguments and options for the command and
|
||||
// set them all on the base command instance. This specifies what can get
|
||||
// passed into these commands as "parameters" to control the execution.
|
||||
// past into these commands as "parameters" to control the execution.
|
||||
if (method_exists($this, 'getArguments')) {
|
||||
foreach ($this->getArguments() ?? [] as $arguments) {
|
||||
call_user_func_array([$this, 'addArgument'], $arguments);
|
||||
|
@ -26,7 +26,8 @@ trait EnableEventDispatcher
|
||||
public function enableDispatcher(InputInterface $input)
|
||||
{
|
||||
if ($input->getOption('enable-event-dispatcher')) {
|
||||
$this->eventDispatcher = ApplicationContext::getContainer()->get(EventDispatcherInterface::class);
|
||||
$dispatcher = ApplicationContext::getContainer()->get(EventDispatcherInterface::class);
|
||||
$this->eventDispatcher = $dispatcher instanceof EventDispatcherInterface ? $dispatcher : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,14 +15,8 @@ use Hyperf\Command\Command;
|
||||
|
||||
abstract class Event
|
||||
{
|
||||
/**
|
||||
* @var Command
|
||||
*/
|
||||
protected $command;
|
||||
|
||||
public function __construct(Command $command)
|
||||
public function __construct(protected Command $command)
|
||||
{
|
||||
$this->command = $command;
|
||||
}
|
||||
|
||||
public function getCommand(): Command
|
||||
|
@ -16,16 +16,9 @@ use Throwable;
|
||||
|
||||
class FailToHandle extends Event
|
||||
{
|
||||
/**
|
||||
* @var Throwable
|
||||
*/
|
||||
protected $throwable;
|
||||
|
||||
public function __construct(Command $command, Throwable $throwable)
|
||||
public function __construct(Command $command, protected Throwable $throwable)
|
||||
{
|
||||
parent::__construct($command);
|
||||
|
||||
$this->throwable = $throwable;
|
||||
}
|
||||
|
||||
public function getThrowable(): Throwable
|
||||
|
@ -51,7 +51,7 @@ class Parser
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract all of the parameters from the tokens.
|
||||
* Extract all the parameters from the tokens.
|
||||
*/
|
||||
protected static function parameters(array $tokens): array
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ use Hyperf\Command\Command;
|
||||
|
||||
class SwooleFlagsCommand extends Command
|
||||
{
|
||||
protected $hookFlags = SWOOLE_HOOK_CURL | SWOOLE_HOOK_ALL;
|
||||
protected int $hookFlags = SWOOLE_HOOK_CURL | SWOOLE_HOOK_ALL;
|
||||
|
||||
public function handle()
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ class CommandTest extends TestCase
|
||||
public function testExitCodeWhenThrowException()
|
||||
{
|
||||
/** @var FooExceptionCommand $command */
|
||||
$command = new ClassInvoker(new FooExceptionCommand());
|
||||
$command = new ClassInvoker(new FooExceptionCommand('foo'));
|
||||
$input = Mockery::mock(InputInterface::class);
|
||||
$input->shouldReceive('getOption')->andReturnFalse();
|
||||
$exitCode = $command->execute($input, Mockery::mock(OutputInterface::class));
|
||||
|
@ -23,10 +23,8 @@ class FreshCommand extends Command
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'migrate:fresh';
|
||||
protected ?string $name = 'migrate:fresh';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
@ -18,10 +18,8 @@ class InstallCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'migrate:install';
|
||||
protected ?string $name = 'migrate:install';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
@ -19,7 +19,7 @@ class MigrateCommand extends BaseCommand
|
||||
{
|
||||
use ConfirmableTrait;
|
||||
|
||||
protected $name = 'migrate';
|
||||
protected ?string $name = 'migrate';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
@ -21,10 +21,8 @@ class RefreshCommand extends Command
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'migrate:refresh';
|
||||
protected ?string $name = 'migrate:refresh';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
@ -21,10 +21,8 @@ class ResetCommand extends BaseCommand
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'migrate:reset';
|
||||
protected ?string $name = 'migrate:reset';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
@ -21,10 +21,8 @@ class RollbackCommand extends BaseCommand
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'migrate:rollback';
|
||||
protected ?string $name = 'migrate:rollback';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
@ -19,10 +19,8 @@ class StatusCommand extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'migrate:status';
|
||||
protected ?string $name = 'migrate:status';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
@ -29,7 +29,6 @@ use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
class ModelCommand extends Command
|
||||
{
|
||||
@ -58,16 +57,6 @@ class ModelCommand extends Command
|
||||
*/
|
||||
protected $printer;
|
||||
|
||||
/**
|
||||
* @var SymfonyStyle
|
||||
*/
|
||||
protected $output;
|
||||
|
||||
/**
|
||||
* @var InputInterface
|
||||
*/
|
||||
protected $input;
|
||||
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
parent::__construct('gen:model');
|
||||
|
@ -21,10 +21,8 @@ class SeedCommand extends BaseCommand
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'db:seed';
|
||||
protected ?string $name = 'db:seed';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
@ -14,10 +14,6 @@ namespace Hyperf\Cache\Annotation;
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class CacheEvict extends AbstractAnnotation
|
||||
{
|
||||
|
@ -14,10 +14,6 @@ namespace Hyperf\Cache\Annotation;
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class CachePut extends AbstractAnnotation
|
||||
{
|
||||
|
@ -14,10 +14,6 @@ namespace Hyperf\Cache\Annotation;
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class Cacheable extends AbstractAnnotation
|
||||
{
|
||||
|
@ -14,10 +14,6 @@ namespace Hyperf\Cache\Annotation;
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class FailCache extends AbstractAnnotation
|
||||
{
|
||||
|
@ -12,12 +12,9 @@ declare(strict_types=1);
|
||||
namespace Hyperf\CircuitBreaker\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\Target;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
* @property float $timeout
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
|
@ -14,10 +14,6 @@ namespace Hyperf\Command\Annotation;
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class Command extends AbstractAnnotation
|
||||
{
|
||||
|
@ -22,10 +22,8 @@ class FlushCommand extends HyperfCommand
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'scout:flush';
|
||||
protected ?string $name = 'scout:flush';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
@ -22,10 +22,8 @@ class ImportCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'scout:import';
|
||||
protected ?string $name = 'scout:import';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
@ -19,7 +19,7 @@ use const OpenApi\UNDEFINED;
|
||||
|
||||
class GenCommand extends Command
|
||||
{
|
||||
protected $name = 'swagger:gen';
|
||||
protected ?string $name = 'swagger:gen';
|
||||
|
||||
public function handle()
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ use Hyperf\Command\Command as HyperfCommand;
|
||||
|
||||
class ViewPublishCommand extends HyperfCommand
|
||||
{
|
||||
protected $signature = 'view:publish {--f|force}';
|
||||
protected ?string $signature = 'view:publish {--f|force}';
|
||||
|
||||
protected $packages = [
|
||||
'hyperf/session',
|
||||
|
Loading…
Reference in New Issue
Block a user