From ceb167657acb5ee8d5db706719dc69f4031c9f22 Mon Sep 17 00:00:00 2001 From: inhere Date: Sun, 13 Sep 2020 20:38:55 +0800 Subject: [PATCH] run php cs fixer on validator --- .travis.yml | 2 +- README.md | 2 + README.zh-CN.md | 17 +- src/annotation/README.zh-CN.md | 2 +- src/aop/README.zh-CN.md | 2 +- src/bean/README.zh-CN.md | 2 +- src/config/README.zh-CN.md | 2 +- src/connection-pool/README.zh-CN.md | 2 +- src/console/README.zh-CN.md | 2 +- src/db/.travis.yml | 2 +- src/db/README.zh-CN.md | 2 +- src/error/.travis.yml | 2 +- src/error/README.zh-CN.md | 2 +- src/event/README.zh-CN.md | 2 +- src/framework/.travis.yml | 2 +- src/framework/README.zh-CN.md | 2 +- src/http-message/README.zh-CN.md | 2 +- src/http-server/.travis.yml | 2 +- src/http-server/README.zh-CN.md | 2 +- src/i18n/.travis.yml | 2 +- src/i18n/README.zh-CN.md | 2 +- src/log/README.zh-CN.md | 2 +- src/process/README.zh-CN.md | 2 +- src/proxy/README.zh-CN.md | 2 +- src/redis/.travis.yml | 2 +- src/redis/README.zh-CN.md | 2 +- src/rpc-client/.travis.yml | 2 +- src/rpc-client/README.zh-CN.md | 2 +- src/rpc-server/.travis.yml | 2 +- src/rpc-server/README.zh-CN.md | 2 +- src/rpc/README.zh-CN.md | 2 +- src/server/README.zh-CN.md | 2 +- src/stdlib/README.zh-CN.md | 2 +- src/task/.travis.yml | 2 +- src/task/README.zh-CN.md | 2 +- src/tcp-server/README.zh-CN.md | 2 +- src/tcp/README.zh-CN.md | 2 +- src/validator/.travis.yml | 4 +- src/validator/README.zh-CN.md | 2 +- src/validator/run.php | 12 +- .../src/Annotation/Mapping/AfterDate.php | 8 + .../src/Annotation/Mapping/Alpha.php | 8 + .../src/Annotation/Mapping/AlphaDash.php | 8 + .../src/Annotation/Mapping/AlphaNum.php | 8 + .../src/Annotation/Mapping/BeforeDate.php | 8 + src/validator/src/Annotation/Mapping/Chs.php | 8 + .../src/Annotation/Mapping/ChsAlpha.php | 8 + .../src/Annotation/Mapping/ChsAlphaDash.php | 8 + .../src/Annotation/Mapping/ChsAlphaNum.php | 8 + .../src/Annotation/Mapping/Confirm.php | 8 + src/validator/src/Annotation/Mapping/Date.php | 8 + .../src/Annotation/Mapping/DateRange.php | 9 + .../src/Annotation/Mapping/Different.php | 8 + src/validator/src/Annotation/Mapping/Dns.php | 8 + .../src/Annotation/Mapping/Email.php | 9 +- src/validator/src/Annotation/Mapping/Enum.php | 9 +- src/validator/src/Annotation/Mapping/File.php | 8 + .../src/Annotation/Mapping/FileMediaType.php | 8 + .../src/Annotation/Mapping/FileSize.php | 8 + .../src/Annotation/Mapping/FileSuffix.php | 8 + .../src/Annotation/Mapping/GreaterThan.php | 8 + src/validator/src/Annotation/Mapping/Ip.php | 9 +- .../src/Annotation/Mapping/IsArray.php | 9 +- .../src/Annotation/Mapping/IsBool.php | 9 +- .../src/Annotation/Mapping/IsFloat.php | 9 +- .../src/Annotation/Mapping/IsInt.php | 9 +- .../src/Annotation/Mapping/IsString.php | 9 +- .../src/Annotation/Mapping/Length.php | 9 +- .../src/Annotation/Mapping/LessThan.php | 8 + src/validator/src/Annotation/Mapping/Low.php | 8 + src/validator/src/Annotation/Mapping/Max.php | 10 +- src/validator/src/Annotation/Mapping/Min.php | 9 +- .../src/Annotation/Mapping/Mobile.php | 9 +- .../src/Annotation/Mapping/NotEmpty.php | 9 +- .../src/Annotation/Mapping/NotInEnum.php | 8 + .../src/Annotation/Mapping/NotInRange.php | 9 + .../src/Annotation/Mapping/Pattern.php | 9 +- .../src/Annotation/Mapping/Range.php | 10 +- .../src/Annotation/Mapping/Required.php | 9 +- src/validator/src/Annotation/Mapping/Type.php | 12 +- .../src/Annotation/Mapping/Upper.php | 9 +- src/validator/src/Annotation/Mapping/Url.php | 8 + .../src/Annotation/Mapping/Validate.php | 11 +- .../src/Annotation/Mapping/ValidateType.php | 9 +- .../src/Annotation/Mapping/Validator.php | 11 +- .../src/Annotation/Parser/AfterDateParser.php | 8 + .../src/Annotation/Parser/AlphaDashParser.php | 8 + .../src/Annotation/Parser/AlphaNumParser.php | 8 + .../src/Annotation/Parser/AlphaParser.php | 8 + .../Annotation/Parser/BeforeDateParser.php | 8 + .../Annotation/Parser/ChsAlphaDashParser.php | 8 + .../Annotation/Parser/ChsAlphaNumParser.php | 8 + .../src/Annotation/Parser/ChsAlphaParser.php | 8 + .../src/Annotation/Parser/ChsParser.php | 8 + .../src/Annotation/Parser/ConfirmParser.php | 8 + .../src/Annotation/Parser/DateParser.php | 8 + .../src/Annotation/Parser/DateRangeParser.php | 8 + .../src/Annotation/Parser/DifferentParser.php | 8 + .../src/Annotation/Parser/DnsParser.php | 8 + .../src/Annotation/Parser/EmailParser.php | 10 +- .../src/Annotation/Parser/EnumParser.php | 10 +- .../Parser/FileMediaTypeDateParser.php | 8 + .../src/Annotation/Parser/FileParser.php | 8 + .../src/Annotation/Parser/FileSizeParser.php | 8 + .../Annotation/Parser/FileSuffixParser.php | 8 + .../Annotation/Parser/GreaterThanParser.php | 8 + .../src/Annotation/Parser/IpParser.php | 10 +- .../src/Annotation/Parser/IsArrayParser.php | 10 +- .../src/Annotation/Parser/IsBoolParser.php | 10 +- .../src/Annotation/Parser/IsFloatParser.php | 9 +- .../src/Annotation/Parser/IsIntParser.php | 9 +- .../src/Annotation/Parser/IsStringParser.php | 9 +- .../src/Annotation/Parser/LengthParser.php | 10 +- .../src/Annotation/Parser/LessThanParser.php | 8 + .../src/Annotation/Parser/LowParser.php | 8 + .../src/Annotation/Parser/MaxParser.php | 10 +- .../src/Annotation/Parser/MinParser.php | 10 +- .../src/Annotation/Parser/MobileParser.php | 10 +- .../src/Annotation/Parser/NotEmptyParser.php | 10 +- .../src/Annotation/Parser/NotInEnumParser.php | 8 + .../Annotation/Parser/NotInRangeParser.php | 8 + .../src/Annotation/Parser/PatternParser.php | 10 +- .../src/Annotation/Parser/RangeParser.php | 10 +- .../src/Annotation/Parser/RequiredParser.php | 8 + .../src/Annotation/Parser/UpperParser.php | 8 + .../src/Annotation/Parser/UrlParser.php | 8 + .../src/Annotation/Parser/ValidateParser.php | 22 +- .../src/Annotation/Parser/ValidatorParser.php | 12 +- src/validator/src/AutoLoader.php | 10 +- .../src/Concern/ValidateItemTrait.php | 12 +- src/validator/src/Contract/RuleInterface.php | 9 +- .../src/Contract/ValidatorInterface.php | 9 +- .../src/Exception/ValidatorException.php | 16 +- src/validator/src/Helper/ValidatorHelper.php | 11 +- .../src/Listener/AppInitCompleteListener.php | 12 +- src/validator/src/Rule/AfterDateRule.php | 10 +- src/validator/src/Rule/AlphaDashRule.php | 8 + src/validator/src/Rule/AlphaNumRule.php | 8 + src/validator/src/Rule/AlphaRule.php | 8 + src/validator/src/Rule/BeforeDateRule.php | 10 +- src/validator/src/Rule/ChsAlphaDashRule.php | 8 + src/validator/src/Rule/ChsAlphaNumRule.php | 8 + src/validator/src/Rule/ChsAlphaRule.php | 9 +- src/validator/src/Rule/ChsRule.php | 9 +- src/validator/src/Rule/ConfirmRule.php | 9 +- src/validator/src/Rule/DateRangeRule.php | 10 +- src/validator/src/Rule/DateRule.php | 10 +- src/validator/src/Rule/DifferentRule.php | 8 + src/validator/src/Rule/DnsRule.php | 8 + src/validator/src/Rule/EmailRule.php | 10 +- src/validator/src/Rule/EnumRule.php | 10 +- src/validator/src/Rule/FileMediaTypeRule.php | 9 +- src/validator/src/Rule/FileRule.php | 8 + src/validator/src/Rule/FileSizeRule.php | 8 + src/validator/src/Rule/FileSuffixRule.php | 8 + src/validator/src/Rule/GreaterThanRule.php | 12 +- src/validator/src/Rule/IpRule.php | 10 +- src/validator/src/Rule/IsArrayRule.php | 10 +- src/validator/src/Rule/IsBoolRule.php | 10 +- src/validator/src/Rule/IsFloatRule.php | 10 +- src/validator/src/Rule/IsIntRule.php | 10 +- src/validator/src/Rule/IsStringRule.php | 10 +- src/validator/src/Rule/LengthRule.php | 10 +- src/validator/src/Rule/LessThanRule.php | 12 +- src/validator/src/Rule/LowRule.php | 8 + src/validator/src/Rule/MaxRule.php | 10 +- src/validator/src/Rule/MinRule.php | 10 +- src/validator/src/Rule/MobileRule.php | 10 +- src/validator/src/Rule/NotEmptyRule.php | 10 +- src/validator/src/Rule/NotInEnumRule.php | 8 + src/validator/src/Rule/NotInRangeRule.php | 8 + src/validator/src/Rule/PatternRule.php | 10 +- src/validator/src/Rule/RangeRule.php | 10 +- src/validator/src/Rule/UpperRule.php | 8 + src/validator/src/Rule/UrlRule.php | 8 + src/validator/src/ValidateRegister.php | 11 +- src/validator/src/Validator.php | 29 ++- src/validator/src/ValidatorRegister.php | 20 +- src/validator/test/bean.php | 11 +- src/validator/test/bootstrap.php | 8 + src/validator/test/config/base.php | 13 +- src/validator/test/testing/AutoLoader.php | 12 +- src/validator/test/testing/ValidateDemo.php | 14 +- src/validator/test/testing/ValidateDemo2.php | 21 +- src/validator/test/testing/ValidateDemo3.php | 11 +- src/validator/test/testing/ValidateUser.php | 15 +- .../test/testing/Validator/NoRequired.php | 8 + .../testing/Validator/RequiredValidator.php | 8 + .../test/testing/Validator/TestRule.php | 8 + .../test/testing/Validator/TestValidator.php | 12 +- .../test/testing/Validator/TestValidator2.php | 9 +- .../test/testing/Validator/TestValidator3.php | 10 +- .../testing/Validator/UserBaseValidate.php | 11 +- .../test/testing/Validator/UserValidator.php | 12 +- .../test/testing/ValidatorNoRequired.php | 9 +- .../test/testing/ValidatorRequired.php | 9 +- src/validator/test/testing/ValidatorRule.php | 8 + src/validator/test/unit/NoRequiredTest.php | 16 +- src/validator/test/unit/RequiredTest.php | 13 +- src/validator/test/unit/TestCase.php | 12 +- src/validator/test/unit/UnfieldsTest.php | 22 +- src/validator/test/unit/UserValidatorTest.php | 25 +- src/validator/test/unit/ValidatorRuleTest.php | 219 +++++++++++------- src/validator/test/unit/ValidatorTest.php | 68 +++--- src/validator/test/unit/ValidatorTypeTest.php | 70 +++--- src/websocket-server/.travis.yml | 2 +- src/websocket-server/README.zh-CN.md | 2 +- 207 files changed, 1660 insertions(+), 395 deletions(-) diff --git a/.travis.yml b/.travis.yml index d22d6aaf2..0c9a9ad56 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,7 @@ before_install: ) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;' install: - echo 'no' | pecl install -f redis - - wget https://github.com/swoole/swoole-src/archive/v4.4.18.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - + - wget https://github.com/swoole/swoole-src/archive/v4.5.2.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - - echo "extension = swoole.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini before_script: diff --git a/README.md b/README.md index 08c18877d..6f2989789 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ This repository is used to manage all swoft core components. ## [中文说明](README.zh-CN.md) +中文说明请查看 [README.zh-CN.md](README.zh-CN.md) + ## IMPORTANT All components will **NOT** be modified in the original repository of ext component, **SHOULD ALWAYS** be modified in this repository, also commit and push to this repository, and then @swoft-bot would sync changes to the original repository of component by `git subtree push`, notice that this action needs triggered by the repositories owner. diff --git a/README.zh-CN.md b/README.zh-CN.md index d490a9b3b..272d8ecde 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -6,7 +6,9 @@ 这里是swoft基础和核心组件的开发仓库,所有的核心组件都是由这里分发出去的。 -## [English](README.md) +## [ENGLISH](README.md) + +The english readme please see [README.md](README.md) ## 如何使用 @@ -111,7 +113,18 @@ export RUN_SERVER_TEST=ws,http,tcp; ./phpunit.sh websocket-server ### 手动发布 -需要到机器上使用 releasecli 工具执行对应命令来发布操作。 +需要到机器上使用 `releasecli` 工具执行对应命令来发布操作。 + +## 其他工具 + +### php cs fix + +```bash +php-cs-fixer fix + +# for path +php-cs-fixer fix ./some/path +``` ## 使用文档 diff --git a/src/annotation/README.zh-CN.md b/src/annotation/README.zh-CN.md index b86521f1f..bb92c8c4f 100644 --- a/src/annotation/README.zh-CN.md +++ b/src/annotation/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Annotation Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/aop/README.zh-CN.md b/src/aop/README.zh-CN.md index 9ebdf9b69..89a33b66f 100644 --- a/src/aop/README.zh-CN.md +++ b/src/aop/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Aop Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/bean/README.zh-CN.md b/src/bean/README.zh-CN.md index d5e89f506..c32190268 100644 --- a/src/bean/README.zh-CN.md +++ b/src/bean/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Bean Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/config/README.zh-CN.md b/src/config/README.zh-CN.md index bc14b39e4..7fb8495e9 100644 --- a/src/config/README.zh-CN.md +++ b/src/config/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Config Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/connection-pool/README.zh-CN.md b/src/connection-pool/README.zh-CN.md index 8d950b480..b44095aaa 100644 --- a/src/connection-pool/README.zh-CN.md +++ b/src/connection-pool/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Connection Pool Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/console/README.zh-CN.md b/src/console/README.zh-CN.md index d91d4ff80..28e4a8665 100644 --- a/src/console/README.zh-CN.md +++ b/src/console/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Console Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/db/.travis.yml b/src/db/.travis.yml index 0d706cc8a..bceca4214 100644 --- a/src/db/.travis.yml +++ b/src/db/.travis.yml @@ -50,7 +50,7 @@ before_install: PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;' install: - - wget https://github.com/swoole/swoole-src/archive/v4.4.18.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - + - wget https://github.com/swoole/swoole-src/archive/v4.5.2.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - - echo "extension = swoole.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini before_script: diff --git a/src/db/README.zh-CN.md b/src/db/README.zh-CN.md index cffcd4294..af3df6f79 100644 --- a/src/db/README.zh-CN.md +++ b/src/db/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Db Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/error/.travis.yml b/src/error/.travis.yml index 3c0548702..67a87b513 100644 --- a/src/error/.travis.yml +++ b/src/error/.travis.yml @@ -5,7 +5,7 @@ php: - 7.2 - 7.3 install: - - wget https://github.com/swoole/swoole-src/archive/v4.4.18.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - + - wget https://github.com/swoole/swoole-src/archive/v4.5.2.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - - echo "extension = swoole.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini before_script: - composer config -g process-timeout 9000 && composer update diff --git a/src/error/README.zh-CN.md b/src/error/README.zh-CN.md index 64020ee6d..d87b75e41 100644 --- a/src/error/README.zh-CN.md +++ b/src/error/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Error Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/event/README.zh-CN.md b/src/event/README.zh-CN.md index 0f16f6ae6..0affc1eaa 100644 --- a/src/event/README.zh-CN.md +++ b/src/event/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Event Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/framework/.travis.yml b/src/framework/.travis.yml index db519ab50..f60a8b731 100644 --- a/src/framework/.travis.yml +++ b/src/framework/.travis.yml @@ -6,7 +6,7 @@ php: - 7.3 install: - - wget https://github.com/swoole/swoole-src/archive/v4.4.18.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - + - wget https://github.com/swoole/swoole-src/archive/v4.5.2.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - - echo "extension = swoole.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini before_script: diff --git a/src/framework/README.zh-CN.md b/src/framework/README.zh-CN.md index aa467da1d..4b4332f36 100644 --- a/src/framework/README.zh-CN.md +++ b/src/framework/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Framework Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/http-message/README.zh-CN.md b/src/http-message/README.zh-CN.md index 02706f829..15083c5ac 100644 --- a/src/http-message/README.zh-CN.md +++ b/src/http-message/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Http Message Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/http-server/.travis.yml b/src/http-server/.travis.yml index 3c768ea72..335770937 100644 --- a/src/http-server/.travis.yml +++ b/src/http-server/.travis.yml @@ -6,7 +6,7 @@ php: - 7.3 install: - - wget https://github.com/swoole/swoole-src/archive/v4.4.18.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - + - wget https://github.com/swoole/swoole-src/archive/v4.5.2.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - - echo "extension = swoole.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini before_script: diff --git a/src/http-server/README.zh-CN.md b/src/http-server/README.zh-CN.md index 7aa428283..61400d386 100644 --- a/src/http-server/README.zh-CN.md +++ b/src/http-server/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Http Server Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/i18n/.travis.yml b/src/i18n/.travis.yml index e3042fc89..5567411fe 100644 --- a/src/i18n/.travis.yml +++ b/src/i18n/.travis.yml @@ -5,7 +5,7 @@ php: - 7.2 - 7.3 install: - - wget https://github.com/swoole/swoole-src/archive/v4.4.18.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - + - wget https://github.com/swoole/swoole-src/archive/v4.5.2.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - - echo "extension = swoole.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini before_script: - composer config -g process-timeout 9000 && composer update diff --git a/src/i18n/README.zh-CN.md b/src/i18n/README.zh-CN.md index 72dd07c21..2e7434129 100644 --- a/src/i18n/README.zh-CN.md +++ b/src/i18n/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft I18n Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/log/README.zh-CN.md b/src/log/README.zh-CN.md index 2d247459f..45ebe5347 100644 --- a/src/log/README.zh-CN.md +++ b/src/log/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Log Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/process/README.zh-CN.md b/src/process/README.zh-CN.md index 585a26357..bd80d59c4 100644 --- a/src/process/README.zh-CN.md +++ b/src/process/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Process Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/proxy/README.zh-CN.md b/src/proxy/README.zh-CN.md index 9ee1e7736..2ae93cfd8 100644 --- a/src/proxy/README.zh-CN.md +++ b/src/proxy/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Proxy Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/redis/.travis.yml b/src/redis/.travis.yml index b79475cb8..65cec0054 100644 --- a/src/redis/.travis.yml +++ b/src/redis/.travis.yml @@ -8,7 +8,7 @@ services: - redis install: - echo 'no' | pecl install -f redis - - wget https://github.com/swoole/swoole-src/archive/v4.4.18.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - + - wget https://github.com/swoole/swoole-src/archive/v4.5.2.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - - echo "extension = swoole.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini before_script: diff --git a/src/redis/README.zh-CN.md b/src/redis/README.zh-CN.md index 29f658564..ce20b01e1 100644 --- a/src/redis/README.zh-CN.md +++ b/src/redis/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Redis Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/rpc-client/.travis.yml b/src/rpc-client/.travis.yml index 44892b271..f492fbce8 100644 --- a/src/rpc-client/.travis.yml +++ b/src/rpc-client/.travis.yml @@ -5,7 +5,7 @@ php: - 7.2 - 7.3 install: - - wget https://github.com/swoole/swoole-src/archive/v4.4.18.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - + - wget https://github.com/swoole/swoole-src/archive/v4.5.2.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - - echo "extension = swoole.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini before_script: diff --git a/src/rpc-client/README.zh-CN.md b/src/rpc-client/README.zh-CN.md index 65c199dd5..e9ec249b1 100644 --- a/src/rpc-client/README.zh-CN.md +++ b/src/rpc-client/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Rpc Client Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/rpc-server/.travis.yml b/src/rpc-server/.travis.yml index 9c39bc9b2..68a24c7e7 100644 --- a/src/rpc-server/.travis.yml +++ b/src/rpc-server/.travis.yml @@ -5,7 +5,7 @@ php: - 7.3 install: - - wget https://github.com/swoole/swoole-src/archive/v4.4.18.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - + - wget https://github.com/swoole/swoole-src/archive/v4.5.2.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - - echo "extension = swoole.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini before_script: diff --git a/src/rpc-server/README.zh-CN.md b/src/rpc-server/README.zh-CN.md index cc4056936..1b6d9e4a0 100644 --- a/src/rpc-server/README.zh-CN.md +++ b/src/rpc-server/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Rpc Server Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/rpc/README.zh-CN.md b/src/rpc/README.zh-CN.md index 0a299d28e..cf8bfc692 100644 --- a/src/rpc/README.zh-CN.md +++ b/src/rpc/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Rpc Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/server/README.zh-CN.md b/src/server/README.zh-CN.md index f1d6799f0..9234e6297 100644 --- a/src/server/README.zh-CN.md +++ b/src/server/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Server Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/stdlib/README.zh-CN.md b/src/stdlib/README.zh-CN.md index 597e129ea..7ddfc5954 100644 --- a/src/stdlib/README.zh-CN.md +++ b/src/stdlib/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Stdlib Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/task/.travis.yml b/src/task/.travis.yml index 44892b271..f492fbce8 100644 --- a/src/task/.travis.yml +++ b/src/task/.travis.yml @@ -5,7 +5,7 @@ php: - 7.2 - 7.3 install: - - wget https://github.com/swoole/swoole-src/archive/v4.4.18.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - + - wget https://github.com/swoole/swoole-src/archive/v4.5.2.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - - echo "extension = swoole.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini before_script: diff --git a/src/task/README.zh-CN.md b/src/task/README.zh-CN.md index fdf824e35..df32a5056 100644 --- a/src/task/README.zh-CN.md +++ b/src/task/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Task Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/tcp-server/README.zh-CN.md b/src/tcp-server/README.zh-CN.md index c19ece586..79de47ada 100644 --- a/src/tcp-server/README.zh-CN.md +++ b/src/tcp-server/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Tcp Server Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/tcp/README.zh-CN.md b/src/tcp/README.zh-CN.md index 55b40b122..522fd9c19 100644 --- a/src/tcp/README.zh-CN.md +++ b/src/tcp/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Tcp Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/validator/.travis.yml b/src/validator/.travis.yml index 44892b271..62fbe1b53 100644 --- a/src/validator/.travis.yml +++ b/src/validator/.travis.yml @@ -4,14 +4,14 @@ php: - 7.1 - 7.2 - 7.3 + install: - - wget https://github.com/swoole/swoole-src/archive/v4.4.18.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - + - wget https://github.com/swoole/swoole-src/archive/v4.5.2.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - - echo "extension = swoole.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini before_script: - composer config -g process-timeout 900 && composer update - phpenv config-rm xdebug.ini - script: - composer test diff --git a/src/validator/README.zh-CN.md b/src/validator/README.zh-CN.md index ae37a78a6..7253b5c79 100644 --- a/src/validator/README.zh-CN.md +++ b/src/validator/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Validator Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装 diff --git a/src/validator/run.php b/src/validator/run.php index 229cafb6f..74bf96594 100644 --- a/src/validator/run.php +++ b/src/validator/run.php @@ -1,4 +1,12 @@ -type; } -} \ No newline at end of file +} diff --git a/src/validator/src/Annotation/Mapping/ValidateType.php b/src/validator/src/Annotation/Mapping/ValidateType.php index aaaf4e979..3bf00cd4f 100644 --- a/src/validator/src/Annotation/Mapping/ValidateType.php +++ b/src/validator/src/Annotation/Mapping/ValidateType.php @@ -1,5 +1,12 @@ name; } -} \ No newline at end of file +} diff --git a/src/validator/src/Annotation/Parser/AfterDateParser.php b/src/validator/src/Annotation/Parser/AfterDateParser.php index 5a92107ee..3a2f48dfd 100644 --- a/src/validator/src/Annotation/Parser/AfterDateParser.php +++ b/src/validator/src/Annotation/Parser/AfterDateParser.php @@ -1,4 +1,12 @@ getType(); $unfields = $annotationObject->getUnfields(); - ValidateRegister::registerValidate($this->className, $this->methodName, $validator, $fields, $unfields, $params, - '', $type); + ValidateRegister::registerValidate( + $this->className, + $this->methodName, + $validator, + $fields, + $unfields, + $params, + '', + $type + ); return []; } diff --git a/src/validator/src/Annotation/Parser/ValidatorParser.php b/src/validator/src/Annotation/Parser/ValidatorParser.php index 2c7fb70c3..7e5886411 100644 --- a/src/validator/src/Annotation/Parser/ValidatorParser.php +++ b/src/validator/src/Annotation/Parser/ValidatorParser.php @@ -1,9 +1,15 @@ className, Bean::SINGLETON, '']; } -} \ No newline at end of file +} diff --git a/src/validator/src/AutoLoader.php b/src/validator/src/AutoLoader.php index 754c7502e..7e8522548 100644 --- a/src/validator/src/AutoLoader.php +++ b/src/validator/src/AutoLoader.php @@ -1,9 +1,15 @@ getDate(); $value = $data[$propertyName]; if (is_string($value)) { - $dt = DateTime::createFromFormat("Y-m-d H:i:s", $value); + $dt = DateTime::createFromFormat('Y-m-d H:i:s', $value); if (($dt !== false && !array_sum($dt::getLastErrors())) && strtotime($value) >= strtotime($date)) { return $data; } elseif (ctype_digit($value)) { diff --git a/src/validator/src/Rule/AlphaDashRule.php b/src/validator/src/Rule/AlphaDashRule.php index 613e2a17a..a5d6b4dba 100644 --- a/src/validator/src/Rule/AlphaDashRule.php +++ b/src/validator/src/Rule/AlphaDashRule.php @@ -1,4 +1,12 @@ getDate(); $value = $data[$propertyName]; if (is_string($value)) { - $dt = DateTime::createFromFormat("Y-m-d H:i:s", $value); + $dt = DateTime::createFromFormat('Y-m-d H:i:s', $value); if (($dt !== false && !array_sum($dt::getLastErrors())) && strtotime($value) <= strtotime($date)) { return $data; } elseif (ctype_digit($value)) { diff --git a/src/validator/src/Rule/ChsAlphaDashRule.php b/src/validator/src/Rule/ChsAlphaDashRule.php index 4fb9f71f0..fb6466ea7 100644 --- a/src/validator/src/Rule/ChsAlphaDashRule.php +++ b/src/validator/src/Rule/ChsAlphaDashRule.php @@ -1,4 +1,12 @@ getEnd(); $value = $data[$propertyName]; if (is_string($value)) { - $dt = DateTime::createFromFormat("Y-m-d H:i:s", $value); + $dt = DateTime::createFromFormat('Y-m-d H:i:s', $value); if (($dt !== false && !array_sum($dt::getLastErrors())) && strtotime($value) >= strtotime($start) && $value <= strtotime($end)) { return $data; } elseif (ctype_digit($value)) { diff --git a/src/validator/src/Rule/DateRule.php b/src/validator/src/Rule/DateRule.php index 0f0ad0199..dd40327a6 100644 --- a/src/validator/src/Rule/DateRule.php +++ b/src/validator/src/Rule/DateRule.php @@ -1,4 +1,12 @@ getClientMediaType(), $values)) { - throw new ValidatorException($message); } } else { diff --git a/src/validator/src/Rule/FileRule.php b/src/validator/src/Rule/FileRule.php index 8631f0360..7f272ab48 100644 --- a/src/validator/src/Rule/FileRule.php +++ b/src/validator/src/Rule/FileRule.php @@ -1,4 +1,12 @@ getName()] ?? ''; $value = $data[$propertyName]; - settype($name, "float"); - settype($value, "float"); + settype($name, 'float'); + settype($value, 'float'); if ($value > $name) { return $data; } diff --git a/src/validator/src/Rule/IpRule.php b/src/validator/src/Rule/IpRule.php index f8f1e1a97..c92ddbc16 100644 --- a/src/validator/src/Rule/IpRule.php +++ b/src/validator/src/Rule/IpRule.php @@ -1,9 +1,15 @@ getName()] ?? ''; $value = $data[$propertyName]; - settype($name, "float"); - settype($value, "float"); + settype($name, 'float'); + settype($value, 'float'); if ($value < $name) { return $data; } diff --git a/src/validator/src/Rule/LowRule.php b/src/validator/src/Rule/LowRule.php index 651edbbb3..604d4b77b 100644 --- a/src/validator/src/Rule/LowRule.php +++ b/src/validator/src/Rule/LowRule.php @@ -1,4 +1,12 @@ $property) { /* @var IsString|IsInt|IsBool|IsFloat $type */ - $type = $property['type']['annotation'] ?? null; - $default = $property['type']['default'] ?? null; - $annotations = $property['annotations'] ?? []; + $type = $property['type']['annotation'] ?? null; if ($type === null) { continue; } - $name = $type->getName(); - $propName = empty($name) ? $propName : $name; - - if (!empty($fields) && !in_array($propName, $fields, true)) { + $propName = $type->getName() ?: $propName; + if ($fields && !in_array($propName, $fields, true)) { continue; } @@ -201,8 +205,11 @@ protected function validateDefaultValidator(array $data, array $validator, array continue; } + $defaultVal = $property['type']['default'] ?? null; + $annotations = $property['annotations'] ?? []; + // Default validate item(Type) and other item - $data = $this->validateDefaultItem($data, $propName, $type, $default); + $data = $this->validateDefaultItem($data, $propName, $type, $defaultVal); foreach ($annotations as $annotation) { if ($annotation instanceof Required) { continue; @@ -250,8 +257,10 @@ protected function validateUserValidator(string $validateName, array $data, arra { $validator = BeanFactory::getBean($validateName); if (!$validator instanceof ValidatorInterface) { - throw new ValidatorException(sprintf('User validator(%s) must instance of ValidatorInterface', - $validateName)); + throw new ValidatorException(sprintf( + 'User validator(%s) must instance of ValidatorInterface', + $validateName + )); } return $validator->validate($data, $params); diff --git a/src/validator/src/ValidatorRegister.php b/src/validator/src/ValidatorRegister.php index 82946399c..34b721edc 100644 --- a/src/validator/src/ValidatorRegister.php +++ b/src/validator/src/ValidatorRegister.php @@ -1,5 +1,12 @@ $values) { if ($values['type'] == self::TYPE_USER) { @@ -163,8 +170,11 @@ public static function checkValidators() foreach ($properties as $propName => $propValues) { $type = $propValues['type'] ?? null; if (empty($type)) { - throw new ValidatorException(sprintf('Property(%s->%s) must be define `@XxxType`', $className, - $propName)); + throw new ValidatorException(sprintf( + 'Property(%s->%s) must be define `@XxxType`', + $className, + $propName + )); } } } diff --git a/src/validator/test/bean.php b/src/validator/test/bean.php index 318c0cc2a..fead01e14 100644 --- a/src/validator/test/bean.php +++ b/src/validator/test/bean.php @@ -1,4 +1,13 @@ - [ 'path' => __DIR__ . '/config', diff --git a/src/validator/test/bootstrap.php b/src/validator/test/bootstrap.php index 90537fbc8..9c6dcb3a1 100644 --- a/src/validator/test/bootstrap.php +++ b/src/validator/test/bootstrap.php @@ -1,4 +1,12 @@ validateRequest($data, - $this->getValidates(ValidatorNoRequired::class, 'testNoRequired')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorNoRequired::class, 'testNoRequired') + ); } catch (ValidatorException $e) { } diff --git a/src/validator/test/unit/RequiredTest.php b/src/validator/test/unit/RequiredTest.php index adf384327..55dc9b607 100644 --- a/src/validator/test/unit/RequiredTest.php +++ b/src/validator/test/unit/RequiredTest.php @@ -1,9 +1,16 @@ validateRequest([], $validates); } - public function testRequiredPassed() + public function testRequiredPassed(): void { // 断言异常不出现 $this->expectOutputString('successful'); diff --git a/src/validator/test/unit/TestCase.php b/src/validator/test/unit/TestCase.php index 74c11b82c..ec9e4ac94 100644 --- a/src/validator/test/unit/TestCase.php +++ b/src/validator/test/unit/TestCase.php @@ -1,9 +1,15 @@ validateRequest($data, $this->getValidates(ValidateDemo3::class, 'unfield')); @@ -27,10 +34,9 @@ public function testUnfields() 'email' => '121', ]; - $body = (new Validator())->validate($data, TestValidator3::class, [], [], ["ip", "count", "email"]); + $body = (new Validator())->validate($data, TestValidator3::class, [], [], ['ip', 'count', 'email']); $this->assertIsArray($body); $this->assertEquals($body, $data); - } /** @@ -38,7 +44,7 @@ public function testUnfields() * * @throws ValidatorException */ - public function testUnfieldsException() + public function testUnfieldsException(): void { $data = []; (new Validator())->validateRequest($data, $this->getValidates(ValidateDemo3::class, 'unfield2')); @@ -50,11 +56,11 @@ public function testUnfieldsException() * * @throws ValidatorException */ - public function testUnfieldsException2() + public function testUnfieldsException2(): void { $data = [ 'email' => '121', ]; - (new Validator())->validate($data, TestValidator3::class, [], [], ["ip", "count"]); + (new Validator())->validate($data, TestValidator3::class, [], [], ['ip', 'count']); } -} \ No newline at end of file +} diff --git a/src/validator/test/unit/UserValidatorTest.php b/src/validator/test/unit/UserValidatorTest.php index 2dab21038..7a39123f4 100644 --- a/src/validator/test/unit/UserValidatorTest.php +++ b/src/validator/test/unit/UserValidatorTest.php @@ -1,9 +1,15 @@ 123, @@ -39,7 +44,7 @@ public function testUserFail() * * @throws ValidatorException */ - public function testUserFail2() + public function testUserFail2(): void { $data = [ 'start' => 123, @@ -49,13 +54,13 @@ public function testUserFail2() $users = [ UserValidator::class => [ 1, - "name" + 'name' ] ]; (new Validator())->validate($data, UserBaseValidate::class, [], $users); } - public function testFail() + public function testFail(): void { $data = [ 'start' => 123, @@ -67,7 +72,7 @@ public function testFail() $this->assertEquals($data, $result); } - public function testFail2() + public function testFail2(): void { $data = [ 'start' => 123, @@ -78,10 +83,10 @@ public function testFail2() $users = [ UserValidator::class => [ 1, - "name" + 'name' ] ]; $result = (new Validator())->validate($data, UserBaseValidate::class, [], $users); $this->assertEquals($data, $result); } -} \ No newline at end of file +} diff --git a/src/validator/test/unit/ValidatorRuleTest.php b/src/validator/test/unit/ValidatorRuleTest.php index 48ff82f62..cce730eb2 100644 --- a/src/validator/test/unit/ValidatorRuleTest.php +++ b/src/validator/test/unit/ValidatorRuleTest.php @@ -1,4 +1,12 @@ '2019-07-06' @@ -22,13 +30,15 @@ public function testAfterDateError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testAfterDate')); } - public function testAfterDateSuccess() + public function testAfterDateSuccess(): void { $data = [ 'dataAfterDate' => '2019-07-09 00:00:00' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testAfterDate')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testAfterDate') + ); $this->assertEquals($data, $result); } @@ -38,7 +48,7 @@ public function testAfterDateSuccess() * * @throws ValidatorException */ - public function testAlphaError() + public function testAlphaError(): void { $data = [ 'dataAlpha' => 'abcde0123' @@ -46,13 +56,15 @@ public function testAlphaError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testAlpha')); } - public function testAlphaSuccess() + public function testAlphaSuccess(): void { $data = [ 'dataAlpha' => 'abcd' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testAlpha')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testAlpha') + ); $this->assertEquals($data, $result); } @@ -62,7 +74,7 @@ public function testAlphaSuccess() * * @throws ValidatorException */ - public function testAlphaDashError() + public function testAlphaDashError(): void { $data = [ 'dataAlphaDash' => '.=' @@ -70,13 +82,15 @@ public function testAlphaDashError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testAlphaDash')); } - public function testAlphaDashSuccess() + public function testAlphaDashSuccess(): void { $data = [ 'dataAlphaDash' => 'abcd0123-_' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testAlphaDash')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testAlphaDash') + ); $this->assertEquals($data, $result); } @@ -86,7 +100,7 @@ public function testAlphaDashSuccess() * * @throws ValidatorException */ - public function testAlphaNumError() + public function testAlphaNumError(): void { $data = [ 'dataAlphaNum' => 'abcde-' @@ -94,13 +108,15 @@ public function testAlphaNumError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testAlphaNum')); } - public function testAlphaNumSuccess() + public function testAlphaNumSuccess(): void { $data = [ 'dataAlphaNum' => 'abcd012' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testAlphaNum')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testAlphaNum') + ); $this->assertEquals($data, $result); } @@ -110,7 +126,7 @@ public function testAlphaNumSuccess() * * @throws ValidatorException */ - public function testBeforeDateError() + public function testBeforeDateError(): void { $data = [ 'dataBeforeDate' => '2019-07-10' @@ -118,13 +134,15 @@ public function testBeforeDateError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testBeforeDate')); } - public function testBeforeDateSuccess() + public function testBeforeDateSuccess(): void { $data = [ 'dataBeforeDate' => '2019-07-01 00:00:00' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testBeforeDate')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testBeforeDate') + ); $this->assertEquals($data, $result); } @@ -134,7 +152,7 @@ public function testBeforeDateSuccess() * * @throws ValidatorException */ - public function testChsError() + public function testChsError(): void { $data = [ 'dataChs' => 'english' @@ -142,13 +160,15 @@ public function testChsError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testChs')); } - public function testChsSuccess() + public function testChsSuccess(): void { $data = [ 'dataChs' => '中文' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testChs')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testChs') + ); $this->assertEquals($data, $result); } @@ -158,7 +178,7 @@ public function testChsSuccess() * * @throws ValidatorException */ - public function testChsAlphaError() + public function testChsAlphaError(): void { $data = [ 'dataChsAlpha' => '-_' @@ -166,13 +186,15 @@ public function testChsAlphaError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testChsAlpha')); } - public function testChsAlphaSuccess() + public function testChsAlphaSuccess(): void { $data = [ 'dataChsAlpha' => '中文english' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testChsAlpha')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testChsAlpha') + ); $this->assertEquals($data, $result); } @@ -182,7 +204,7 @@ public function testChsAlphaSuccess() * * @throws ValidatorException */ - public function testChsAlphaDashError() + public function testChsAlphaDashError(): void { $data = [ 'dataChsAlphaDash' => '>?' @@ -190,13 +212,15 @@ public function testChsAlphaDashError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testChsAlphaDash')); } - public function testChsAlphaDashSuccess() + public function testChsAlphaDashSuccess(): void { $data = [ 'dataChsAlphaDash' => '中文english0123-_' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testChsAlphaDash')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testChsAlphaDash') + ); $this->assertEquals($data, $result); } @@ -206,7 +230,7 @@ public function testChsAlphaDashSuccess() * * @throws ValidatorException */ - public function testChsAlphaNumError() + public function testChsAlphaNumError(): void { $data = [ 'dataChsAlphaNum' => '-_' @@ -214,13 +238,15 @@ public function testChsAlphaNumError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testChsAlphaNum')); } - public function testChsAlphaNumSuccess() + public function testChsAlphaNumSuccess(): void { $data = [ 'dataChsAlphaNum' => '中文english0123' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testChsAlphaNum')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testChsAlphaNum') + ); $this->assertEquals($data, $result); } @@ -230,7 +256,7 @@ public function testChsAlphaNumSuccess() * * @throws ValidatorException */ - public function testConfirmError() + public function testConfirmError(): void { $data = [ 'dataConfirm' => '123', @@ -239,14 +265,16 @@ public function testConfirmError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testConfirm')); } - public function testConfirmSuccess() + public function testConfirmSuccess(): void { $data = [ 'dataConfirm' => '123', 'confirm' => '123' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testConfirm')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testConfirm') + ); $this->assertEquals($data, $result); } @@ -256,7 +284,7 @@ public function testConfirmSuccess() * * @throws ValidatorException */ - public function testDifferentError() + public function testDifferentError(): void { $data = [ 'dataDifferent' => '123', @@ -265,14 +293,16 @@ public function testDifferentError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testDifferent')); } - public function testDifferentSuccess() + public function testDifferentSuccess(): void { $data = [ 'dataDifferent' => '123', 'different' => '1234a' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testDifferent')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testDifferent') + ); $this->assertEquals($data, $result); } @@ -282,7 +312,7 @@ public function testDifferentSuccess() * * @throws ValidatorException */ - public function testGreaterThanError() + public function testGreaterThanError(): void { $data = [ 'dataGreaterThan' => '12', @@ -291,14 +321,16 @@ public function testGreaterThanError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testGreaterThan')); } - public function testGreaterThanSuccess() + public function testGreaterThanSuccess(): void { $data = [ 'dataGreaterThan' => '124', 'gt' => '123' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testGreaterThan')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testGreaterThan') + ); $this->assertEquals($data, $result); } @@ -308,7 +340,7 @@ public function testGreaterThanSuccess() * * @throws ValidatorException */ - public function testLessThanError() + public function testLessThanError(): void { $data = [ 'dataLessThan' => '124', @@ -317,14 +349,16 @@ public function testLessThanError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testLessThan')); } - public function testLessThanSuccess() + public function testLessThanSuccess(): void { $data = [ 'dataLessThan' => '122', 'lt' => '123' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testLessThan')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testLessThan') + ); $this->assertEquals($data, $result); } @@ -334,7 +368,7 @@ public function testLessThanSuccess() * * @throws ValidatorException */ - public function testDateError() + public function testDateError(): void { $data = [ 'dataDate' => '2019f' @@ -342,13 +376,15 @@ public function testDateError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testDate')); } - public function testDateSuccess() + public function testDateSuccess(): void { $data = [ 'dataDate' => '2019-07-08 12:00:30' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testDate')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testDate') + ); $this->assertEquals($data, $result); } @@ -358,7 +394,7 @@ public function testDateSuccess() * * @throws ValidatorException */ - public function testDateRangeError() + public function testDateRangeError(): void { $data = [ 'dataDateRange' => '2019-06-18' @@ -366,13 +402,15 @@ public function testDateRangeError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testDateRange')); } - public function testDateRangeSuccess() + public function testDateRangeSuccess(): void { $data = [ 'dataDateRange' => '2019-07-07 00:00:00' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testDateRange')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testDateRange') + ); $this->assertEquals($data, $result); } @@ -382,7 +420,7 @@ public function testDateRangeSuccess() * * @throws ValidatorException */ - public function testDnsError() + public function testDnsError(): void { $data = [ 'dataDns' => 'swoft.con' @@ -390,13 +428,15 @@ public function testDnsError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testDns')); } - public function testDnsSuccess() + public function testDnsSuccess(): void { $data = [ 'dataDns' => 'baidu.com' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testDns')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testDns') + ); $this->assertEquals($data, $result); } @@ -429,13 +469,14 @@ public function testDnsSuccess() // public function testIsFileSuccess() // { // } + /** * @expectedException Swoft\Validator\Exception\ValidatorException * @expectedExceptionMessage low message * * @throws ValidatorException */ - public function testLowError() + public function testLowError(): void { $data = [ 'dataLow' => 'swofT' @@ -443,13 +484,15 @@ public function testLowError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testLow')); } - public function testLowSuccess() + public function testLowSuccess(): void { $data = [ 'dataLow' => 'swoft' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testLow')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testLow') + ); $this->assertEquals($data, $result); } @@ -459,7 +502,7 @@ public function testLowSuccess() * * @throws ValidatorException */ - public function testNotInEnumError() + public function testNotInEnumError(): void { $data = [ 'dataNotInEnum' => '1' @@ -467,13 +510,15 @@ public function testNotInEnumError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testNotInEnum')); } - public function testNotInEnumSuccess() + public function testNotInEnumSuccess(): void { $data = [ 'dataNotInEnum' => '4' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testNotInEnum')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testNotInEnum') + ); $this->assertEquals($data, $result); } @@ -483,7 +528,7 @@ public function testNotInEnumSuccess() * * @throws ValidatorException */ - public function testNotInRangeError() + public function testNotInRangeError(): void { $data = [ 'dataNotInRange' => '1' @@ -491,13 +536,15 @@ public function testNotInRangeError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testNotInRange')); } - public function testNotInRangeSuccess() + public function testNotInRangeSuccess(): void { $data = [ 'dataNotInRange' => '4' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testNotInRange')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testNotInRange') + ); $this->assertEquals($data, $result); } @@ -507,7 +554,7 @@ public function testNotInRangeSuccess() * * @throws ValidatorException */ - public function testUpperError() + public function testUpperError(): void { $data = [ 'dataUpper' => 'sWOFT' @@ -515,13 +562,15 @@ public function testUpperError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testUpper')); } - public function testUpperSuccess() + public function testUpperSuccess(): void { $data = [ 'dataUpper' => 'SWOFT' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testUpper')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testUpper') + ); $this->assertEquals($data, $result); } @@ -531,7 +580,7 @@ public function testUpperSuccess() * * @throws ValidatorException */ - public function testUrlError() + public function testUrlError(): void { $data = [ 'dataUrl' => 'baidu.com' @@ -539,13 +588,15 @@ public function testUrlError() (new Validator())->validateRequest($data, $this->getValidates(ValidatorRule::class, 'testUrl')); } - public function testUrlSuccess() + public function testUrlSuccess(): void { $data = [ 'dataUrl' => 'http://baidu.com' ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidatorRule::class, 'testUrl')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidatorRule::class, 'testUrl') + ); $this->assertEquals($data, $result); } } diff --git a/src/validator/test/unit/ValidatorTest.php b/src/validator/test/unit/ValidatorTest.php index e891805d3..e19bd0c67 100644 --- a/src/validator/test/unit/ValidatorTest.php +++ b/src/validator/test/unit/ValidatorTest.php @@ -1,9 +1,15 @@ validateRequest($data, $this->getValidates(ValidateDemo2::class, 'testEmail')); @@ -33,7 +39,7 @@ public function testTypeEmail() * * @throws ValidatorException */ - public function testFailEmail() + public function testFailEmail(): void { $data = [ 'email' => 'swoft' @@ -47,7 +53,7 @@ public function testFailEmail() * * @throws ValidatorException */ - public function testFailEmail2() + public function testFailEmail2(): void { $data = [ 'email' => 'swoft' @@ -59,7 +65,7 @@ public function testFailEmail2() /** * @throws ValidatorException */ - public function testEmail() + public function testEmail(): void { $data = [ 'email' => 'swoft@swoft.org' @@ -71,7 +77,7 @@ public function testEmail() /** * @throws ValidatorException */ - public function testEmail2() + public function testEmail2(): void { $data = [ 'email' => 'swoft@swoft.org' @@ -86,7 +92,7 @@ public function testEmail2() * * @throws ValidatorException */ - public function testFailEnum() + public function testFailEnum(): void { $data = [ 'enum' => 1, @@ -97,7 +103,7 @@ public function testFailEnum() /** * @throws ValidatorException */ - public function testEnum() + public function testEnum(): void { $data = [ 'enum' => 4, @@ -113,7 +119,7 @@ public function testEnum() * * @throws ValidatorException */ - public function testFailIp() + public function testFailIp(): void { $data = [ 'ip' => '11', @@ -124,7 +130,7 @@ public function testFailIp() /** * @throws ValidatorException */ - public function testIp() + public function testIp(): void { $data = [ 'ip' => '127.0.0.1', @@ -140,7 +146,7 @@ public function testIp() * * @throws ValidatorException */ - public function testFailLength() + public function testFailLength(): void { $data = [ 'length' => '1', @@ -151,7 +157,7 @@ public function testFailLength() /** * @throws ValidatorException */ - public function testLength() + public function testLength(): void { $data = [ 'length' => '12121', @@ -167,7 +173,7 @@ public function testLength() * * @throws ValidatorException */ - public function testFailMax() + public function testFailMax(): void { $data = [ 'max' => 18, @@ -178,7 +184,7 @@ public function testFailMax() /** * @throws ValidatorException */ - public function testMax() + public function testMax(): void { $data = [ 'max' => 12, @@ -194,7 +200,7 @@ public function testMax() * * @throws ValidatorException */ - public function testFailMin() + public function testFailMin(): void { $data = [ 'min' => 0, @@ -205,7 +211,7 @@ public function testFailMin() /** * @throws ValidatorException */ - public function testMin() + public function testMin(): void { $data = [ 'min' => 2, @@ -221,7 +227,7 @@ public function testMin() * * @throws ValidatorException */ - public function testFailMobile() + public function testFailMobile(): void { $data = [ 'mobile' => '13442', @@ -232,7 +238,7 @@ public function testFailMobile() /** * @throws ValidatorException */ - public function testMobile() + public function testMobile(): void { $data = [ 'mobile' => '13511111111', @@ -248,7 +254,7 @@ public function testMobile() * * @throws ValidatorException */ - public function testFailNotEmpty() + public function testFailNotEmpty(): void { $data = [ 'notEmpty' => '', @@ -259,13 +265,15 @@ public function testFailNotEmpty() /** * @throws ValidatorException */ - public function testNotEmpty() + public function testNotEmpty(): void { $data = [ 'notEmpty' => '121', ]; - [$result] = (new Validator())->validateRequest($data, - $this->getValidates(ValidateDemo2::class, 'testNotEmpty')); + [$result] = (new Validator())->validateRequest( + $data, + $this->getValidates(ValidateDemo2::class, 'testNotEmpty') + ); $this->assertEquals($result, $data); } @@ -276,7 +284,7 @@ public function testNotEmpty() * * @throws ValidatorException */ - public function testFailPattern() + public function testFailPattern(): void { $data = [ 'pattern' => 'swift', @@ -287,7 +295,7 @@ public function testFailPattern() /** * @throws ValidatorException */ - public function testPattern() + public function testPattern(): void { $data = [ 'pattern' => 'swoft', @@ -303,7 +311,7 @@ public function testPattern() * * @throws ValidatorException */ - public function testFailRange() + public function testFailRange(): void { $data = [ 'range' => 100, @@ -317,7 +325,7 @@ public function testFailRange() * * @throws ValidatorException */ - public function testFailRange2() + public function testFailRange2(): void { $data = [ 'range' => 100, @@ -328,7 +336,7 @@ public function testFailRange2() /** * @throws ValidatorException */ - public function testRange() + public function testRange(): void { $data = [ 'range' => 99, @@ -341,7 +349,7 @@ public function testRange() /** * @throws ValidatorException */ - public function testRange2() + public function testRange2(): void { $data = [ 'range' => 99, @@ -350,4 +358,4 @@ public function testRange2() $this->assertEquals($result, $data); } -} \ No newline at end of file +} diff --git a/src/validator/test/unit/ValidatorTypeTest.php b/src/validator/test/unit/ValidatorTypeTest.php index dcf9f3bdd..176f5d9a8 100644 --- a/src/validator/test/unit/ValidatorTypeTest.php +++ b/src/validator/test/unit/ValidatorTypeTest.php @@ -1,9 +1,15 @@ expectExceptionMessage('array must exist!'); + $this->expectException(ValidatorException::class); $data = []; - (new Validator())->validateRequest($data, $this->getValidates( ValidateDemo::class, 'testArray')); + (new Validator())->validateRequest($data, $this->getValidates(ValidateDemo::class, 'testArray')); } /** @@ -33,7 +35,7 @@ public function testArrayType() * * @throws ValidatorException */ - public function testIntType() + public function testIntType(): void { $data = []; (new Validator())->validateRequest($data, $this->getValidates(ValidateDemo::class, 'testInt')); @@ -45,7 +47,7 @@ public function testIntType() * * @throws ValidatorException */ - public function testBoolType() + public function testBoolType(): void { $data = []; (new Validator())->validateRequest($data, $this->getValidates(ValidateDemo::class, 'testBool')); @@ -57,7 +59,7 @@ public function testBoolType() * * @throws ValidatorException */ - public function testStringType() + public function testStringType(): void { $data = []; (new Validator())->validateRequest($data, $this->getValidates(ValidateDemo::class, 'testString')); @@ -69,7 +71,7 @@ public function testStringType() * * @throws ValidatorException */ - public function testFloatType() + public function testFloatType(): void { $data = []; (new Validator())->validateRequest($data, $this->getValidates(ValidateDemo::class, 'testFloat')); @@ -81,7 +83,7 @@ public function testFloatType() * * @throws ValidatorException */ - public function testArrayTypeMessage() + public function testArrayTypeMessage(): void { $data = []; (new Validator())->validateRequest($data, $this->getValidates(ValidateDemo::class, 'testArrayMessage')); @@ -93,7 +95,7 @@ public function testArrayTypeMessage() * * @throws ValidatorException */ - public function testIntTypeMessage() + public function testIntTypeMessage(): void { $data = []; (new Validator())->validateRequest($data, $this->getValidates(ValidateDemo::class, 'testIntMessage')); @@ -105,7 +107,7 @@ public function testIntTypeMessage() * * @throws ValidatorException */ - public function testBoolTypeMessage() + public function testBoolTypeMessage(): void { $data = []; (new Validator())->validateRequest($data, $this->getValidates(ValidateDemo::class, 'testBoolMessage')); @@ -117,7 +119,7 @@ public function testBoolTypeMessage() * * @throws ValidatorException */ - public function testStringTypeMessage() + public function testStringTypeMessage(): void { $data = []; (new Validator())->validateRequest($data, $this->getValidates(ValidateDemo::class, 'testStringMessage')); @@ -129,7 +131,7 @@ public function testStringTypeMessage() * * @throws ValidatorException */ - public function testFloatTypeMessage() + public function testFloatTypeMessage(): void { $data = []; (new Validator())->validateRequest($data, $this->getValidates(ValidateDemo::class, 'testFloatMessage')); @@ -138,7 +140,7 @@ public function testFloatTypeMessage() /** * @throws ValidatorException */ - public function testDefault() + public function testDefault(): void { $data = []; [$data] = (new Validator())->validateRequest($data, $this->getValidates(ValidateDemo::class, 'testTypeDefault')); @@ -156,7 +158,7 @@ public function testDefault() /** * @throws ValidatorException */ - public function testName() + public function testName(): void { $data = []; [$result] = (new Validator())->validateRequest($data, $this->getValidates(ValidateDemo::class, 'testName')); @@ -169,7 +171,7 @@ public function testName() * * @throws ValidatorException */ - public function testFailName() + public function testFailName(): void { $data = [ 'swoftName' => 12 @@ -177,14 +179,13 @@ public function testFailName() (new Validator())->validateRequest($data, $this->getValidates(ValidateDemo::class, 'testName')); } - /** * @expectedException Swoft\Validator\Exception\ValidatorException * @expectedExceptionMessage int must exist! * * @throws ValidatorException */ - public function testIntTypeQuery() + public function testIntTypeQuery(): void { $data = [ 'int' => 1, @@ -198,7 +199,7 @@ public function testIntTypeQuery() * * @throws ValidatorException */ - public function testBoolTypeQuery() + public function testBoolTypeQuery(): void { $data = [ 'bool' => false @@ -212,7 +213,7 @@ public function testBoolTypeQuery() * * @throws ValidatorException */ - public function testStringTypeQuery() + public function testStringTypeQuery(): void { $data = [ 'string' => 'string' @@ -226,7 +227,7 @@ public function testStringTypeQuery() * * @throws ValidatorException */ - public function testFloatTypeQuery() + public function testFloatTypeQuery(): void { $data = [ 'float' => 1.1 @@ -237,15 +238,20 @@ public function testFloatTypeQuery() /** * @throws ValidatorException */ - public function testFloatTypeQuery2() + public function testFloatTypeQuery2(): void { $query = [ 'float' => '2.2' ]; - [, $result] = (new Validator())->validateRequest([], $this->getValidates(ValidateDemo::class, - 'testFloatQuery'), - $query); + [, $result] = (new Validator())->validateRequest( + [], + $this->getValidates( + ValidateDemo::class, + 'testFloatQuery' + ), + $query + ); $this->assertEquals($result, ['float' => 2.2]); } -} \ No newline at end of file +} diff --git a/src/websocket-server/.travis.yml b/src/websocket-server/.travis.yml index 44892b271..f492fbce8 100644 --- a/src/websocket-server/.travis.yml +++ b/src/websocket-server/.travis.yml @@ -5,7 +5,7 @@ php: - 7.2 - 7.3 install: - - wget https://github.com/swoole/swoole-src/archive/v4.4.18.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - + - wget https://github.com/swoole/swoole-src/archive/v4.5.2.tar.gz -O swoole.tar.gz && mkdir -p swoole && tar -xf swoole.tar.gz -C swoole --strip-components=1 && rm swoole.tar.gz && cd swoole && phpize && ./configure && make -j$(nproc) && make install && cd - - echo "extension = swoole.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini before_script: diff --git a/src/websocket-server/README.zh-CN.md b/src/websocket-server/README.zh-CN.md index 27c14d68f..343df3caf 100644 --- a/src/websocket-server/README.zh-CN.md +++ b/src/websocket-server/README.zh-CN.md @@ -9,7 +9,7 @@ Swoft Websocket Server Component ## [ENGLISH](README.md) -English readme please sess [README.md](README.md) +The english readme please see [README.md](README.md) ## 安装