From d2dc13f418bda2ab5958667aad06d70c9d22ed7a Mon Sep 17 00:00:00 2001 From: zxin <14545600+NHZEX@users.noreply.github.com> Date: Thu, 27 Apr 2023 18:49:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0`php-cs-fixer`=E5=B9=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=20(#505)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 更新 php-cs-fixer 版本 * 修复 phpstan 依赖关系 * 屏蔽警告 * fix phpstan * 修复依赖关系 * fix style * 修复依赖关系 * 声明版本 --- composer.json | 9 ++++---- {src/Util/File => dev/PHPStan}/FileFinder.php | 23 ++++++++++++++++--- phpstan-components.neon | 4 ++-- phpstan.neon | 8 +++++-- src/Bean/Annotation/Bean.php | 1 + src/Bean/Annotation/ClassEventListener.php | 1 + src/Bean/Annotation/Listener.php | 1 + src/Bean/Annotation/Partial.php | 1 + src/Bean/Scanner.php | 5 ++-- src/Cli/Annotation/Arg.php | 1 + src/Cli/Annotation/Argument.php | 1 + src/Cli/Annotation/Command.php | 1 + src/Cli/Annotation/CommandAction.php | 1 + src/Cli/Annotation/Operation.php | 1 + src/Cli/Annotation/Option.php | 1 + src/Cli/Annotation/Tool.php | 1 + src/Cli/Tools/Imi/Imi.php | 4 ++++ .../Base/MemberOperationRelationBase.php | 1 + .../src/Model/Base/MemberRoleRelationBase.php | 1 + .../src/Model/Base/OperationBase.php | 1 + .../src/Model/Base/RoleBase.php | 1 + .../Model/Base/RoleOperationRelationBase.php | 1 + .../amqp/example/AMQP/Test/TestConsumer.php | 2 ++ .../amqp/example/AMQP/Test/TestPublisher.php | 4 ++++ .../amqp/example/AMQP/Test2/TestConsumer2.php | 1 + .../example/AMQP/Test2/TestPublisher2.php | 3 +++ src/Components/amqp/example/config/config.php | 4 ++-- src/Components/amqp/tests/PHPUnitHook.php | 5 ++-- .../ApiServer/Controller/IndexController.php | 3 +++ src/Components/apidoc/src/Tool/DocTool.php | 2 ++ src/Components/fpm/src/Server/Cli/Server.php | 4 ++-- .../tests/Web/Controller/IndexController.php | 4 ++++ src/Components/grpc/example/config/config.php | 4 ++-- .../src/Route/Annotation/HproseRoute.php | 1 + .../kafka/example/Kafka/Test/TestConsumer.php | 1 + .../kafka/example/config/config.php | 4 ++-- src/Components/macro/src/AutoLoader.php | 3 +-- .../src/Model/Cli/Model/ModelGenerate.php | 2 ++ .../pgsql/tests/Model/MemberWithSqlField.php | 2 ++ .../ApiServer/Controller/IndexController.php | 1 + .../queue/example/config/config.php | 4 ++-- src/Components/queue/src/Tool/QueueTool.php | 3 +++ .../roadrunner/src/Server/Cli/Server.php | 4 ++++ .../roadrunner/src/Server/Http/Server.php | 9 +++----- .../HttpServer/Controller/IndexController.php | 4 ++++ .../rpc/src/Route/Annotation/RpcAction.php | 1 + .../src/Route/Annotation/RpcController.php | 1 + .../rpc/src/Route/Annotation/RpcRoute.php | 1 + src/Components/smarty/example/Main.php | 2 +- .../MainServer/Controller/IndexController.php | 1 + .../snowflake/tests/Model/ArticleId.php | 5 ++++ .../Controller/Http/IndexController.php | 1 + .../MainServer/Controller/TestController.php | 1 + .../swoole/src/HotUpdate/HotUpdateProcess.php | 1 + .../swoole/src/Process/Annotation/Process.php | 1 + .../src/Process/Annotation/ProcessPool.php | 1 + .../swoole/src/Process/Cli/Process.php | 5 ++++ .../swoole/src/Process/ProcessManager.php | 5 ++-- .../swoole/src/Server/Cli/Server.php | 2 ++ src/Components/swoole/src/SwooleApp.php | 5 ++-- .../swoole/src/Task/Annotation/Task.php | 1 + .../ApiServer/Controller/IndexController.php | 4 ++++ .../tests/unit/HttpServer/Cron/TaskCron.php | 1 + .../unit/HttpServer/Cron/TaskProcess.php | 1 + .../HttpServer/Tests/CustomSessionIdTest.php | 4 ++-- .../tests/unit/HttpServer/Tests/Http2Test.php | 4 ++-- .../tests/unit/HttpServer/Tests/HttpsTest.php | 4 ++-- .../Controller/Http/IndexController.php | 2 ++ .../unit/WebSocketServer/config/config.php | 4 ++-- .../Controller/Http/IndexController.php | 2 ++ .../Controller/Http/IndexController.php | 2 ++ .../Controller/Http/IndexController.php | 2 ++ .../Controller/Http/IndexController.php | 2 ++ .../tests/unit/AppServer/config/config.php | 4 ++-- .../src/HotUpdate/HotUpdateProcess.php | 1 + .../src/Process/Annotation/Process.php | 1 + .../workerman/src/Process/Cli/Process.php | 1 + .../workerman/src/Server/Cli/Server.php | 1 + src/Components/workerman/src/WorkermanApp.php | 5 ++-- .../ApiServer/Controller/IndexController.php | 4 ++++ .../tests/unit/AppServer/config/config.php | 4 ++-- .../ApiServer/Controller/IndexController.php | 4 ++++ src/Enum/Annotation/EnumItem.php | 1 + src/Facade/Cli/FacadeGenerate.php | 2 ++ src/Model/Cli/Model/ModelGenerate.php | 2 ++ src/Model/Cli/Table/TableGenerate.php | 1 + .../Cli/RequestContextProxyGenerate.php | 1 + src/Server/Http/Cli/ControllerGenerate.php | 2 ++ .../Http/Message/Proxy/RequestProxyObject.php | 1 + .../Message/Proxy/ResponseProxyObject.php | 1 + src/Server/Http/Route/Annotation/Action.php | 1 + .../Http/Route/Annotation/Controller.php | 1 + .../Http/Route/Annotation/Middleware.php | 1 + src/Server/Http/Route/Annotation/Route.php | 1 + .../Message/Proxy/ReceiveDataProxy.php | 1 + .../TcpServer/Route/Annotation/TcpAction.php | 1 + .../Route/Annotation/TcpController.php | 1 + .../Route/Annotation/TcpMiddleware.php | 1 + .../TcpServer/Route/Annotation/TcpRoute.php | 1 + .../Message/Proxy/PacketDataProxy.php | 1 + .../UdpServer/Route/Annotation/UdpAction.php | 1 + .../Route/Annotation/UdpController.php | 1 + .../Route/Annotation/UdpMiddleware.php | 1 + .../UdpServer/Route/Annotation/UdpRoute.php | 1 + src/Server/View/Annotation/View.php | 1 + .../WebSocket/Message/Proxy/FrameProxy.php | 1 + .../WebSocket/Route/Annotation/WSAction.php | 1 + .../WebSocket/Route/Annotation/WSConfig.php | 1 + .../Route/Annotation/WSController.php | 1 + .../Route/Annotation/WSMiddleware.php | 1 + .../WebSocket/Route/Annotation/WSRoute.php | 1 + src/Tool/Annotation/Arg.php | 1 + src/Tool/Annotation/Operation.php | 1 + src/Tool/Annotation/Tool.php | 1 + src/Util/Imi.php | 5 ++-- .../unit/Component/Inject/Classes/TestArg.php | 1 + tests/unit/Component/Model/Article.php | 7 ++++++ tests/unit/Component/Model/ArticleId.php | 5 ++++ .../Component/Model/Base/Article2Base.php | 2 ++ .../unit/Component/Model/Base/ArticleBase.php | 2 ++ .../Component/Model/Base/ArticleExBase.php | 2 ++ .../Component/Model/Base/CreateTimeBase.php | 2 ++ .../unit/Component/Model/Base/MemberBase.php | 2 ++ .../Model/Base/MemberRoleRelationBase.php | 2 ++ .../Component/Model/Base/PerformanceBase.php | 2 ++ .../Component/Model/Base/PolymorphicBase.php | 2 ++ .../unit/Component/Model/Base/PrefixBase.php | 2 ++ tests/unit/Component/Model/Base/RoleBase.php | 2 ++ .../Component/Model/Base/TestEnumBase.php | 2 ++ .../Model/Base/TestFieldNameBase.php | 2 ++ .../Component/Model/Base/TestJsonBase.php | 2 ++ .../Component/Model/Base/TestListBase.php | 2 ++ .../unit/Component/Model/Base/TestSetBase.php | 2 ++ .../Model/Base/TestSoftDeleteBase.php | 2 ++ .../Model/Base/TestWithMemberBase.php | 2 ++ tests/unit/Component/Model/Base/TreeBase.php | 2 ++ .../unit/Component/Model/Base/UnusedBase.php | 2 ++ .../Component/Model/Base/UpdateTimeBase.php | 2 ++ .../Model/Base/VirtualColumnBase.php | 2 ++ .../Component/Model/MemberWithArticles.php | 4 ++++ .../unit/Component/Model/MemberWithRoles.php | 4 ++++ .../Component/Model/MemberWithSqlField.php | 2 ++ tests/unit/Component/Model/Polymorphic.php | 12 ++++++++++ tests/unit/Component/Model/TestWithMember.php | 3 +++ tests/unit/Component/Tests/EnvTest.php | 3 +-- tests/unit/Component/Tool/TestTool.php | 4 ++++ .../Classes/TestAutoConstructValidator.php | 7 ++++++ .../Classes/TestSceneAnnotationValidator.php | 2 ++ .../Validate/Classes/TestSceneValidator.php | 1 + .../Validate/Classes/TestValidator.php | 11 +++++++++ 150 files changed, 320 insertions(+), 62 deletions(-) rename {src/Util/File => dev/PHPStan}/FileFinder.php (73%) diff --git a/composer.json b/composer.json index d22db31ad5..663d332a8f 100644 --- a/composer.json +++ b/composer.json @@ -24,13 +24,14 @@ "yurunsoft/doctrine-annotations": "^1.73.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~3.13.0", + "composer/semver": "^3.3.2", + "php-cs-fixer/shim": "~3.15.1", "phpstan/phpstan": "~1.8.0", "phpunit/phpunit": "~9.6", "rector/rector": "~0.13", + "symfony/polyfill-uuid": "^1.27", "yurunsoft/ide-helper": "~1.0", - "yurunsoft/yurun-http": "^4.0.0", - "symfony/polyfill-uuid": "*" + "yurunsoft/yurun-http": "^4.0.0" }, "replace": { "symfony/polyfill-php71": "*", @@ -135,4 +136,4 @@ ] } } -} \ No newline at end of file +} diff --git a/src/Util/File/FileFinder.php b/dev/PHPStan/FileFinder.php similarity index 73% rename from src/Util/File/FileFinder.php rename to dev/PHPStan/FileFinder.php index 897cd986ca..82f2166c34 100644 --- a/src/Util/File/FileFinder.php +++ b/dev/PHPStan/FileFinder.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace Imi\Util\File; +namespace Imi\Dev\PHPStan; +use Composer\Autoload\ClassLoader; use PHPStan\File\FileExcluder; use PHPStan\File\FileFinderResult; use PHPStan\File\FileHelper; use PHPStan\File\PathNotFoundException; -use Symfony\Component\Finder\Finder; class FileFinder extends \PHPStan\File\FileFinder { @@ -16,6 +16,8 @@ class FileFinder extends \PHPStan\File\FileFinder private FileHelper $fileHelper; private array $fileExtensions; + private string $finderClass; + /** * @param string[] $fileExtensions */ @@ -27,6 +29,21 @@ public function __construct( $this->fileExcluder = $fileExcluder; $this->fileHelper = $fileHelper; $this->fileExtensions = $fileExtensions; + + /** @var ClassLoader $composer */ + $composer = require 'phar://phpstan.phar/vendor/autoload.php'; + + foreach ($composer->getPrefixesPsr4() as $name => $paths) + { + if (str_ends_with($name, 'Symfony\\Component\\Finder\\')) + { + $this->finderClass = $name . 'Finder'; + } + } + if (!isset($this->finderClass)) + { + throw new \RuntimeException('[Symfony\\Component\\Finder\\Finder] not found'); + } } /** @@ -48,7 +65,7 @@ public function findFiles(array $paths): FileFinderResult } else { - $finder = new Finder(); + $finder = new $this->finderClass(); // 此行注释,防止无限套娃 // $finder->followLinks(); foreach ($finder->files()->name('*.{' . implode(',', $this->fileExtensions) . '}')->in($path) as $fileInfo) diff --git a/phpstan-components.neon b/phpstan-components.neon index cd52880f27..4a4d68c5ed 100644 --- a/phpstan-components.neon +++ b/phpstan-components.neon @@ -52,14 +52,14 @@ parameters: services: fileFinderAnalyse: - class: Imi\Util\File\FileFinder + class: Imi\Dev\PHPStan\FileFinder arguments: fileExcluder: @fileExcluderAnalyse fileExtensions: %fileExtensions% autowired: false fileFinderScan: - class: Imi\Util\File\FileFinder + class: Imi\Dev\PHPStan\FileFinder arguments: fileExcluder: @fileExcluderScan fileExtensions: %fileExtensions% diff --git a/phpstan.neon b/phpstan.neon index b4f9366b15..99e97bc012 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -44,16 +44,20 @@ parameters: message: '#Method \S+ has no return typehint specified.#' paths: - tests/unit/**Test.php + - + message: '#(Extending|Creating new|Calling) \S+ is not covered by backward compatibility promise\. The (class|method) might change in a minor PHPStan version\.#' + paths: + - dev/PHPStan/FileFinder.php services: fileFinderAnalyse: - class: Imi\Util\File\FileFinder + class: Imi\Dev\PHPStan\FileFinder arguments: fileExcluder: @fileExcluderAnalyse fileExtensions: %fileExtensions% autowired: false fileFinderScan: - class: Imi\Util\File\FileFinder + class: Imi\Dev\PHPStan\FileFinder arguments: fileExcluder: @fileExcluderScan fileExtensions: %fileExtensions% diff --git a/src/Bean/Annotation/Bean.php b/src/Bean/Annotation/Bean.php index be5cc091f2..30afed023e 100644 --- a/src/Bean/Annotation/Bean.php +++ b/src/Bean/Annotation/Bean.php @@ -10,6 +10,7 @@ * @Annotation * * @Target("CLASS") + * * @Parser("Imi\Bean\Parser\BeanParser") * * @property string|null $name Bean名称,留空则为当前类名(包含完整命名空间) diff --git a/src/Bean/Annotation/ClassEventListener.php b/src/Bean/Annotation/ClassEventListener.php index d5192b0ba6..373b1ac26d 100644 --- a/src/Bean/Annotation/ClassEventListener.php +++ b/src/Bean/Annotation/ClassEventListener.php @@ -10,6 +10,7 @@ * @Annotation * * @Target("CLASS") + * * @Parser("Imi\Bean\Parser\ClassEventParser") * * @property string $className 类名 diff --git a/src/Bean/Annotation/Listener.php b/src/Bean/Annotation/Listener.php index eaf0cf18a9..b8ab5f5c31 100644 --- a/src/Bean/Annotation/Listener.php +++ b/src/Bean/Annotation/Listener.php @@ -10,6 +10,7 @@ * @Annotation * * @Target("CLASS") + * * @Parser("Imi\Bean\Parser\ListenerParser") * * @property string $eventName 事件名 diff --git a/src/Bean/Annotation/Partial.php b/src/Bean/Annotation/Partial.php index 544fba5593..17b1bf5bcd 100644 --- a/src/Bean/Annotation/Partial.php +++ b/src/Bean/Annotation/Partial.php @@ -10,6 +10,7 @@ * @Annotation * * @Target("CLASS") + * * @Parser("Imi\Bean\Parser\PartialParser") * * @property string $class 注入类名 diff --git a/src/Bean/Scanner.php b/src/Bean/Scanner.php index 6946eda4d2..828698b4e5 100644 --- a/src/Bean/Scanner.php +++ b/src/Bean/Scanner.php @@ -7,9 +7,6 @@ use Imi\App; use Imi\Config; use Imi\Core\Component\ComponentManager; - -use function Imi\env; - use Imi\Event\Event; use Imi\Log\Log; use Imi\Main\Helper; @@ -18,6 +15,8 @@ use Imi\Util\File; use Imi\Util\Imi; +use function Imi\env; + /** * 扫描类. */ diff --git a/src/Cli/Annotation/Arg.php b/src/Cli/Annotation/Arg.php index 2fa5fb5eca..2aed7fff52 100644 --- a/src/Cli/Annotation/Arg.php +++ b/src/Cli/Annotation/Arg.php @@ -12,6 +12,7 @@ * @Annotation * * @Target("METHOD") + * * @Parser("Imi\Cli\Parser\ToolParser") */ #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] diff --git a/src/Cli/Annotation/Argument.php b/src/Cli/Annotation/Argument.php index b4bfdb1bfd..5f760aba7f 100644 --- a/src/Cli/Annotation/Argument.php +++ b/src/Cli/Annotation/Argument.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("METHOD") + * * @Parser("Imi\Cli\Parser\ToolParser") * * @property string $name 参数名称 diff --git a/src/Cli/Annotation/Command.php b/src/Cli/Annotation/Command.php index 35ff875143..d8eecc9dc6 100644 --- a/src/Cli/Annotation/Command.php +++ b/src/Cli/Annotation/Command.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("CLASS") + * * @Parser("Imi\Cli\Parser\ToolParser") * * @property string|null $name 命令行名称 diff --git a/src/Cli/Annotation/CommandAction.php b/src/Cli/Annotation/CommandAction.php index fe951e7925..002d0e3670 100644 --- a/src/Cli/Annotation/CommandAction.php +++ b/src/Cli/Annotation/CommandAction.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("METHOD") + * * @Parser("Imi\Cli\Parser\ToolParser") * * @property string|null $name 操作名称 diff --git a/src/Cli/Annotation/Operation.php b/src/Cli/Annotation/Operation.php index 3911934197..977e87635b 100644 --- a/src/Cli/Annotation/Operation.php +++ b/src/Cli/Annotation/Operation.php @@ -12,6 +12,7 @@ * @Annotation * * @Target("METHOD") + * * @Parser("Imi\Cli\Parser\ToolParser") */ #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] diff --git a/src/Cli/Annotation/Option.php b/src/Cli/Annotation/Option.php index 7842c26011..fd92363915 100644 --- a/src/Cli/Annotation/Option.php +++ b/src/Cli/Annotation/Option.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("METHOD") + * * @Parser("Imi\Cli\Parser\ToolParser") * * @property string $name 参数名称 diff --git a/src/Cli/Annotation/Tool.php b/src/Cli/Annotation/Tool.php index 0b7afe7b80..cb965bae3e 100644 --- a/src/Cli/Annotation/Tool.php +++ b/src/Cli/Annotation/Tool.php @@ -12,6 +12,7 @@ * @Annotation * * @Target("CLASS") + * * @Parser("Imi\Cli\Parser\ToolParser") */ #[\Attribute(\Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE)] diff --git a/src/Cli/Tools/Imi/Imi.php b/src/Cli/Tools/Imi/Imi.php index 132958506a..e5dd8a270e 100644 --- a/src/Cli/Tools/Imi/Imi.php +++ b/src/Cli/Tools/Imi/Imi.php @@ -26,6 +26,7 @@ class Imi extends BaseCommand * 构建框架预加载缓存. * * @CommandAction(name="buildImiRuntime", description="构建框架预加载缓存") + * * @Option(name="file", type=ArgType::STRING, default=null, comments="可以指定生成到目标文件") * @Option(name="runtimeMode", type=ArgType::STRING, default=null, comments="指定运行时模式") */ @@ -43,6 +44,7 @@ public function buildImiRuntime(?string $file, ?string $runtimeMode = null): voi * 清除框架预加载缓存. * * @CommandAction(name="clearImiRuntime", description="清除框架预加载缓存") + * * @Option(name="runtimeMode", type=ArgType::STRING, default=null, comments="指定运行时模式") */ public function clearImiRuntime(?string $runtimeMode = null): void @@ -64,6 +66,7 @@ public function clearImiRuntime(?string $runtimeMode = null): void * @PoolClean * * @CommandAction(name="buildRuntime", description="构建项目预加载缓存") + * * @Option(name="changedFilesFile", type=ArgType::STRING, default=null, comments="保存改变的文件列表的文件,一行一个") * @Option(name="confirm", type=ArgType::BOOL, default=false, comments="是否等待输入y后再构建") * @Option(name="runtimeMode", type=ArgType::STRING, default=null, comments="指定运行时模式") @@ -102,6 +105,7 @@ public function buildRuntime(?string $changedFilesFile, bool $confirm, ?string $ * 清除项目预加载缓存. * * @CommandAction(name="clearRuntime", description="清除项目预加载缓存") + * * @Option(name="runtimeMode", type=ArgType::STRING, default=null, comments="指定运行时模式") */ public function clearRuntime(?string $runtimeMode = null): void diff --git a/src/Components/access-control/src/Model/Base/MemberOperationRelationBase.php b/src/Components/access-control/src/Model/Base/MemberOperationRelationBase.php index 21352ae35a..5133e1a64e 100644 --- a/src/Components/access-control/src/Model/Base/MemberOperationRelationBase.php +++ b/src/Components/access-control/src/Model/Base/MemberOperationRelationBase.php @@ -16,6 +16,7 @@ * @Entity * * @Table(name="ac_member_operation_relation", id={"member_id", "operation_id"}) + * * @DDL("CREATE TABLE `ac_member_operation_relation` ( `member_id` INT(10) UNSIGNED NOT NULL COMMENT '用户ID', `operation_id` INT(10) UNSIGNED NOT NULL COMMENT '操作ID', PRIMARY KEY(`member_id`, `operation_id`) USING BTREE) ENGINE=InnoDB DEFAULT CHARSET=utf8") * * @property int $memberId 用户ID diff --git a/src/Components/access-control/src/Model/Base/MemberRoleRelationBase.php b/src/Components/access-control/src/Model/Base/MemberRoleRelationBase.php index 32fb361c8a..1c88c09751 100644 --- a/src/Components/access-control/src/Model/Base/MemberRoleRelationBase.php +++ b/src/Components/access-control/src/Model/Base/MemberRoleRelationBase.php @@ -16,6 +16,7 @@ * @Entity * * @Table(name="ac_member_role_relation", id={"member_id", "role_id"}) + * * @DDL("CREATE TABLE `ac_member_role_relation` ( `member_id` int(10) unsigned NOT NULL COMMENT '用户ID', `role_id` int(10) unsigned NOT NULL COMMENT '角色ID', PRIMARY KEY (`member_id`,`role_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8") * * @property int|null $memberId 用户ID diff --git a/src/Components/access-control/src/Model/Base/OperationBase.php b/src/Components/access-control/src/Model/Base/OperationBase.php index 9d4fbd4828..246c07e8aa 100644 --- a/src/Components/access-control/src/Model/Base/OperationBase.php +++ b/src/Components/access-control/src/Model/Base/OperationBase.php @@ -16,6 +16,7 @@ * @Entity * * @Table(name="ac_operation", id={"id"}) + * * @DDL("CREATE TABLE `ac_operation` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `parent_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父级ID,顶级为0', `index` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序,越小越靠前', `code` varchar(32) NOT NULL COMMENT '操作代码', `name` varchar(32) NOT NULL COMMENT '操作名称', `description` text NOT NULL COMMENT '操作介绍', PRIMARY KEY (`id`), UNIQUE KEY `code` (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8") * * @property int|null $id diff --git a/src/Components/access-control/src/Model/Base/RoleBase.php b/src/Components/access-control/src/Model/Base/RoleBase.php index 94310f2cad..aea7cb52a7 100644 --- a/src/Components/access-control/src/Model/Base/RoleBase.php +++ b/src/Components/access-control/src/Model/Base/RoleBase.php @@ -16,6 +16,7 @@ * @Entity * * @Table(name="ac_role", id={"id"}) + * * @DDL("CREATE TABLE `ac_role` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `code` varchar(32) NOT NULL COMMENT '角色代码', `name` varchar(32) NOT NULL COMMENT '角色名称', `description` text NOT NULL COMMENT '角色介绍', PRIMARY KEY (`id`), UNIQUE KEY `code` (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8") * * @property int|null $id diff --git a/src/Components/access-control/src/Model/Base/RoleOperationRelationBase.php b/src/Components/access-control/src/Model/Base/RoleOperationRelationBase.php index d59f5e514c..17264e03d0 100644 --- a/src/Components/access-control/src/Model/Base/RoleOperationRelationBase.php +++ b/src/Components/access-control/src/Model/Base/RoleOperationRelationBase.php @@ -16,6 +16,7 @@ * @Entity * * @Table(name="ac_role_operation_relation", id={"role_id", "operation_id"}) + * * @DDL("CREATE TABLE `ac_role_operation_relation` ( `role_id` int(10) unsigned NOT NULL COMMENT '角色ID', `operation_id` int(10) unsigned NOT NULL COMMENT '操作ID', PRIMARY KEY (`role_id`,`operation_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8") * * @property int|null $roleId 角色ID diff --git a/src/Components/amqp/example/AMQP/Test/TestConsumer.php b/src/Components/amqp/example/AMQP/Test/TestConsumer.php index cafc84b2e1..c6133419ef 100644 --- a/src/Components/amqp/example/AMQP/Test/TestConsumer.php +++ b/src/Components/amqp/example/AMQP/Test/TestConsumer.php @@ -17,7 +17,9 @@ * 启动一个新连接消费. * * @Bean("TestConsumer") + * * @Connection(host=AMQP_SERVER_HOST, port=5672, user="guest", password="guest") + * * @Consumer(tag="tag-imi", queue="queue-imi-1", message=\AMQPApp\AMQP\Test\TestMessage::class) */ class TestConsumer extends BaseConsumer diff --git a/src/Components/amqp/example/AMQP/Test/TestPublisher.php b/src/Components/amqp/example/AMQP/Test/TestPublisher.php index e001db6b30..2bc0fbc164 100644 --- a/src/Components/amqp/example/AMQP/Test/TestPublisher.php +++ b/src/Components/amqp/example/AMQP/Test/TestPublisher.php @@ -13,9 +13,13 @@ /** * @Bean("TestPublisher") + * * @Connection(host=AMQP_SERVER_HOST, port=5672, user="guest", password="guest") + * * @Publisher(tag="tag-imi", queue="queue-imi-1", exchange="exchange-imi", routingKey="imi-1") + * * @Queue(name="queue-imi-1", routingKey="imi-1") + * * @Exchange(name="exchange-imi") */ class TestPublisher extends BasePublisher diff --git a/src/Components/amqp/example/AMQP/Test2/TestConsumer2.php b/src/Components/amqp/example/AMQP/Test2/TestConsumer2.php index a729757114..4566ae20c2 100644 --- a/src/Components/amqp/example/AMQP/Test2/TestConsumer2.php +++ b/src/Components/amqp/example/AMQP/Test2/TestConsumer2.php @@ -16,6 +16,7 @@ * 使用连接池中的连接消费. * * @Bean("TestConsumer2") + * * @Consumer(tag="tag-imi", queue="queue-imi-2", message=\AMQPApp\AMQP\Test2\TestMessage2::class) */ class TestConsumer2 extends BaseConsumer diff --git a/src/Components/amqp/example/AMQP/Test2/TestPublisher2.php b/src/Components/amqp/example/AMQP/Test2/TestPublisher2.php index f4ea8c0dcf..a186d49bfb 100644 --- a/src/Components/amqp/example/AMQP/Test2/TestPublisher2.php +++ b/src/Components/amqp/example/AMQP/Test2/TestPublisher2.php @@ -12,8 +12,11 @@ /** * @Bean("TestPublisher2") + * * @Publisher(tag="tag-imi", queue="queue-imi-2", exchange="exchange-imi", routingKey="imi-2") + * * @Queue(name="queue-imi-2", routingKey="imi-2") + * * @Exchange(name="exchange-imi") */ class TestPublisher2 extends BasePublisher diff --git a/src/Components/amqp/example/config/config.php b/src/Components/amqp/example/config/config.php index 87d96c56e5..bf0ec28827 100644 --- a/src/Components/amqp/example/config/config.php +++ b/src/Components/amqp/example/config/config.php @@ -2,10 +2,10 @@ declare(strict_types=1); -use function Imi\env; - use Imi\Util\Imi; +use function Imi\env; + \defined('AMQP_SERVER_HOST') || \define('AMQP_SERVER_HOST', env('AMQP_SERVER_HOST', '127.0.0.1')); return [ diff --git a/src/Components/amqp/tests/PHPUnitHook.php b/src/Components/amqp/tests/PHPUnitHook.php index d1e6614906..5288a29604 100644 --- a/src/Components/amqp/tests/PHPUnitHook.php +++ b/src/Components/amqp/tests/PHPUnitHook.php @@ -6,15 +6,14 @@ use Imi\App; use Imi\Cli\CliApp; - -use function Imi\env; - use Imi\Swoole\SwooleApp; use PHPUnit\Runner\AfterLastTestHook; use PHPUnit\Runner\BeforeFirstTestHook; use Swoole\Coroutine; use Swoole\Coroutine\Channel; +use function Imi\env; + class PHPUnitHook implements BeforeFirstTestHook, AfterLastTestHook { private Channel $channel; diff --git a/src/Components/apidoc/example/ApiServer/Controller/IndexController.php b/src/Components/apidoc/example/ApiServer/Controller/IndexController.php index 6bf9709574..41ca5e614c 100644 --- a/src/Components/apidoc/example/ApiServer/Controller/IndexController.php +++ b/src/Components/apidoc/example/ApiServer/Controller/IndexController.php @@ -11,6 +11,7 @@ /** * @OA\Info(title="My First API", version="0.1") + * * @Controller("/") */ class IndexController extends HttpController @@ -66,8 +67,10 @@ public function multiMethod2(int $id) * @Action * * @Route("register") + * * @OA\Get( * path="/register", + * * @OA\Response(response="200", description="An example resource") * ) * diff --git a/src/Components/apidoc/src/Tool/DocTool.php b/src/Components/apidoc/src/Tool/DocTool.php index f7ed8eed32..b4c840ba02 100644 --- a/src/Components/apidoc/src/Tool/DocTool.php +++ b/src/Components/apidoc/src/Tool/DocTool.php @@ -38,7 +38,9 @@ class DocTool extends BaseCommand * 生成 API 接口文档. * * @CommandAction(name="api") + * * @Argument(name="to", type=ArgType::STRING, required=true, comments="生成到的目标文件名") + * * @Option(name="namespace", type=ArgType::STRING, required=false, comments="指定扫描的命名空间,多个用半角逗号分隔") */ public function api(string $to, ?string $namespace): void diff --git a/src/Components/fpm/src/Server/Cli/Server.php b/src/Components/fpm/src/Server/Cli/Server.php index ca434bd056..ca82ff4411 100644 --- a/src/Components/fpm/src/Server/Cli/Server.php +++ b/src/Components/fpm/src/Server/Cli/Server.php @@ -11,11 +11,10 @@ use Imi\Cli\Annotation\Option; use Imi\Cli\ArgType; use Imi\Cli\Contract\BaseCommand; +use Imi\Util\File; use function Imi\ttyExec; -use Imi\Util\File; - /** * @Command("fpm") */ @@ -25,6 +24,7 @@ class Server extends BaseCommand * 启动 php 内置服务器. * * @CommandAction(name="start", description="启动 php 内置服务器") + * * @Option(name="host", type=ArgType::STRING, default="0.0.0.0", comments="主机名") * @Option(name="port", type=ArgType::INT, default=8080, comments="端口") */ diff --git a/src/Components/fpm/tests/Web/Controller/IndexController.php b/src/Components/fpm/tests/Web/Controller/IndexController.php index 4838e013b7..7fed74d871 100644 --- a/src/Components/fpm/tests/Web/Controller/IndexController.php +++ b/src/Components/fpm/tests/Web/Controller/IndexController.php @@ -53,7 +53,9 @@ public function route(int $id): array * @Action * * @Route(autoEndSlash=true) + * * @View(renderType="html") + * * @HtmlView(template="html") */ public function html(int $time): array @@ -67,6 +69,7 @@ public function html(int $time): array * @Action * * @View(renderType="html") + * * @HtmlView(baseDir="index/") */ public function html2(int $time): array @@ -206,6 +209,7 @@ public function headers() * @Action * * @Route("/middleware") + * * @Middleware(\Imi\Fpm\Test\Web\Middleware\Middleware1::class) * @Middleware({ * \Imi\Fpm\Test\Web\Middleware\Middleware2::class, diff --git a/src/Components/grpc/example/config/config.php b/src/Components/grpc/example/config/config.php index e7e95a6fcd..e15495c54c 100644 --- a/src/Components/grpc/example/config/config.php +++ b/src/Components/grpc/example/config/config.php @@ -2,10 +2,10 @@ declare(strict_types=1); -use function Imi\env; - use Imi\Grpc\Client\GrpcClient; +use function Imi\env; + return [ // 项目根命名空间 'namespace' => 'GrpcApp', diff --git a/src/Components/hprose/src/Route/Annotation/HproseRoute.php b/src/Components/hprose/src/Route/Annotation/HproseRoute.php index 38e689a916..c0bce73474 100644 --- a/src/Components/hprose/src/Route/Annotation/HproseRoute.php +++ b/src/Components/hprose/src/Route/Annotation/HproseRoute.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("METHOD") + * * @Parser("Imi\Rpc\Route\Annotation\Parser\RpcControllerParser") * * @property string $rpcType RPC 协议类型;继承本类后必须赋值 diff --git a/src/Components/kafka/example/Kafka/Test/TestConsumer.php b/src/Components/kafka/example/Kafka/Test/TestConsumer.php index 44dddd6200..379a4a5b40 100644 --- a/src/Components/kafka/example/Kafka/Test/TestConsumer.php +++ b/src/Components/kafka/example/Kafka/Test/TestConsumer.php @@ -13,6 +13,7 @@ /** * @Bean("TestConsumer") + * * @Consumer(topic="queue-imi-1", groupId=@GetGroupId) */ class TestConsumer extends BaseConsumer diff --git a/src/Components/kafka/example/config/config.php b/src/Components/kafka/example/config/config.php index d0ae41162e..82604c823b 100644 --- a/src/Components/kafka/example/config/config.php +++ b/src/Components/kafka/example/config/config.php @@ -2,10 +2,10 @@ declare(strict_types=1); -use function Imi\env; - use Imi\Util\Imi; +use function Imi\env; + \defined('KAFKA_BOOTSTRAP_SERVERS') || \define('KAFKA_BOOTSTRAP_SERVERS', env('KAFKA_BOOTSTRAP_SERVERS', '127.0.0.1:9092')); return [ diff --git a/src/Components/macro/src/AutoLoader.php b/src/Components/macro/src/AutoLoader.php index 312091900d..0d73a3d7cd 100644 --- a/src/Components/macro/src/AutoLoader.php +++ b/src/Components/macro/src/AutoLoader.php @@ -6,11 +6,10 @@ use Composer\Autoload\ClassLoader; use Swoole\Coroutine; +use Yurun\Macro\MacroParser; use function Yurun\Macro\includeFile; -use Yurun\Macro\MacroParser; - class AutoLoader { protected ClassLoader $composerClassLoader; diff --git a/src/Components/pgsql/src/Model/Cli/Model/ModelGenerate.php b/src/Components/pgsql/src/Model/Cli/Model/ModelGenerate.php index fb756a5cbe..8faac70c29 100644 --- a/src/Components/pgsql/src/Model/Cli/Model/ModelGenerate.php +++ b/src/Components/pgsql/src/Model/Cli/Model/ModelGenerate.php @@ -28,8 +28,10 @@ class ModelGenerate extends BaseCommand * 如果设置了`include`或`exclude`,则按照相应规则过滤表。 * * @CommandAction("pgModel") + * * @Argument(name="namespace", type=ArgType::STRING, required=true, comments="生成的Model所在命名空间") * @Argument(name="baseClass", type=ArgType::STRING, default="Imi\Pgsql\Model\PgModel", comments="生成的Model所继承的基类,默认\Imi\Model\Model,可选") + * * @Option(name="database", type=ArgType::STRING, comments="数据库名,不传则取连接池默认配置的库名") * @Option(name="poolName", type=ArgType::STRING, comments="连接池名称,不传则取默认连接池") * @Option(name="prefix", type=ArgType::ARRAY, default={}, comments="传值则去除该表前缀,以半角逗号分隔多个前缀") diff --git a/src/Components/pgsql/tests/Model/MemberWithSqlField.php b/src/Components/pgsql/tests/Model/MemberWithSqlField.php index f7a790a460..c618f587e0 100644 --- a/src/Components/pgsql/tests/Model/MemberWithSqlField.php +++ b/src/Components/pgsql/tests/Model/MemberWithSqlField.php @@ -21,6 +21,7 @@ class MemberWithSqlField extends MemberBase { /** * @Column(name="a", virtual=true) + * * @Sql("1+1") * * @var int @@ -29,6 +30,7 @@ class MemberWithSqlField extends MemberBase /** * @Column(virtual=true) + * * @Sql("2+2") * * @var int diff --git a/src/Components/phar/tests/project/ApiServer/Controller/IndexController.php b/src/Components/phar/tests/project/ApiServer/Controller/IndexController.php index f54547d971..105a41669d 100644 --- a/src/Components/phar/tests/project/ApiServer/Controller/IndexController.php +++ b/src/Components/phar/tests/project/ApiServer/Controller/IndexController.php @@ -13,6 +13,7 @@ /** * @Controller("/") + * * @HtmlView(baseDir="index/") */ class IndexController extends HttpController diff --git a/src/Components/queue/example/config/config.php b/src/Components/queue/example/config/config.php index 779879f8e5..0769bc71ad 100644 --- a/src/Components/queue/example/config/config.php +++ b/src/Components/queue/example/config/config.php @@ -2,10 +2,10 @@ declare(strict_types=1); -use function Imi\env; - use Imi\Util\Imi; +use function Imi\env; + return [ // 项目根命名空间 'namespace' => 'QueueApp', diff --git a/src/Components/queue/src/Tool/QueueTool.php b/src/Components/queue/src/Tool/QueueTool.php index 22cea97b79..4659f633ef 100644 --- a/src/Components/queue/src/Tool/QueueTool.php +++ b/src/Components/queue/src/Tool/QueueTool.php @@ -19,6 +19,7 @@ class QueueTool extends BaseCommand * 获取队列状态 * * @CommandAction(name="status", description="获取队列状态") + * * @Argument(name="queue", type="string", required=true) * * @return void @@ -32,6 +33,7 @@ public function status(string $queue) * 将失败消息恢复到队列. * * @CommandAction(name="restoreFail", description="将失败消息恢复到队列") + * * @Argument(name="queue", type="string", required=true) * * @return void @@ -45,6 +47,7 @@ public function restoreFail(string $queue) * 将超时消息恢复到队列. * * @CommandAction(name="restoreTimeout", description="将超时消息恢复到队列") + * * @Argument(name="queue", type="string", required=true) * * @return void diff --git a/src/Components/roadrunner/src/Server/Cli/Server.php b/src/Components/roadrunner/src/Server/Cli/Server.php index a9b1a88e12..c4ab94e015 100644 --- a/src/Components/roadrunner/src/Server/Cli/Server.php +++ b/src/Components/roadrunner/src/Server/Cli/Server.php @@ -25,6 +25,7 @@ class Server extends BaseCommand * 启动 RoadRunner 服务. * * @CommandAction(name="start", description="启动 RoadRunner 服务") + * * @Option(name="workDir", shortcut="w", type=ArgType::STRING, comments="工作路径") * @Option(name="config", shortcut="c", type=ArgType::STRING, comments="配置文件路径,默认 .rr.yaml") */ @@ -38,6 +39,7 @@ public function start(?string $workDir, ?string $config): void * 停止 RoadRunner 服务. * * @CommandAction(name="stop", description="停止 RoadRunner 服务") + * * @Option(name="workDir", shortcut="w", type=ArgType::STRING, comments="工作路径") * @Option(name="config", shortcut="c", type=ArgType::STRING, comments="配置文件路径,默认 .rr.yaml") */ @@ -51,6 +53,7 @@ public function stop(?string $workDir, ?string $config): void * 重新加载 RoadRunner 服务. * * @CommandAction(name="reload", description="重新加载 RoadRunner 服务") + * * @Option(name="workDir", shortcut="w", type=ArgType::STRING, comments="工作路径") * @Option(name="config", shortcut="c", type=ArgType::STRING, comments="配置文件路径,默认 .rr.yaml") */ @@ -64,6 +67,7 @@ public function reload(?string $workDir, ?string $config): void * 热更新. * * @CommandAction(name="hotUpdate", description="热更新") + * * @Option(name="workDir", shortcut="w", type=ArgType::STRING, comments="工作路径") * @Option(name="config", shortcut="c", type=ArgType::STRING, comments="配置文件路径,默认 .rr.yaml") */ diff --git a/src/Components/roadrunner/src/Server/Http/Server.php b/src/Components/roadrunner/src/Server/Http/Server.php index d8d38d7bfd..c72187af8a 100644 --- a/src/Components/roadrunner/src/Server/Http/Server.php +++ b/src/Components/roadrunner/src/Server/Http/Server.php @@ -7,9 +7,6 @@ use Imi\App; use Imi\AppContexts; use Imi\Bean\Annotation\Bean; - -use function Imi\cmd; - use Imi\Event\Event; use Imi\Event\EventParam; use Imi\Log\Log; @@ -19,15 +16,15 @@ use Imi\Server\Contract\BaseServer; use Imi\Server\Http\Listener\HttpRouteInit; use Imi\Server\Protocol; - -use function Imi\ttyExec; - use Imi\Util\File; use Imi\Util\Imi; use Imi\Util\Socket\IPEndPoint; use Symfony\Component\Process\Process; use Symfony\Component\Yaml\Yaml; +use function Imi\cmd; +use function Imi\ttyExec; + /** * @Bean("RoadRunnerHttpServer") */ diff --git a/src/Components/roadrunner/tests/unit/HttpServer/Controller/IndexController.php b/src/Components/roadrunner/tests/unit/HttpServer/Controller/IndexController.php index 554d9408c6..47628997db 100644 --- a/src/Components/roadrunner/tests/unit/HttpServer/Controller/IndexController.php +++ b/src/Components/roadrunner/tests/unit/HttpServer/Controller/IndexController.php @@ -53,7 +53,9 @@ public function route(int $id): array * @Action * * @Route(autoEndSlash=true) + * * @View(renderType="html") + * * @HtmlView(template="html") */ public function html(int $time): array @@ -67,6 +69,7 @@ public function html(int $time): array * @Action * * @View(renderType="html") + * * @HtmlView(baseDir="index/") */ public function html2(int $time): array @@ -206,6 +209,7 @@ public function headers() * @Action * * @Route("/middleware") + * * @Middleware(\Imi\RoadRunner\Test\HttpServer\Middleware\Middleware1::class) * @Middleware({ * \Imi\RoadRunner\Test\HttpServer\Middleware\Middleware2::class, diff --git a/src/Components/rpc/src/Route/Annotation/RpcAction.php b/src/Components/rpc/src/Route/Annotation/RpcAction.php index 44155d90cd..139edbadbc 100644 --- a/src/Components/rpc/src/Route/Annotation/RpcAction.php +++ b/src/Components/rpc/src/Route/Annotation/RpcAction.php @@ -14,6 +14,7 @@ * @Annotation * * @Target("METHOD") + * * @Parser("Imi\Rpc\Route\Annotation\Parser\RpcControllerParser") */ #[\Attribute(\Attribute::TARGET_METHOD)] diff --git a/src/Components/rpc/src/Route/Annotation/RpcController.php b/src/Components/rpc/src/Route/Annotation/RpcController.php index 516b492ea0..bd26705ecd 100644 --- a/src/Components/rpc/src/Route/Annotation/RpcController.php +++ b/src/Components/rpc/src/Route/Annotation/RpcController.php @@ -14,6 +14,7 @@ * @Annotation * * @Target("CLASS") + * * @Parser("Imi\Rpc\Route\Annotation\Parser\RpcControllerParser") * * @property string $prefix 路由前缀 diff --git a/src/Components/rpc/src/Route/Annotation/RpcRoute.php b/src/Components/rpc/src/Route/Annotation/RpcRoute.php index c9b0ebb508..64897db94c 100644 --- a/src/Components/rpc/src/Route/Annotation/RpcRoute.php +++ b/src/Components/rpc/src/Route/Annotation/RpcRoute.php @@ -14,6 +14,7 @@ * @Annotation * * @Target("METHOD") + * * @Parser("Imi\Rpc\Route\Annotation\Parser\RpcControllerParser") * * @property mixed $name 路由名称规则 diff --git a/src/Components/smarty/example/Main.php b/src/Components/smarty/example/Main.php index 70251f9819..7e99571414 100644 --- a/src/Components/smarty/example/Main.php +++ b/src/Components/smarty/example/Main.php @@ -4,8 +4,8 @@ namespace Imi\Smarty\Example; -use Doctrine\Common\Annotations\AnnotationReader; use Imi\Main\AppBaseMain; +use Yurun\Doctrine\Common\Annotations\AnnotationReader; class Main extends AppBaseMain { diff --git a/src/Components/smarty/example/MainServer/Controller/IndexController.php b/src/Components/smarty/example/MainServer/Controller/IndexController.php index 0002cf64aa..d58eaf33d4 100644 --- a/src/Components/smarty/example/MainServer/Controller/IndexController.php +++ b/src/Components/smarty/example/MainServer/Controller/IndexController.php @@ -19,6 +19,7 @@ class IndexController extends HttpController * @Action * * @Route("/") + * * @View(renderType="html", template="index") * * @return mixed diff --git a/src/Components/snowflake/tests/Model/ArticleId.php b/src/Components/snowflake/tests/Model/ArticleId.php index d4117269b7..f1800470bb 100644 --- a/src/Components/snowflake/tests/Model/ArticleId.php +++ b/src/Components/snowflake/tests/Model/ArticleId.php @@ -17,7 +17,9 @@ * Article. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Article.name", default="tb_article"), usePrefix=false, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Article.poolName")) + * * @DDL(sql="CREATE TABLE `tb_article` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `member_id` int(10) unsigned NOT NULL DEFAULT '0', `title` varchar(255) NOT NULL, `content` mediumtext NOT NULL, `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) USING BTREE, KEY `member_id` (`member_id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='@article'", decode="") * * @property int|null $id @@ -92,6 +94,7 @@ public function setMemberId($memberId) * title. * * @Column(name="title", type="varchar", length=255, accuracy=0, nullable=false, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false) + * * @Id(index=false, generator=\Imi\Snowflake\Model\SnowflakeGenerator::class, generatorOptions={"name": "test1"}) */ protected ?string $title = null; @@ -126,6 +129,7 @@ public function setTitle($title) * content. * * @Column(name="content", type="mediumtext", length=0, accuracy=0, nullable=false, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false) + * * @Id(index=false, generator=\Imi\Snowflake\Model\SnowflakeGenerator::class, generatorOptions={"name": "test1"}) */ protected ?string $content = null; @@ -160,6 +164,7 @@ public function setContent($content) * time. * * @Column(name="time", type="timestamp", length=0, accuracy=0, nullable=false, default="CURRENT_TIMESTAMP", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false) + * * @Serializable(false) */ protected ?string $time = null; diff --git a/src/Components/swoole-tracker/example/WebSocketServer/MainServer/Controller/Http/IndexController.php b/src/Components/swoole-tracker/example/WebSocketServer/MainServer/Controller/Http/IndexController.php index 80f3b8429f..1838b33252 100644 --- a/src/Components/swoole-tracker/example/WebSocketServer/MainServer/Controller/Http/IndexController.php +++ b/src/Components/swoole-tracker/example/WebSocketServer/MainServer/Controller/Http/IndexController.php @@ -26,6 +26,7 @@ class IndexController extends HttpController * @Action * * @Route("/") + * * @WSConfig(parserClass=\Imi\Server\DataParser\JsonObjectParser::class) * * @return void diff --git a/src/Components/swoole-tracker/example/WebSocketServer/MainServer/Controller/TestController.php b/src/Components/swoole-tracker/example/WebSocketServer/MainServer/Controller/TestController.php index 5f4f7bc375..828820eef0 100644 --- a/src/Components/swoole-tracker/example/WebSocketServer/MainServer/Controller/TestController.php +++ b/src/Components/swoole-tracker/example/WebSocketServer/MainServer/Controller/TestController.php @@ -44,6 +44,7 @@ public function login($data) * @WSAction * * @WSRoute({"action": "send"}) + * * @WSMiddleware(Imi\SwooleTracker\Example\WebSocketServer\MainServer\Middleware\Test::class) * * @param mixed $data diff --git a/src/Components/swoole/src/HotUpdate/HotUpdateProcess.php b/src/Components/swoole/src/HotUpdate/HotUpdateProcess.php index 1405325cd9..f89e441978 100644 --- a/src/Components/swoole/src/HotUpdate/HotUpdateProcess.php +++ b/src/Components/swoole/src/HotUpdate/HotUpdateProcess.php @@ -17,6 +17,7 @@ /** * @Bean(name="hotUpdate", env="swoole") + * * @Process(name="hotUpdate", unique=true) */ class HotUpdateProcess extends BaseProcess diff --git a/src/Components/swoole/src/Process/Annotation/Process.php b/src/Components/swoole/src/Process/Annotation/Process.php index 8b872e9dbe..36ace87439 100644 --- a/src/Components/swoole/src/Process/Annotation/Process.php +++ b/src/Components/swoole/src/Process/Annotation/Process.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("CLASS") + * * @Parser("Imi\Swoole\Process\Parser\ProcessParser") * * @property string $name 进程名称 diff --git a/src/Components/swoole/src/Process/Annotation/ProcessPool.php b/src/Components/swoole/src/Process/Annotation/ProcessPool.php index f9a42fbfca..eb148f9768 100644 --- a/src/Components/swoole/src/Process/Annotation/ProcessPool.php +++ b/src/Components/swoole/src/Process/Annotation/ProcessPool.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("CLASS") + * * @Parser("Imi\Swoole\Process\Parser\ProcessPoolParser") * * @property string $name 进程池名称 diff --git a/src/Components/swoole/src/Process/Cli/Process.php b/src/Components/swoole/src/Process/Cli/Process.php index 38b411141d..82d2f5fd02 100644 --- a/src/Components/swoole/src/Process/Cli/Process.php +++ b/src/Components/swoole/src/Process/Cli/Process.php @@ -23,7 +23,9 @@ class Process extends BaseCommand * 开启一个进程,可以任意添加参数. * * @CommandAction(name="start", dynamicOptions=true, description="开启一个进程") + * * @Argument(name="name", type=ArgType::STRING, required=true, comments="进程名称,通过@Process注解定义") + * * @Option(name="redirectStdinStdout", type=ArgType::BOOL, default=null, comments="重定向子进程的标准输入和输出。启用此选项后,在子进程内输出内容将不是打印屏幕,而是写入到主进程管道。读取键盘输入将变为从管道中读取数据。默认为阻塞读取。") * @Option(name="pipeType", type=ArgType::INT, default=null, comments="管道类型,启用$redirectStdinStdout后,此选项将忽略用户参数,强制为1。如果子进程内没有进程间通信,可以设置为 0") */ @@ -42,7 +44,9 @@ public function start(string $name, ?bool $redirectStdinStdout, ?int $pipeType): * 开启一个进程池,可以任意添加参数. * * @CommandAction(name="pool", dynamicOptions=true, description="开启一个进程池") + * * @Argument(name="name", type=ArgType::STRING, required=true, comments="进程池名称,通过@ProcessPool注解定义") + * * @Option(name="worker", type=ArgType::INT, default=null, comments="进程数量,不传则根据注解配置设定") * @Option(name="ipcType", type=ArgType::INT, default=null, comments="进程间通信的模式,默认为0表示不使用任何进程间通信特性,不传则根据注解配置设定") * @Option(name="msgQueueKey", type=ArgType::STRING, default=null, comments="消息队列键,不传则根据注解配置设定") @@ -59,6 +63,7 @@ public function pool(string $name, ?int $worker, ?int $ipcType, ?string $msgQueu * 运行一个进程. * * @CommandAction(name="run", dynamicOptions=true, description="运行一个进程") + * * @Argument(name="name", type=ArgType::STRING, required=true, comments="进程名称,通过@Process注解定义") */ public function run(string $name): void diff --git a/src/Components/swoole/src/Process/ProcessManager.php b/src/Components/swoole/src/Process/ProcessManager.php index 3a4a4652a3..711cb54ed3 100644 --- a/src/Components/swoole/src/Process/ProcessManager.php +++ b/src/Components/swoole/src/Process/ProcessManager.php @@ -14,9 +14,6 @@ use Imi\Swoole\Util\Coroutine; use Imi\Swoole\Util\Imi as SwooleImi; use Imi\Timer\Timer; - -use function Imi\ttyExec; - use Imi\Util\File; use Imi\Util\Imi; use Imi\Util\ImiPriority; @@ -26,6 +23,8 @@ use Swoole\ExitException; use Swoole\Table; +use function Imi\ttyExec; + /** * 进程管理类. */ diff --git a/src/Components/swoole/src/Server/Cli/Server.php b/src/Components/swoole/src/Server/Cli/Server.php index 1088de8134..6b02563b88 100644 --- a/src/Components/swoole/src/Server/Cli/Server.php +++ b/src/Components/swoole/src/Server/Cli/Server.php @@ -30,6 +30,7 @@ class Server extends BaseCommand * 开启服务 * * @CommandAction(name="start", description="启动 swoole 服务") + * * @Option(name="workerNum", type=ArgType::INT, required=false, comments="工作进程数量") * @Option(name="daemon", shortcut="d", type=ArgType::MIXED, required=false, comments="是否启用守护进程模式。加 -d 参数则使用守护进程模式。如果后面再跟上文件名,则会把标准输入和输出重定向到该文件") * @@ -118,6 +119,7 @@ public function stop(): void * 重启 Worker 进程,不会导致连接断开,可以让项目文件更改生效 * * @CommandAction(name="reload", description="重载 swoole 服务") + * * @Option(name="runtime", type=ArgType::BOOL, required=false, default=false, comments="是否更新运行时缓存") */ public function reload(bool $runtime): void diff --git a/src/Components/swoole/src/SwooleApp.php b/src/Components/swoole/src/SwooleApp.php index 7eb93f2649..6463cd2868 100644 --- a/src/Components/swoole/src/SwooleApp.php +++ b/src/Components/swoole/src/SwooleApp.php @@ -21,9 +21,6 @@ use Imi\Swoole\Context\CoroutineContextManager; use Imi\Swoole\Log\SwooleLogger; use Imi\Swoole\Util\AtomicManager; - -use function Imi\ttyExec; - use Imi\Util\Imi; use Imi\Util\Process\ProcessAppContexts; use Imi\Util\Process\ProcessType; @@ -32,6 +29,8 @@ use Symfony\Component\Console\Event\ConsoleCommandEvent; use Symfony\Component\Console\Output\OutputInterface; +use function Imi\ttyExec; + class SwooleApp extends CliApp { /** diff --git a/src/Components/swoole/src/Task/Annotation/Task.php b/src/Components/swoole/src/Task/Annotation/Task.php index 6422e89b25..164b99c2e4 100644 --- a/src/Components/swoole/src/Task/Annotation/Task.php +++ b/src/Components/swoole/src/Task/Annotation/Task.php @@ -14,6 +14,7 @@ * @Annotation * * @Target("CLASS") + * * @Parser("Imi\Swoole\Task\Parser\TaskParser") * * @property string $name 任务名称 diff --git a/src/Components/swoole/tests/unit/HttpServer/ApiServer/Controller/IndexController.php b/src/Components/swoole/tests/unit/HttpServer/ApiServer/Controller/IndexController.php index d27215cf96..5186a23809 100644 --- a/src/Components/swoole/tests/unit/HttpServer/ApiServer/Controller/IndexController.php +++ b/src/Components/swoole/tests/unit/HttpServer/ApiServer/Controller/IndexController.php @@ -65,7 +65,9 @@ public function route(int $id): array * @Action * * @Route(autoEndSlash=true) + * * @View(renderType="html") + * * @HtmlView(template="html") */ public function html(int $time): array @@ -79,6 +81,7 @@ public function html(int $time): array * @Action * * @View(renderType="html") + * * @HtmlView(baseDir="index/") */ public function html2(int $time): array @@ -232,6 +235,7 @@ public function headers() * @Action * * @Route("/middleware") + * * @Middleware(\Imi\Swoole\Test\HttpServer\ApiServer\Middleware\Middleware1::class) * @Middleware({ * \Imi\Swoole\Test\HttpServer\ApiServer\Middleware\Middleware2::class, diff --git a/src/Components/swoole/tests/unit/HttpServer/Cron/TaskCron.php b/src/Components/swoole/tests/unit/HttpServer/Cron/TaskCron.php index 0080c1b4c2..3788381b2b 100644 --- a/src/Components/swoole/tests/unit/HttpServer/Cron/TaskCron.php +++ b/src/Components/swoole/tests/unit/HttpServer/Cron/TaskCron.php @@ -12,6 +12,7 @@ /** * @Cron(id="TaskCron", second="3n", data={"id": "TaskCron"}) + * * @Task("CronTask1") */ class TaskCron implements ITaskHandler diff --git a/src/Components/swoole/tests/unit/HttpServer/Cron/TaskProcess.php b/src/Components/swoole/tests/unit/HttpServer/Cron/TaskProcess.php index ae0979ddd1..4216c244de 100644 --- a/src/Components/swoole/tests/unit/HttpServer/Cron/TaskProcess.php +++ b/src/Components/swoole/tests/unit/HttpServer/Cron/TaskProcess.php @@ -12,6 +12,7 @@ /** * @Cron(id="TaskProcess1", second="3n") + * * @Process("TaskProcess1") */ class TaskProcess implements IProcess diff --git a/src/Components/swoole/tests/unit/HttpServer/Tests/CustomSessionIdTest.php b/src/Components/swoole/tests/unit/HttpServer/Tests/CustomSessionIdTest.php index 656db49faf..7088dd6bde 100644 --- a/src/Components/swoole/tests/unit/HttpServer/Tests/CustomSessionIdTest.php +++ b/src/Components/swoole/tests/unit/HttpServer/Tests/CustomSessionIdTest.php @@ -4,11 +4,11 @@ namespace Imi\Swoole\Test\HttpServer\Tests; -use function Imi\env; - use PHPUnit\Framework\Assert; use Yurun\Util\HttpRequest; +use function Imi\env; + /** * @testdox HttpSession custom sessionid */ diff --git a/src/Components/swoole/tests/unit/HttpServer/Tests/Http2Test.php b/src/Components/swoole/tests/unit/HttpServer/Tests/Http2Test.php index d2388e605c..03938029a5 100644 --- a/src/Components/swoole/tests/unit/HttpServer/Tests/Http2Test.php +++ b/src/Components/swoole/tests/unit/HttpServer/Tests/Http2Test.php @@ -4,10 +4,10 @@ namespace Imi\Swoole\Test\HttpServer\Tests; -use function Imi\env; - use Yurun\Util\HttpRequest; +use function Imi\env; + /** * @testdox Http2 */ diff --git a/src/Components/swoole/tests/unit/HttpServer/Tests/HttpsTest.php b/src/Components/swoole/tests/unit/HttpServer/Tests/HttpsTest.php index c890f26fe0..1062ef8ed8 100644 --- a/src/Components/swoole/tests/unit/HttpServer/Tests/HttpsTest.php +++ b/src/Components/swoole/tests/unit/HttpServer/Tests/HttpsTest.php @@ -4,11 +4,11 @@ namespace Imi\Swoole\Test\HttpServer\Tests; -use function Imi\env; - use Imi\Util\Http\Consts\StatusCode; use Yurun\Util\HttpRequest; +use function Imi\env; + /** * @testdox Https */ diff --git a/src/Components/swoole/tests/unit/WebSocketServer/MainServer/Controller/Http/IndexController.php b/src/Components/swoole/tests/unit/WebSocketServer/MainServer/Controller/Http/IndexController.php index a5d1640e04..22f70aa99f 100644 --- a/src/Components/swoole/tests/unit/WebSocketServer/MainServer/Controller/Http/IndexController.php +++ b/src/Components/swoole/tests/unit/WebSocketServer/MainServer/Controller/Http/IndexController.php @@ -24,6 +24,7 @@ class IndexController extends HttpController * @Action * * @Route("/") + * * @WSConfig(parserClass=\Imi\Server\DataParser\JsonObjectParser::class) */ public function index(): void @@ -35,6 +36,7 @@ public function index(): void * @Action * * @Route("/test2") + * * @WSConfig(parserClass=\Imi\Server\DataParser\JsonObjectParser::class) */ public function test2(): void diff --git a/src/Components/swoole/tests/unit/WebSocketServer/config/config.php b/src/Components/swoole/tests/unit/WebSocketServer/config/config.php index b0cc54d1e2..94fbd9679b 100644 --- a/src/Components/swoole/tests/unit/WebSocketServer/config/config.php +++ b/src/Components/swoole/tests/unit/WebSocketServer/config/config.php @@ -2,10 +2,10 @@ declare(strict_types=1); -use function Imi\env; - use Imi\Server\WebSocket\Enum\NonControlFrameType; +use function Imi\env; + return [ // 项目根命名空间 'namespace' => 'Imi\Swoole\Test\WebSocketServer', diff --git a/src/Components/swoole/tests/unit/WebSocketServerWithAmqpRouteServerUtil/MainServer/Controller/Http/IndexController.php b/src/Components/swoole/tests/unit/WebSocketServerWithAmqpRouteServerUtil/MainServer/Controller/Http/IndexController.php index e562b57926..44922fa417 100644 --- a/src/Components/swoole/tests/unit/WebSocketServerWithAmqpRouteServerUtil/MainServer/Controller/Http/IndexController.php +++ b/src/Components/swoole/tests/unit/WebSocketServerWithAmqpRouteServerUtil/MainServer/Controller/Http/IndexController.php @@ -24,6 +24,7 @@ class IndexController extends HttpController * @Action * * @Route("/") + * * @WSConfig(parserClass=\Imi\Server\DataParser\JsonObjectParser::class) */ public function index(): void @@ -35,6 +36,7 @@ public function index(): void * @Action * * @Route("/test2") + * * @WSConfig(parserClass=\Imi\Server\DataParser\JsonObjectParser::class) */ public function test2(): void diff --git a/src/Components/swoole/tests/unit/WebSocketServerWithAmqpServerUtil/MainServer/Controller/Http/IndexController.php b/src/Components/swoole/tests/unit/WebSocketServerWithAmqpServerUtil/MainServer/Controller/Http/IndexController.php index 4b6f4d5a09..5426039885 100644 --- a/src/Components/swoole/tests/unit/WebSocketServerWithAmqpServerUtil/MainServer/Controller/Http/IndexController.php +++ b/src/Components/swoole/tests/unit/WebSocketServerWithAmqpServerUtil/MainServer/Controller/Http/IndexController.php @@ -24,6 +24,7 @@ class IndexController extends HttpController * @Action * * @Route("/") + * * @WSConfig(parserClass=\Imi\Server\DataParser\JsonObjectParser::class) */ public function index(): void @@ -35,6 +36,7 @@ public function index(): void * @Action * * @Route("/test2") + * * @WSConfig(parserClass=\Imi\Server\DataParser\JsonObjectParser::class) */ public function test2(): void diff --git a/src/Components/swoole/tests/unit/WebSocketServerWithRedisServerUtil/MainServer/Controller/Http/IndexController.php b/src/Components/swoole/tests/unit/WebSocketServerWithRedisServerUtil/MainServer/Controller/Http/IndexController.php index bc1476aedc..ae82a8757f 100644 --- a/src/Components/swoole/tests/unit/WebSocketServerWithRedisServerUtil/MainServer/Controller/Http/IndexController.php +++ b/src/Components/swoole/tests/unit/WebSocketServerWithRedisServerUtil/MainServer/Controller/Http/IndexController.php @@ -24,6 +24,7 @@ class IndexController extends HttpController * @Action * * @Route("/") + * * @WSConfig(parserClass=\Imi\Server\DataParser\JsonObjectParser::class) */ public function index(): void @@ -35,6 +36,7 @@ public function index(): void * @Action * * @Route("/test2") + * * @WSConfig(parserClass=\Imi\Server\DataParser\JsonObjectParser::class) */ public function test2(): void diff --git a/src/Components/workerman-gateway/tests/unit/AppServer/WebSocketServer/Controller/Http/IndexController.php b/src/Components/workerman-gateway/tests/unit/AppServer/WebSocketServer/Controller/Http/IndexController.php index ca1eed9def..9a79af2b25 100644 --- a/src/Components/workerman-gateway/tests/unit/AppServer/WebSocketServer/Controller/Http/IndexController.php +++ b/src/Components/workerman-gateway/tests/unit/AppServer/WebSocketServer/Controller/Http/IndexController.php @@ -24,6 +24,7 @@ class IndexController extends HttpController * @Action * * @Route("/") + * * @WSConfig(parserClass=\Imi\Server\DataParser\JsonObjectParser::class) */ public function index(): void @@ -35,6 +36,7 @@ public function index(): void * @Action * * @Route("/test2") + * * @WSConfig(parserClass=\Imi\Server\DataParser\JsonObjectParser::class) */ public function test2(): void diff --git a/src/Components/workerman-gateway/tests/unit/AppServer/config/config.php b/src/Components/workerman-gateway/tests/unit/AppServer/config/config.php index 20b6566b2c..221726c598 100644 --- a/src/Components/workerman-gateway/tests/unit/AppServer/config/config.php +++ b/src/Components/workerman-gateway/tests/unit/AppServer/config/config.php @@ -2,10 +2,10 @@ declare(strict_types=1); -use function Imi\env; - use Imi\Server\WebSocket\Enum\NonControlFrameType; +use function Imi\env; + return [ // 项目根命名空间 'namespace' => 'Imi\WorkermanGateway\Test\AppServer', diff --git a/src/Components/workerman/src/HotUpdate/HotUpdateProcess.php b/src/Components/workerman/src/HotUpdate/HotUpdateProcess.php index f440cf36ce..5860cc848e 100644 --- a/src/Components/workerman/src/HotUpdate/HotUpdateProcess.php +++ b/src/Components/workerman/src/HotUpdate/HotUpdateProcess.php @@ -15,6 +15,7 @@ /** * @Bean(name="hotUpdate", env="workerman") + * * @Process(name="hotUpdate") */ class HotUpdateProcess extends BaseProcess diff --git a/src/Components/workerman/src/Process/Annotation/Process.php b/src/Components/workerman/src/Process/Annotation/Process.php index e392840fbf..ddbcedebc9 100644 --- a/src/Components/workerman/src/Process/Annotation/Process.php +++ b/src/Components/workerman/src/Process/Annotation/Process.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("CLASS") + * * @Parser("Imi\Workerman\Process\Parser\ProcessParser") * * @property string $name 进程名称 diff --git a/src/Components/workerman/src/Process/Cli/Process.php b/src/Components/workerman/src/Process/Cli/Process.php index b47af3d101..6d8613c834 100644 --- a/src/Components/workerman/src/Process/Cli/Process.php +++ b/src/Components/workerman/src/Process/Cli/Process.php @@ -20,6 +20,7 @@ class Process extends BaseCommand * 开启一个进程,可以任意添加参数. * * @CommandAction(name="start", dynamicOptions=true, description="启动一个进程") + * * @Argument(name="name", type=ArgType::STRING, required=true, comments="进程名称,通过@Process注解定义") */ public function start(string $name): void diff --git a/src/Components/workerman/src/Server/Cli/Server.php b/src/Components/workerman/src/Server/Cli/Server.php index d9d76996f0..8ed12baf16 100644 --- a/src/Components/workerman/src/Server/Cli/Server.php +++ b/src/Components/workerman/src/Server/Cli/Server.php @@ -32,6 +32,7 @@ class Server extends BaseCommand * 开启服务 * * @CommandAction(name="start", description="启动 workerman 服务") + * * @Option(name="name", type=ArgType::STRING, required=false, comments="要启动的服务器名") * @Option(name="workerNum", type=ArgType::INT, required=false, comments="工作进程数量") * @Option(name="daemon", shortcut="d", type=ArgType::BOOL, required=false, default=false, comments="是否启用守护进程模式。加 -d 参数则使用守护进程模式") diff --git a/src/Components/workerman/src/WorkermanApp.php b/src/Components/workerman/src/WorkermanApp.php index a15e74f864..50fd8f907c 100644 --- a/src/Components/workerman/src/WorkermanApp.php +++ b/src/Components/workerman/src/WorkermanApp.php @@ -13,14 +13,13 @@ use Imi\Core\App\Enum\LoadRuntimeResult; use Imi\Event\Event; use Imi\Main\Helper; - -use function Imi\ttyExec; - use Imi\Util\Imi; use Imi\Util\Process\ProcessAppContexts; use Symfony\Component\Console\ConsoleEvents; use Symfony\Component\Console\Event\ConsoleCommandEvent; +use function Imi\ttyExec; + class WorkermanApp extends CliApp { /** diff --git a/src/Components/workerman/tests/unit/AppServer/ApiServer/Controller/IndexController.php b/src/Components/workerman/tests/unit/AppServer/ApiServer/Controller/IndexController.php index 604ea4a93d..f9f6e94cc6 100644 --- a/src/Components/workerman/tests/unit/AppServer/ApiServer/Controller/IndexController.php +++ b/src/Components/workerman/tests/unit/AppServer/ApiServer/Controller/IndexController.php @@ -54,7 +54,9 @@ public function route(string $id): array * @Action * * @Route(autoEndSlash=true) + * * @View(renderType="html") + * * @HtmlView(template="html") */ public function html(int $time): array @@ -68,6 +70,7 @@ public function html(int $time): array * @Action * * @View(renderType="html") + * * @HtmlView(baseDir="index/") */ public function html2(int $time): array @@ -205,6 +208,7 @@ public function headers() * @Action * * @Route("/middleware") + * * @Middleware(\Imi\Workerman\Test\AppServer\ApiServer\Middleware\Middleware1::class) * @Middleware({ * \Imi\Workerman\Test\AppServer\ApiServer\Middleware\Middleware2::class, diff --git a/src/Components/workerman/tests/unit/AppServer/config/config.php b/src/Components/workerman/tests/unit/AppServer/config/config.php index 3eda59d5f3..8d0eb0847e 100644 --- a/src/Components/workerman/tests/unit/AppServer/config/config.php +++ b/src/Components/workerman/tests/unit/AppServer/config/config.php @@ -2,10 +2,10 @@ declare(strict_types=1); -use function Imi\env; - use Imi\Server\WebSocket\Enum\NonControlFrameType; +use function Imi\env; + return [ // 项目根命名空间 'namespace' => 'Imi\Workerman\Test\AppServer', diff --git a/src/Components/workerman/tests/unit/ChannelServerUtilServer/ApiServer/Controller/IndexController.php b/src/Components/workerman/tests/unit/ChannelServerUtilServer/ApiServer/Controller/IndexController.php index f9d5a3050c..ae4d8afa30 100644 --- a/src/Components/workerman/tests/unit/ChannelServerUtilServer/ApiServer/Controller/IndexController.php +++ b/src/Components/workerman/tests/unit/ChannelServerUtilServer/ApiServer/Controller/IndexController.php @@ -53,7 +53,9 @@ public function route(string $id): array * @Action * * @Route(autoEndSlash=true) + * * @View(renderType="html") + * * @HtmlView(template="html") */ public function html(int $time): array @@ -67,6 +69,7 @@ public function html(int $time): array * @Action * * @View(renderType="html") + * * @HtmlView(baseDir="index/") */ public function html2(int $time): array @@ -204,6 +207,7 @@ public function headers() * @Action * * @Route("/middleware") + * * @Middleware(\Imi\Workerman\Test\AppServer\ApiServer\Middleware\Middleware1::class) * @Middleware({ * \Imi\Workerman\Test\AppServer\ApiServer\Middleware\Middleware2::class, diff --git a/src/Enum/Annotation/EnumItem.php b/src/Enum/Annotation/EnumItem.php index 7a9cca3ba5..c6c7bba6f5 100644 --- a/src/Enum/Annotation/EnumItem.php +++ b/src/Enum/Annotation/EnumItem.php @@ -14,6 +14,7 @@ * @Annotation * * @Target("CONST") + * * @Parser("Imi\Enum\Annotation\Parser\EnumParser") * * @property string $text 文本描述 diff --git a/src/Facade/Cli/FacadeGenerate.php b/src/Facade/Cli/FacadeGenerate.php index e6644def60..6d29da8d7a 100644 --- a/src/Facade/Cli/FacadeGenerate.php +++ b/src/Facade/Cli/FacadeGenerate.php @@ -26,8 +26,10 @@ class FacadeGenerate extends BaseCommand * 生成门面类. * * @CommandAction(name="facade", description="生成门面类") + * * @Argument(name="facadeClass", type=ArgType::STRING, required=true, comments="生成的门面类") * @Argument(name="class", type=ArgType::STRING, required=true, comments="要绑定的类") + * * @Option(name="request", type=ArgType::BOOL, default=false, comments="是否请求上下文门面") */ public function generate(string $facadeClass, string $class, bool $request): void diff --git a/src/Model/Cli/Model/ModelGenerate.php b/src/Model/Cli/Model/ModelGenerate.php index 665a69dded..12674569b2 100644 --- a/src/Model/Cli/Model/ModelGenerate.php +++ b/src/Model/Cli/Model/ModelGenerate.php @@ -28,8 +28,10 @@ class ModelGenerate extends BaseCommand * 生成数据库中所有表的模型文件,如果设置了`include`或`exclude`,则按照相应规则过滤表。 * * @CommandAction(name="model", description="模型生成") + * * @Argument(name="namespace", type=ArgType::STRING, required=true, comments="生成的Model所在命名空间") * @Argument(name="baseClass", type=ArgType::STRING, default="Imi\Model\Model", comments="生成的Model所继承的基类,默认\Imi\Model\Model,可选") + * * @Option(name="database", type=ArgType::STRING, comments="数据库名,不传则取连接池默认配置的库名") * @Option(name="poolName", type=ArgType::STRING, comments="连接池名称,不传则取默认连接池") * @Option(name="prefix", type=ArgType::ARRAY_EX, default={}, comments="传值则去除该表前缀,以半角逗号分隔多个前缀") diff --git a/src/Model/Cli/Table/TableGenerate.php b/src/Model/Cli/Table/TableGenerate.php index bc6fb236ca..66307250e0 100644 --- a/src/Model/Cli/Table/TableGenerate.php +++ b/src/Model/Cli/Table/TableGenerate.php @@ -27,6 +27,7 @@ class TableGenerate extends BaseCommand * 注意,本工具是删除重建表,会丢失数据,生产环境慎重使用! * * @CommandAction(name="table", description="表生成") + * * @Option(name="namespace", type=ArgType::STRING, default=null, comments="模型所在命名空间,支持半角逗号分隔传多个,默认不传则为全部") * @Option(name="database", type=ArgType::STRING, comments="数据库名,不传则取连接池默认配置的库名") * @Option(name="poolName", type=ArgType::STRING, comments="连接池名称,不传则取默认连接池") diff --git a/src/RequestContextProxy/Cli/RequestContextProxyGenerate.php b/src/RequestContextProxy/Cli/RequestContextProxyGenerate.php index e665476a88..f12ebd49e4 100644 --- a/src/RequestContextProxy/Cli/RequestContextProxyGenerate.php +++ b/src/RequestContextProxy/Cli/RequestContextProxyGenerate.php @@ -26,6 +26,7 @@ class RequestContextProxyGenerate * 生成请求上下文代理类. * * @CommandAction("requestContextProxy") + * * @Option(name="target", type=ArgType::STRING, required=true, comments="生成的目标类") * @Option(name="class", type=ArgType::STRING, required=true, comments="要绑定的代理类名") * @Option(name="name", type=ArgType::STRING, required=true, comments="请求上下文中的名称") diff --git a/src/Server/Http/Cli/ControllerGenerate.php b/src/Server/Http/Cli/ControllerGenerate.php index 8be1a39374..2c82b797c6 100644 --- a/src/Server/Http/Cli/ControllerGenerate.php +++ b/src/Server/Http/Cli/ControllerGenerate.php @@ -22,8 +22,10 @@ class ControllerGenerate extends BaseCommand * 生成一个 Http Controller. * * @CommandAction(name="httpController", description="生成 Http Controller") + * * @Argument(name="name", type=ArgType::STRING, required=true, comments="生成的 Controller 类名") * @Argument(name="namespace", type=ArgType::STRING, required=true, comments="生成的 Controller 所在命名空间") + * * @Option(name="prefix", type=ArgType::STRING, default=null, comments="路由前缀,不传则为类名") * @Option(name="render", type=ArgType::STRING, default="json", comments="渲染方式,默认为json,可选:html/json/xml") * @Option(name="rest", type=ArgType::BOOLEAN, default=false, comments="是否生成 RESTful 风格,默认 false") diff --git a/src/Server/Http/Message/Proxy/RequestProxyObject.php b/src/Server/Http/Message/Proxy/RequestProxyObject.php index 5856700259..d72529bed7 100644 --- a/src/Server/Http/Message/Proxy/RequestProxyObject.php +++ b/src/Server/Http/Message/Proxy/RequestProxyObject.php @@ -10,6 +10,7 @@ /** * @Bean(name="HttpRequestProxy", recursion=false, instanceType="singleton") + * * @RequestContextProxy(class="Imi\Server\Http\Message\Contract\IHttpRequest", name="request") * * @method \Imi\Util\Socket\IPEndPoint getClientAddress() diff --git a/src/Server/Http/Message/Proxy/ResponseProxyObject.php b/src/Server/Http/Message/Proxy/ResponseProxyObject.php index 6238287046..70f499a2dd 100644 --- a/src/Server/Http/Message/Proxy/ResponseProxyObject.php +++ b/src/Server/Http/Message/Proxy/ResponseProxyObject.php @@ -10,6 +10,7 @@ /** * @Bean(name="HttpResponseProxy", recursion=false, instanceType="singleton") + * * @RequestContextProxy(class="Imi\Server\Http\Message\Contract\IHttpResponse", name="response") * * @method \Imi\Server\Http\Message\Contract\IHttpResponse redirect(string $url, int $status = 302) diff --git a/src/Server/Http/Route/Annotation/Action.php b/src/Server/Http/Route/Annotation/Action.php index dbe70ad6b5..85187d1f52 100644 --- a/src/Server/Http/Route/Annotation/Action.php +++ b/src/Server/Http/Route/Annotation/Action.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("METHOD") + * * @Parser("Imi\Server\Http\Parser\ControllerParser") */ #[\Attribute(\Attribute::TARGET_METHOD)] diff --git a/src/Server/Http/Route/Annotation/Controller.php b/src/Server/Http/Route/Annotation/Controller.php index e5790681b3..d6aff59e0a 100644 --- a/src/Server/Http/Route/Annotation/Controller.php +++ b/src/Server/Http/Route/Annotation/Controller.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("CLASS") + * * @Parser("Imi\Server\Http\Parser\ControllerParser") * * @property string|null $prefix 路由前缀 diff --git a/src/Server/Http/Route/Annotation/Middleware.php b/src/Server/Http/Route/Annotation/Middleware.php index 1cb4bba634..51eab5f7a1 100644 --- a/src/Server/Http/Route/Annotation/Middleware.php +++ b/src/Server/Http/Route/Annotation/Middleware.php @@ -13,6 +13,7 @@ * @Annotation * * @Target({"CLASS", "METHOD"}) + * * @Parser("Imi\Server\Http\Parser\ControllerParser") * * @property string|string[]|null $middlewares 中间件类或数组 diff --git a/src/Server/Http/Route/Annotation/Route.php b/src/Server/Http/Route/Annotation/Route.php index 74d190a2b0..780f047a88 100644 --- a/src/Server/Http/Route/Annotation/Route.php +++ b/src/Server/Http/Route/Annotation/Route.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("METHOD") + * * @Parser("Imi\Server\Http\Parser\ControllerParser") * * @property string|null $url 请求地址规则 diff --git a/src/Server/TcpServer/Message/Proxy/ReceiveDataProxy.php b/src/Server/TcpServer/Message/Proxy/ReceiveDataProxy.php index f6743c39ac..5fd66304f5 100644 --- a/src/Server/TcpServer/Message/Proxy/ReceiveDataProxy.php +++ b/src/Server/TcpServer/Message/Proxy/ReceiveDataProxy.php @@ -10,6 +10,7 @@ /** * @Bean(name="TcpReceiveDataProxy", recursion=false, instanceType="singleton") + * * @RequestContextProxy(class="Imi\Server\TcpServer\Message\IReceiveData", name="receiveData") * * @method int|string getClientId() diff --git a/src/Server/TcpServer/Route/Annotation/TcpAction.php b/src/Server/TcpServer/Route/Annotation/TcpAction.php index 9ec0a64ff2..1a6d958cdf 100644 --- a/src/Server/TcpServer/Route/Annotation/TcpAction.php +++ b/src/Server/TcpServer/Route/Annotation/TcpAction.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("METHOD") + * * @Parser("Imi\Server\TcpServer\Parser\TcpControllerParser") */ #[\Attribute(\Attribute::TARGET_METHOD)] diff --git a/src/Server/TcpServer/Route/Annotation/TcpController.php b/src/Server/TcpServer/Route/Annotation/TcpController.php index 9a97f65eaa..38d0ba9ed1 100644 --- a/src/Server/TcpServer/Route/Annotation/TcpController.php +++ b/src/Server/TcpServer/Route/Annotation/TcpController.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("CLASS") + * * @Parser("Imi\Server\TcpServer\Parser\TcpControllerParser") * * @property string|string[]|null $server 指定当前控制器允许哪些服务器使用;支持字符串或数组,默认为 null 则不限制 diff --git a/src/Server/TcpServer/Route/Annotation/TcpMiddleware.php b/src/Server/TcpServer/Route/Annotation/TcpMiddleware.php index 9a6f529b8a..4595cc9588 100644 --- a/src/Server/TcpServer/Route/Annotation/TcpMiddleware.php +++ b/src/Server/TcpServer/Route/Annotation/TcpMiddleware.php @@ -13,6 +13,7 @@ * @Annotation * * @Target({"CLASS", "METHOD"}) + * * @Parser("Imi\Server\TcpServer\Parser\TcpControllerParser") * * @property string|string[]|null $middlewares diff --git a/src/Server/TcpServer/Route/Annotation/TcpRoute.php b/src/Server/TcpServer/Route/Annotation/TcpRoute.php index 9615623c81..d0c671b0af 100644 --- a/src/Server/TcpServer/Route/Annotation/TcpRoute.php +++ b/src/Server/TcpServer/Route/Annotation/TcpRoute.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("METHOD") + * * @Parser("Imi\Server\TcpServer\Parser\TcpControllerParser") * * @property array $condition 条件 diff --git a/src/Server/UdpServer/Message/Proxy/PacketDataProxy.php b/src/Server/UdpServer/Message/Proxy/PacketDataProxy.php index 69f0e1da9e..659de185bb 100644 --- a/src/Server/UdpServer/Message/Proxy/PacketDataProxy.php +++ b/src/Server/UdpServer/Message/Proxy/PacketDataProxy.php @@ -10,6 +10,7 @@ /** * @Bean(name="UdpPacketDataProxy", recursion=false, instanceType="singleton") + * * @RequestContextProxy(class="Imi\Server\UdpServer\Message\IPacketData", name="packetData") * * @method string getData() diff --git a/src/Server/UdpServer/Route/Annotation/UdpAction.php b/src/Server/UdpServer/Route/Annotation/UdpAction.php index 268984aa67..c199b153c6 100644 --- a/src/Server/UdpServer/Route/Annotation/UdpAction.php +++ b/src/Server/UdpServer/Route/Annotation/UdpAction.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("METHOD") + * * @Parser("Imi\Server\UdpServer\Parser\UdpControllerParser") */ #[\Attribute(\Attribute::TARGET_METHOD)] diff --git a/src/Server/UdpServer/Route/Annotation/UdpController.php b/src/Server/UdpServer/Route/Annotation/UdpController.php index 5a61f6c2c1..c204c3029d 100644 --- a/src/Server/UdpServer/Route/Annotation/UdpController.php +++ b/src/Server/UdpServer/Route/Annotation/UdpController.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("CLASS") + * * @Parser("Imi\Server\UdpServer\Parser\UdpControllerParser") * * @property string|string[]|null $server 指定当前控制器允许哪些服务器使用;支持字符串或数组,默认为 null 则不限制 diff --git a/src/Server/UdpServer/Route/Annotation/UdpMiddleware.php b/src/Server/UdpServer/Route/Annotation/UdpMiddleware.php index bbd7453e2d..37bfa72d0f 100644 --- a/src/Server/UdpServer/Route/Annotation/UdpMiddleware.php +++ b/src/Server/UdpServer/Route/Annotation/UdpMiddleware.php @@ -13,6 +13,7 @@ * @Annotation * * @Target({"CLASS", "METHOD"}) + * * @Parser("Imi\Server\UdpServer\Parser\UdpControllerParser") * * @property string|string[]|null $middlewares 中间件类或数组 diff --git a/src/Server/UdpServer/Route/Annotation/UdpRoute.php b/src/Server/UdpServer/Route/Annotation/UdpRoute.php index f4a9ddbbd3..7c954bc667 100644 --- a/src/Server/UdpServer/Route/Annotation/UdpRoute.php +++ b/src/Server/UdpServer/Route/Annotation/UdpRoute.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("METHOD") + * * @Parser("Imi\Server\UdpServer\Parser\UdpControllerParser") * * @property array $condition 条件 diff --git a/src/Server/View/Annotation/View.php b/src/Server/View/Annotation/View.php index ab35d7781e..76baca97c0 100644 --- a/src/Server/View/Annotation/View.php +++ b/src/Server/View/Annotation/View.php @@ -13,6 +13,7 @@ * @Annotation * * @Target({"CLASS", "METHOD"}) + * * @Parser("Imi\Server\View\Parser\ViewParser") * * @property string $renderType 渲染类型 diff --git a/src/Server/WebSocket/Message/Proxy/FrameProxy.php b/src/Server/WebSocket/Message/Proxy/FrameProxy.php index 395de34a79..b4f80ffb92 100644 --- a/src/Server/WebSocket/Message/Proxy/FrameProxy.php +++ b/src/Server/WebSocket/Message/Proxy/FrameProxy.php @@ -10,6 +10,7 @@ /** * @Bean(name="WebSocketFrameProxy", recursion=false, instanceType="singleton") + * * @RequestContextProxy(class="Imi\Server\WebSocket\Message\IFrame", name="frame") * * @method int|string getClientId() diff --git a/src/Server/WebSocket/Route/Annotation/WSAction.php b/src/Server/WebSocket/Route/Annotation/WSAction.php index fa9a6d66f5..eafeb2c562 100644 --- a/src/Server/WebSocket/Route/Annotation/WSAction.php +++ b/src/Server/WebSocket/Route/Annotation/WSAction.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("METHOD") + * * @Parser("Imi\Server\WebSocket\Parser\WSControllerParser") */ #[\Attribute(\Attribute::TARGET_METHOD)] diff --git a/src/Server/WebSocket/Route/Annotation/WSConfig.php b/src/Server/WebSocket/Route/Annotation/WSConfig.php index e57dc3c44c..f854785afa 100644 --- a/src/Server/WebSocket/Route/Annotation/WSConfig.php +++ b/src/Server/WebSocket/Route/Annotation/WSConfig.php @@ -14,6 +14,7 @@ * @Annotation * * @Target("METHOD") + * * @Parser("Imi\Server\Http\Parser\ControllerParser") * * @property string|null $parserClass 处理器类 diff --git a/src/Server/WebSocket/Route/Annotation/WSController.php b/src/Server/WebSocket/Route/Annotation/WSController.php index 88696a6332..3a904334b9 100644 --- a/src/Server/WebSocket/Route/Annotation/WSController.php +++ b/src/Server/WebSocket/Route/Annotation/WSController.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("CLASS") + * * @Parser("Imi\Server\WebSocket\Parser\WSControllerParser") * * @property string|null $route http 路由;如果设置,则只有握手指定 http 路由,才可以触发该 WebSocket 路由 diff --git a/src/Server/WebSocket/Route/Annotation/WSMiddleware.php b/src/Server/WebSocket/Route/Annotation/WSMiddleware.php index 2e1f2f48e3..12fae427d6 100644 --- a/src/Server/WebSocket/Route/Annotation/WSMiddleware.php +++ b/src/Server/WebSocket/Route/Annotation/WSMiddleware.php @@ -13,6 +13,7 @@ * @Annotation * * @Target({"CLASS", "METHOD"}) + * * @Parser("Imi\Server\WebSocket\Parser\WSControllerParser") * * @property string|string[] $middlewares 中间件类或数组 diff --git a/src/Server/WebSocket/Route/Annotation/WSRoute.php b/src/Server/WebSocket/Route/Annotation/WSRoute.php index 22c680a7de..a73985ccc0 100644 --- a/src/Server/WebSocket/Route/Annotation/WSRoute.php +++ b/src/Server/WebSocket/Route/Annotation/WSRoute.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("METHOD") + * * @Parser("Imi\Server\WebSocket\Parser\WSControllerParser") * * @property array $condition 条件 diff --git a/src/Tool/Annotation/Arg.php b/src/Tool/Annotation/Arg.php index c5a40c3e8d..43cfd313e0 100644 --- a/src/Tool/Annotation/Arg.php +++ b/src/Tool/Annotation/Arg.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("METHOD") + * * @Parser("Imi\Cli\Parser\ToolParser") */ #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] diff --git a/src/Tool/Annotation/Operation.php b/src/Tool/Annotation/Operation.php index a76b559a56..6bd2fda036 100644 --- a/src/Tool/Annotation/Operation.php +++ b/src/Tool/Annotation/Operation.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("METHOD") + * * @Parser("Imi\Cli\Parser\ToolParser") */ #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] diff --git a/src/Tool/Annotation/Tool.php b/src/Tool/Annotation/Tool.php index 2d88511483..1bd18f0194 100644 --- a/src/Tool/Annotation/Tool.php +++ b/src/Tool/Annotation/Tool.php @@ -13,6 +13,7 @@ * @Annotation * * @Target("CLASS") + * * @Parser("Imi\Cli\Parser\ToolParser") */ #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] diff --git a/src/Util/Imi.php b/src/Util/Imi.php index db786ebe60..c87218c7b9 100644 --- a/src/Util/Imi.php +++ b/src/Util/Imi.php @@ -11,13 +11,12 @@ use Imi\Bean\BeanProxy; use Imi\Bean\ReflectionContainer; use Imi\Config; - -use function Imi\env; - use Imi\Event\Event; use Imi\Main\Helper; use Imi\Util\Process\ProcessAppContexts; +use function Imi\env; + /** * 框架里杂七杂八的各种工具方法. */ diff --git a/tests/unit/Component/Inject/Classes/TestArg.php b/tests/unit/Component/Inject/Classes/TestArg.php index aff563ea8d..64e0121fbf 100644 --- a/tests/unit/Component/Inject/Classes/TestArg.php +++ b/tests/unit/Component/Inject/Classes/TestArg.php @@ -16,6 +16,7 @@ class TestArg { /** * @FilterArg(name="id", filter="intval") + * * @InjectArg(name="phpVersion", value=PHP_VERSION) * * @param int $id diff --git a/tests/unit/Component/Model/Article.php b/tests/unit/Component/Model/Article.php index d4839b1275..572a030949 100644 --- a/tests/unit/Component/Model/Article.php +++ b/tests/unit/Component/Model/Article.php @@ -29,7 +29,9 @@ class Article extends ArticleBase { /** * @OneToOne(model="ArticleEx") + * * @JoinFrom("id") + * * @JoinTo("article_id") * * @AutoSave @@ -58,7 +60,9 @@ public function setEx(?ArticleEx $ex) /** * @OneToOne(model="ArticleEx", with=true) + * * @JoinFrom("id") + * * @JoinTo("article_id") */ protected ?ArticleEx $exWith = null; @@ -85,8 +89,11 @@ public function setExWith(?ArticleEx $exWith) /** * @OneToOne(model="ArticleEx") + * * @JoinFrom("id") + * * @JoinTo("article_id") + * * @AutoSelect(false) * * @JsonNotNull diff --git a/tests/unit/Component/Model/ArticleId.php b/tests/unit/Component/Model/ArticleId.php index c8b5471a0e..a766dff7d9 100644 --- a/tests/unit/Component/Model/ArticleId.php +++ b/tests/unit/Component/Model/ArticleId.php @@ -17,7 +17,9 @@ * Article. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Article.name", default="tb_article"), usePrefix=false, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Article.poolName")) + * * @DDL(sql="CREATE TABLE `tb_article` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `member_id` int(10) unsigned NOT NULL DEFAULT '0', `title` varchar(255) NOT NULL, `content` mediumtext NOT NULL, `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) USING BTREE, KEY `member_id` (`member_id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='@article'", decode="") * * @property int|null $id @@ -92,6 +94,7 @@ public function setMemberId($memberId) * title. * * @Column(name="title", type="varchar", length=255, accuracy=0, nullable=false, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false) + * * @Id(index=false, generator=\Imi\Model\IdGenerator\UUIDGenerator::class) */ protected ?string $title = null; @@ -126,6 +129,7 @@ public function setTitle($title) * content. * * @Column(name="content", type="mediumtext", length=0, accuracy=0, nullable=false, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false) + * * @Id(index=false, generator=\Imi\Model\IdGenerator\UUIDGenerator::class, generatorOptions={"type": \Imi\Model\IdGenerator\UUIDGeneratorType::SHA1, "ns": "99e4edaf-8363-466e-bddf-7254db57675c", "nameField": "title"}) */ protected ?string $content = null; @@ -160,6 +164,7 @@ public function setContent($content) * time. * * @Column(name="time", type="timestamp", length=0, accuracy=0, nullable=false, default="CURRENT_TIMESTAMP", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false) + * * @Serializable(false) */ protected ?string $time = null; diff --git a/tests/unit/Component/Model/Base/Article2Base.php b/tests/unit/Component/Model/Base/Article2Base.php index d90607ed47..251067690a 100644 --- a/tests/unit/Component/Model/Base/Article2Base.php +++ b/tests/unit/Component/Model/Base/Article2Base.php @@ -15,7 +15,9 @@ * tb_article2 基类. * * @Entity(camel=true, bean=false, incrUpdate=true) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Article2.name", default="tb_article2"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Article2.poolName")) + * * @DDL(sql="CREATE TABLE `tb_article2` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `member_id` int(10) unsigned NOT NULL DEFAULT '0', `title` varchar(255) NOT NULL, `content` mediumtext NOT NULL, `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) USING BTREE, KEY `member_id` (`member_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/Base/ArticleBase.php b/tests/unit/Component/Model/Base/ArticleBase.php index 420fe123cb..a7f638d1e0 100644 --- a/tests/unit/Component/Model/Base/ArticleBase.php +++ b/tests/unit/Component/Model/Base/ArticleBase.php @@ -15,7 +15,9 @@ * @@article 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Article.name", default="tb_article"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Article.poolName")) + * * @DDL(sql="CREATE TABLE `tb_article` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `member_id` int(10) unsigned NOT NULL DEFAULT '0', `title` varchar(255) NOT NULL, `content` mediumtext NOT NULL, `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) USING BTREE, KEY `member_id` (`member_id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='@article'", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/Base/ArticleExBase.php b/tests/unit/Component/Model/Base/ArticleExBase.php index 3b59d6b4ef..d1c9c9fbf4 100644 --- a/tests/unit/Component/Model/Base/ArticleExBase.php +++ b/tests/unit/Component/Model/Base/ArticleExBase.php @@ -15,7 +15,9 @@ * tb_article_ex 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\ArticleEx.name", default="tb_article_ex"), usePrefix=false, id={"article_id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\ArticleEx.poolName")) + * * @DDL(sql="CREATE TABLE `tb_article_ex` ( `article_id` int(10) unsigned NOT NULL, `data` json DEFAULT NULL, PRIMARY KEY (`article_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8", decode="") * * @property int|null $articleId diff --git a/tests/unit/Component/Model/Base/CreateTimeBase.php b/tests/unit/Component/Model/Base/CreateTimeBase.php index 28965da143..92235ac344 100644 --- a/tests/unit/Component/Model/Base/CreateTimeBase.php +++ b/tests/unit/Component/Model/Base/CreateTimeBase.php @@ -15,7 +15,9 @@ * tb_create_time 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\CreateTime.name", default="tb_create_time"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\CreateTime.poolName")) + * * @DDL(sql="CREATE TABLE `tb_create_time` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `date` date DEFAULT NULL, `time` time DEFAULT NULL, `datetime` datetime DEFAULT NULL, `timestamp` timestamp NULL DEFAULT NULL, `int` int(11) DEFAULT NULL, `bigint` bigint(20) DEFAULT NULL, `bigint_second` bigint(20) DEFAULT NULL, `year` year(4) DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/Base/MemberBase.php b/tests/unit/Component/Model/Base/MemberBase.php index b3d3ff4a14..998ed40b1b 100644 --- a/tests/unit/Component/Model/Base/MemberBase.php +++ b/tests/unit/Component/Model/Base/MemberBase.php @@ -15,7 +15,9 @@ * tb_member 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Member.name", default="tb_member"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Member.poolName")) + * * @DDL(sql="CREATE TABLE `tb_member` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(32) NOT NULL COMMENT '用户名', `password` varchar(255) NOT NULL COMMENT '密码', PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/Base/MemberRoleRelationBase.php b/tests/unit/Component/Model/Base/MemberRoleRelationBase.php index 5c029ec999..86bb9f3e8d 100644 --- a/tests/unit/Component/Model/Base/MemberRoleRelationBase.php +++ b/tests/unit/Component/Model/Base/MemberRoleRelationBase.php @@ -15,7 +15,9 @@ * tb_member_role_relation 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\MemberRoleRelation.name", default="tb_member_role_relation"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\MemberRoleRelation.poolName")) + * * @DDL(sql="CREATE TABLE `tb_member_role_relation` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `type` int(10) unsigned NOT NULL DEFAULT '0', `member_id` int(10) unsigned NOT NULL, `role_id` int(10) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `member_id` (`member_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/Base/PerformanceBase.php b/tests/unit/Component/Model/Base/PerformanceBase.php index 89e0415867..75fa0db373 100644 --- a/tests/unit/Component/Model/Base/PerformanceBase.php +++ b/tests/unit/Component/Model/Base/PerformanceBase.php @@ -15,7 +15,9 @@ * tb_performance 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Performance.name", default="tb_performance"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Performance.poolName")) + * * @DDL(sql="CREATE TABLE `tb_performance` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `value` varchar(255) NOT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/Base/PolymorphicBase.php b/tests/unit/Component/Model/Base/PolymorphicBase.php index 59a22e93b6..9cdf10bb38 100644 --- a/tests/unit/Component/Model/Base/PolymorphicBase.php +++ b/tests/unit/Component/Model/Base/PolymorphicBase.php @@ -15,7 +15,9 @@ * tb_polymorphic 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Polymorphic.name", default="tb_polymorphic"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Polymorphic.poolName")) + * * @DDL(sql="CREATE TABLE `tb_polymorphic` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `type` int(10) unsigned NOT NULL, `to_one` int(10) unsigned NOT NULL DEFAULT '0', `to_many` int(10) unsigned NOT NULL DEFAULT '0', `one_to_one` int(10) unsigned NOT NULL DEFAULT '0', `one_to_many` int(10) unsigned NOT NULL DEFAULT '0', `many_to_many` int(10) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/Base/PrefixBase.php b/tests/unit/Component/Model/Base/PrefixBase.php index bdb846dc8e..f363f223e3 100644 --- a/tests/unit/Component/Model/Base/PrefixBase.php +++ b/tests/unit/Component/Model/Base/PrefixBase.php @@ -15,7 +15,9 @@ * prefix 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Prefix.name", default="prefix"), usePrefix=true, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Prefix.poolName", default="dbPrefix")) + * * @DDL(sql="CREATE TABLE `tb_prefix` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `delete_time` int(10) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/Base/RoleBase.php b/tests/unit/Component/Model/Base/RoleBase.php index b50f527c6b..1f7af3e048 100644 --- a/tests/unit/Component/Model/Base/RoleBase.php +++ b/tests/unit/Component/Model/Base/RoleBase.php @@ -15,7 +15,9 @@ * tb_role 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Role.name", default="tb_role"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Role.poolName")) + * * @DDL(sql="CREATE TABLE `tb_role` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; insert into `tb_role` values(1,'a'); insert into `tb_role` values(2,'b'); insert into `tb_role` values(3,'c'); insert into `tb_role` values(4,'d'); insert into `tb_role` values(5,'e'); ", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/Base/TestEnumBase.php b/tests/unit/Component/Model/Base/TestEnumBase.php index b3c8f36523..4e6ebeaff8 100644 --- a/tests/unit/Component/Model/Base/TestEnumBase.php +++ b/tests/unit/Component/Model/Base/TestEnumBase.php @@ -15,7 +15,9 @@ * tb_test_enum 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\TestEnum.name", default="tb_test_enum"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\TestEnum.poolName")) + * * @DDL(sql="CREATE TABLE `tb_test_enum` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `value1` enum('a','b','c','''test''') NOT NULL DEFAULT '''test''', `value2` enum('1','2','3') NOT NULL DEFAULT '1', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/Base/TestFieldNameBase.php b/tests/unit/Component/Model/Base/TestFieldNameBase.php index bf6d36a081..40ba8d0b7e 100644 --- a/tests/unit/Component/Model/Base/TestFieldNameBase.php +++ b/tests/unit/Component/Model/Base/TestFieldNameBase.php @@ -15,7 +15,9 @@ * tb_test_field_name 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\TestFieldName.name", default="tb_test_field_name"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\TestFieldName.poolName")) + * * @DDL(sql="CREATE TABLE `tb_test_field_name` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `Abc_Def` varchar(255) NOT NULL, `ABC_XYZ` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/Base/TestJsonBase.php b/tests/unit/Component/Model/Base/TestJsonBase.php index 2c0fe0c9b4..a0d32dee78 100644 --- a/tests/unit/Component/Model/Base/TestJsonBase.php +++ b/tests/unit/Component/Model/Base/TestJsonBase.php @@ -15,7 +15,9 @@ * test 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\TestJson.name", default="tb_test_json"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\TestJson.poolName")) + * * @DDL(sql="CREATE TABLE `tb_test_json` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `json_data` json NOT NULL COMMENT 'json数据', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='test'", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/Base/TestListBase.php b/tests/unit/Component/Model/Base/TestListBase.php index feea2f3249..f2eaf69547 100644 --- a/tests/unit/Component/Model/Base/TestListBase.php +++ b/tests/unit/Component/Model/Base/TestListBase.php @@ -15,7 +15,9 @@ * tb_test_list 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\TestList.name", default="tb_test_list"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\TestList.poolName")) + * * @DDL(sql="CREATE TABLE `tb_test_list` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `list` varchar(255) NOT NULL DEFAULT '', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/Base/TestSetBase.php b/tests/unit/Component/Model/Base/TestSetBase.php index 862124e714..2572538689 100644 --- a/tests/unit/Component/Model/Base/TestSetBase.php +++ b/tests/unit/Component/Model/Base/TestSetBase.php @@ -15,7 +15,9 @@ * tb_test_set 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\TestSet.name", default="tb_test_set"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\TestSet.poolName")) + * * @DDL(sql="CREATE TABLE `tb_test_set` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `value1` set('a','b','c','''test''') NOT NULL DEFAULT '''test''', `value2` set('1','2','3') NOT NULL DEFAULT '1,2', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/Base/TestSoftDeleteBase.php b/tests/unit/Component/Model/Base/TestSoftDeleteBase.php index 784c834f0c..400363459b 100644 --- a/tests/unit/Component/Model/Base/TestSoftDeleteBase.php +++ b/tests/unit/Component/Model/Base/TestSoftDeleteBase.php @@ -15,7 +15,9 @@ * tb_test_soft_delete 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\TestSoftDelete.name", default="tb_test_soft_delete"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\TestSoftDelete.poolName")) + * * @DDL(sql="CREATE TABLE `tb_test_soft_delete` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(255) NOT NULL, `delete_time` int(10) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/Base/TestWithMemberBase.php b/tests/unit/Component/Model/Base/TestWithMemberBase.php index b8ae37d1b6..437dc692b6 100644 --- a/tests/unit/Component/Model/Base/TestWithMemberBase.php +++ b/tests/unit/Component/Model/Base/TestWithMemberBase.php @@ -15,7 +15,9 @@ * 测试 with member 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\TestWithMember.name", default="tb_test_with_member"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\TestWithMember.poolName")) + * * @DDL(sql="CREATE TABLE `tb_test_with_member` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `member_id` int(10) unsigned NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='测试 with member'", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/Base/TreeBase.php b/tests/unit/Component/Model/Base/TreeBase.php index e1948caa93..4d7c3ce1dd 100644 --- a/tests/unit/Component/Model/Base/TreeBase.php +++ b/tests/unit/Component/Model/Base/TreeBase.php @@ -15,7 +15,9 @@ * tb_tree 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Tree.name", default="tb_tree"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Tree.poolName")) + * * @DDL(sql="CREATE TABLE `tb_tree` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `parent_id` int(10) unsigned NOT NULL, `name` varchar(32) NOT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT; insert into `tb_tree` values(1,0,'a'); insert into `tb_tree` values(2,0,'b'); insert into `tb_tree` values(3,0,'c'); insert into `tb_tree` values(4,1,'a-1'); insert into `tb_tree` values(5,1,'a-2'); insert into `tb_tree` values(6,4,'a-1-1'); insert into `tb_tree` values(7,4,'a-1-2'); insert into `tb_tree` values(8,2,'b-1'); insert into `tb_tree` values(9,2,'b-2'); ", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/Base/UnusedBase.php b/tests/unit/Component/Model/Base/UnusedBase.php index f9ac4df80f..06daaf914f 100644 --- a/tests/unit/Component/Model/Base/UnusedBase.php +++ b/tests/unit/Component/Model/Base/UnusedBase.php @@ -15,7 +15,9 @@ * tb_unused 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Unused.name", default="tb_unused"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\Unused.poolName")) + * * @DDL(sql="CREATE TABLE `tb_unused` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/Base/UpdateTimeBase.php b/tests/unit/Component/Model/Base/UpdateTimeBase.php index b425a1675a..9ebe2e31f3 100644 --- a/tests/unit/Component/Model/Base/UpdateTimeBase.php +++ b/tests/unit/Component/Model/Base/UpdateTimeBase.php @@ -15,7 +15,9 @@ * tb_update_time 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\UpdateTime.name", default="tb_update_time"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\UpdateTime.poolName")) + * * @DDL(sql="CREATE TABLE `tb_update_time` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `date` date DEFAULT NULL, `time` time DEFAULT NULL, `datetime` datetime DEFAULT NULL, `timestamp` timestamp NULL DEFAULT NULL, `int` int(11) DEFAULT NULL, `bigint` bigint(20) DEFAULT NULL, `bigint_second` bigint(20) DEFAULT NULL, `year` year(4) DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/Base/VirtualColumnBase.php b/tests/unit/Component/Model/Base/VirtualColumnBase.php index a44f9ff18e..063bae8bc2 100644 --- a/tests/unit/Component/Model/Base/VirtualColumnBase.php +++ b/tests/unit/Component/Model/Base/VirtualColumnBase.php @@ -15,7 +15,9 @@ * tb_virtual_column 基类. * * @Entity(camel=true, bean=true, incrUpdate=false) + * * @Table(name=@ConfigValue(name="@app.models.Imi\Test\Component\Model\VirtualColumn.name", default="tb_virtual_column"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.Imi\Test\Component\Model\VirtualColumn.poolName")) + * * @DDL(sql="CREATE TABLE `tb_virtual_column` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `amount` int(11) NOT NULL, `virtual_amount` decimal(10,2) GENERATED ALWAYS AS ((`amount` / 100)) VIRTUAL NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci", decode="") * * @property int|null $id diff --git a/tests/unit/Component/Model/MemberWithArticles.php b/tests/unit/Component/Model/MemberWithArticles.php index 179fa0f834..59fbbb79c7 100644 --- a/tests/unit/Component/Model/MemberWithArticles.php +++ b/tests/unit/Component/Model/MemberWithArticles.php @@ -21,7 +21,9 @@ class MemberWithArticles extends Member { /** * @OneToMany("Article") + * * @JoinFrom("id") + * * @JoinTo("member_id") * * @var Article[]|null @@ -54,7 +56,9 @@ public function setArticles($articles) /** * @OneToMany(model="Article", with=true) + * * @JoinFrom("id") + * * @JoinTo("member_id") * * @var Article[]|null diff --git a/tests/unit/Component/Model/MemberWithRoles.php b/tests/unit/Component/Model/MemberWithRoles.php index ba2aeb77d5..f2f6666fc1 100644 --- a/tests/unit/Component/Model/MemberWithRoles.php +++ b/tests/unit/Component/Model/MemberWithRoles.php @@ -25,7 +25,9 @@ class MemberWithRoles extends Member { /** * @ManyToMany(model="Role", middle="MemberRoleRelation", rightMany="roles") + * * @JoinToMiddle(field="id", middleField="member_id") + * * @JoinFromMiddle(middleField="role_id", field="id") * * @AutoSave @@ -91,7 +93,9 @@ public function setRoles($roles) /** * @ManyToMany(model="Role", middle="MemberRoleRelation", rightMany="rolesWith", with=true) + * * @JoinToMiddle(field="id", middleField="member_id") + * * @JoinFromMiddle(middleField="role_id", field="id") * * @AutoSave diff --git a/tests/unit/Component/Model/MemberWithSqlField.php b/tests/unit/Component/Model/MemberWithSqlField.php index e64ff29429..266a25d016 100644 --- a/tests/unit/Component/Model/MemberWithSqlField.php +++ b/tests/unit/Component/Model/MemberWithSqlField.php @@ -21,6 +21,7 @@ class MemberWithSqlField extends MemberBase { /** * @Column(name="a", virtual=true) + * * @Sql("1+1") * * @var int @@ -29,6 +30,7 @@ class MemberWithSqlField extends MemberBase /** * @Column(virtual=true) + * * @Sql("2+2") * * @var int diff --git a/tests/unit/Component/Model/Polymorphic.php b/tests/unit/Component/Model/Polymorphic.php index e8f6bf97d1..c0d10c7cc5 100644 --- a/tests/unit/Component/Model/Polymorphic.php +++ b/tests/unit/Component/Model/Polymorphic.php @@ -26,7 +26,9 @@ class Polymorphic extends PolymorphicBase { /** * @PolymorphicOneToOne(model="Article", type="title", typeValue="PolymorphicOneToOne") + * * @JoinFrom("one_to_one") + * * @JoinTo("member_id") * * @var Article|null @@ -59,7 +61,9 @@ public function setOneToOneResult($oneToOneResult) /** * @PolymorphicOneToMany(model="Article", type="title", typeValue="PolymorphicOneToMany") + * * @JoinFrom("one_to_many") + * * @JoinTo("member_id") * * @var Article[]|null @@ -92,7 +96,9 @@ public function setOneToManyResult($oneToManyResult) /** * @PolymorphicManyToMany(model="Role", middle="MemberRoleRelation", rightMany="manyToManyResultList", type="type", typeValue=1) + * * @JoinToMiddle(field="many_to_many", middleField="member_id") + * * @JoinFromMiddle(middleField="role_id", field="id") * * @var MemberRoleRelation|null @@ -219,7 +225,9 @@ public function setToManyResult($toManyResult) /** * @PolymorphicOneToOne(model="Article", type="title", typeValue="PolymorphicOneToOne", with=true) + * * @JoinFrom("one_to_one") + * * @JoinTo("member_id") * * @var Article|null @@ -252,7 +260,9 @@ public function setOneToOneResultWith($oneToOneResultWith) /** * @PolymorphicOneToMany(model="Article", type="title", typeValue="PolymorphicOneToMany", with=true) + * * @JoinFrom("one_to_many") + * * @JoinTo("member_id") * * @var Article[]|null @@ -285,7 +295,9 @@ public function setOneToManyResultWith($oneToManyResultWith) /** * @PolymorphicManyToMany(model="Role", middle="MemberRoleRelation", rightMany="manyToManyResultListWith", type="type", typeValue=1, with=true) + * * @JoinToMiddle(field="many_to_many", middleField="member_id") + * * @JoinFromMiddle(middleField="role_id", field="id") * * @var MemberRoleRelation|null diff --git a/tests/unit/Component/Model/TestWithMember.php b/tests/unit/Component/Model/TestWithMember.php index ad0a5b8386..6afb5d25c0 100644 --- a/tests/unit/Component/Model/TestWithMember.php +++ b/tests/unit/Component/Model/TestWithMember.php @@ -32,8 +32,11 @@ class TestWithMember extends TestWithMemberBase /** * @OneToOne(model=MemberSerializable::class) + * * @JoinFrom("member_id") + * * @JoinTo("id") + * * @AutoSelect(false) * * @var MemberSerializable|null diff --git a/tests/unit/Component/Tests/EnvTest.php b/tests/unit/Component/Tests/EnvTest.php index 804434b5b8..c86e794151 100644 --- a/tests/unit/Component/Tests/EnvTest.php +++ b/tests/unit/Component/Tests/EnvTest.php @@ -5,11 +5,10 @@ namespace Imi\Test\Component\Tests; use Imi\Env; +use Imi\Test\BaseTest; use function Imi\env; -use Imi\Test\BaseTest; - class EnvTest extends BaseTest { public function testFunctionEnv(): void diff --git a/tests/unit/Component/Tool/TestTool.php b/tests/unit/Component/Tool/TestTool.php index 3cf411f3c6..f805cf20b5 100644 --- a/tests/unit/Component/Tool/TestTool.php +++ b/tests/unit/Component/Tool/TestTool.php @@ -22,6 +22,7 @@ class TestTool extends BaseCommand * 测试. * * @CommandAction("test") + * * @Option(name="code", type=ArgType::INT, default=0) */ public function test(int $code): void @@ -32,6 +33,7 @@ public function test(int $code): void /** * @CommandAction(name="testBool", dynamicOptions=true) + * * @Option(name="a1", shortcut="a", type=ArgType::BOOL, default=true, to="x") * @Option(name="b2", shortcut="b", type=ArgType::BOOL, default=false, to="y") */ @@ -45,6 +47,7 @@ public function testBool(bool $a1, bool $b2, bool $x, bool $y): void /** * @CommandAction(name="testArgument", dynamicOptions=true) + * * @Argument(name="content", type=ArgType::STRING, default="", to="content2") */ public function testArgument(string $content, string $content2): void @@ -55,6 +58,7 @@ public function testArgument(string $content, string $content2): void /** * @CommandAction(name="testNegatable") + * * @Option(name="test", shortcut="t", type=ArgType::BOOL_NEGATABLE, default=false) */ public function testNegatable(bool $test): void diff --git a/tests/unit/Component/Validate/Classes/TestAutoConstructValidator.php b/tests/unit/Component/Validate/Classes/TestAutoConstructValidator.php index 6c2e602a25..34f4a6cbd2 100644 --- a/tests/unit/Component/Validate/Classes/TestAutoConstructValidator.php +++ b/tests/unit/Component/Validate/Classes/TestAutoConstructValidator.php @@ -20,12 +20,19 @@ * @AutoValidation * * @Compare(name="compare", operation="<", value=0) + * * @Decimal(name="decimal", min=1, max=10, accuracy=2) + * * @InEnum(name="enum", enum=\Imi\Test\Component\Enum\TestEnum::class) + * * @InList(name="in", list={1, 2, 3}, message="{:value} 不在列表内") + * * @Required(name="required", message="{name}为必须参数") + * * @Number(name="number", min=0.01, max=999.99, accuracy=2, message="数值必须大于等于{min},小于等于{max},小数点最多保留{accuracy}位小数,当前值为{:value}") + * * @Text(name="text", min=6, max=12, message="{name}参数长度必须>={min} && <={max}") + * * @Compare(name="validateValue", value=@ValidateValue("{:data.compare}"), operation="==") */ class TestAutoConstructValidator extends LazyArrayObject diff --git a/tests/unit/Component/Validate/Classes/TestSceneAnnotationValidator.php b/tests/unit/Component/Validate/Classes/TestSceneAnnotationValidator.php index 9ec210c537..dd2ebcaa88 100644 --- a/tests/unit/Component/Validate/Classes/TestSceneAnnotationValidator.php +++ b/tests/unit/Component/Validate/Classes/TestSceneAnnotationValidator.php @@ -11,7 +11,9 @@ /** * @Decimal(name="decimal", min=1, max=10, accuracy=2) + * * @Integer(name="int", min=0, max=100, message="{:value} 不符合大于等于{min}且小于等于{max}") + * * @Scene(name="a", fields={"decimal"}) * @Scene(name="b", fields={"int"}) * @Scene(name="c", fields={"decimal", "int"}) diff --git a/tests/unit/Component/Validate/Classes/TestSceneValidator.php b/tests/unit/Component/Validate/Classes/TestSceneValidator.php index 60995d7315..52a55afbe1 100644 --- a/tests/unit/Component/Validate/Classes/TestSceneValidator.php +++ b/tests/unit/Component/Validate/Classes/TestSceneValidator.php @@ -10,6 +10,7 @@ /** * @Decimal(name="decimal", min=1, max=10, accuracy=2) + * * @Integer(name="int", min=0, max=100, message="{:value} 不符合大于等于{min}且小于等于{max}") */ class TestSceneValidator extends Validator diff --git a/tests/unit/Component/Validate/Classes/TestValidator.php b/tests/unit/Component/Validate/Classes/TestValidator.php index d8009018ab..62f8ae5eab 100644 --- a/tests/unit/Component/Validate/Classes/TestValidator.php +++ b/tests/unit/Component/Validate/Classes/TestValidator.php @@ -18,17 +18,28 @@ /** * @Compare(name="compare", operation="<", value=0) + * * @Decimal(name="decimal", min=1, max=10, accuracy=2) + * * @InEnum(name="enum", enum=\Imi\Test\Component\Enum\TestEnum::class) + * * @InList(name="in", list={1, 2, 3}, message="{:value} 不在列表内") + * * @Integer(name="int", min=0, max=100, message="{:value} 不符合大于等于{min}且小于等于{max}") + * * @Required(name="required", message="{name}为必须参数") + * * @Number(name="number", min=0.01, max=999.99, accuracy=2, message="数值必须大于等于{min},小于等于{max},小数点最多保留{accuracy}位小数,当前值为{:value}") + * * @Text(name="text", min=6, max=12, message="{name}参数长度必须>={min} && <={max}") * @Text(name="chars", char=true, min=6, max=12, message="{name}参数长度必须>={min} && <={max}") + * * @Compare(name="validateValue", value=@ValidateValue("{:data.compare}"), operation="==") + * * @Integer(name="optional", min=0, max=100, message="{:value} 不符合大于等于{min}且小于等于{max}", optional=true) + * * @Regex(name="regex", pattern="/^\d+$/") + * * @Integer(name="list1.*.id", min=0, max=10, message="{:value} 不符合大于等于{min}且小于等于{max}") * @Integer(name="list2.*", min=0, max=10, message="{:value} 不符合大于等于{min}且小于等于{max}") */