diff --git a/.editorconfig b/.editorconfig index a7c44ddb..e74e04ca 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,15 +1,19 @@ root = true [*] -charset = utf-8 -indent_size = 4 indent_style = space +indent_size = 4 end_of_line = lf -insert_final_newline = true +charset = utf-8 trim_trailing_whitespace = true +insert_final_newline = false + +[*.{vue,js,scss}] +indent_size = 2 +insert_final_newline = true [*.md] trim_trailing_whitespace = false -[*.{yml,yaml}] -indent_size = 2 +[*.{yml,yaml,xml,xml.dist}] +indent_size = 2 \ No newline at end of file diff --git a/composer.json b/composer.json index bc5ee785..3cc91c14 100644 --- a/composer.json +++ b/composer.json @@ -199,7 +199,8 @@ "release-patch-dry-run": "@release-patch --dry-run", "style-fix": "@php ./vendor/bin/php-cs-fixer fix --using-cache=yes --config=.php-cs-fixer.php --ansi", "style-lint": "@style-fix --diff --dry-run", - "test": "@php ./vendor/bin/phpunit --cache-result-file=./build/phpunit/.phpunit.result.cache --coverage-text", - "test-coverage": "@test --coverage-html=./build/phpunit/ --coverage-clover=clover.xml" + "test": "@php ./vendor/bin/phpunit --coverage-text -v", + "test-coverage": "@test --coverage-html=./build/phpunit/ --coverage-clover=clover.xml", + "test-migrate-configuration": "@test --migrate-configuration" } } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 30cc9d4b..e008721b 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,19 +1,19 @@ parameters: ignoreErrors: - - message: "#^PHPDoc tag @return with type Guanguans\\\\Notify\\\\Contracts\\\\MessageInterface\\|Symfony\\\\Component\\\\Mime\\\\RawMessage is not subtype of native type Guanguans\\\\Notify\\\\Contracts\\\\MessageInterface\\.$#" + message: "#^Method Guanguans\\\\Notify\\\\Clients\\\\Client\\:\\:__set\\(\\) with return type void returns \\$this\\(Guanguans\\\\Notify\\\\Clients\\\\Client\\) but should not return anything\\.$#" count: 1 path: src/Clients/Client.php - - message: "#^Unsafe usage of new static\\(\\)\\.$#" + message: "#^PHPDoc tag @return with type Guanguans\\\\Notify\\\\Contracts\\\\MessageInterface\\|Symfony\\\\Component\\\\Mime\\\\RawMessage is not subtype of native type Guanguans\\\\Notify\\\\Contracts\\\\MessageInterface\\.$#" count: 1 path: src/Clients/Client.php - - message: "#^Parameter \\#1 \\$message of method Symfony\\\\Component\\\\Mailer\\\\MailerInterface\\:\\:send\\(\\) expects Symfony\\\\Component\\\\Mime\\\\RawMessage, Guanguans\\\\Notify\\\\Contracts\\\\MessageInterface given\\.$#" + message: "#^Unsafe usage of new static\\(\\)\\.$#" count: 1 - path: src/Clients/MailerClient.php + path: src/Clients/Client.php - message: "#^Call to an undefined method Guanguans\\\\Notify\\\\Contracts\\\\MessageInterface\\:\\:getOptions\\(\\)\\.$#" @@ -50,11 +50,21 @@ parameters: count: 1 path: src/Messages/Chanify/TextMessage.php + - + message: "#^Method Guanguans\\\\Notify\\\\Messages\\\\EmailMessage\\:\\:__set\\(\\) with return type void returns \\$this\\(Guanguans\\\\Notify\\\\Messages\\\\EmailMessage\\) but should not return anything\\.$#" + count: 1 + path: src/Messages/EmailMessage.php + - message: "#^Unsafe usage of new static\\(\\)\\.$#" count: 1 path: src/Messages/EmailMessage.php + - + message: "#^Method Guanguans\\\\Notify\\\\Messages\\\\Message\\:\\:__set\\(\\) with return type void returns \\$this\\(Guanguans\\\\Notify\\\\Messages\\\\Message\\) but should not return anything\\.$#" + count: 1 + path: src/Messages/Message.php + - message: "#^Unsafe usage of new static\\(\\)\\.$#" count: 1 diff --git a/phpstan.neon b/phpstan.neon index 3471cb67..6ed774c6 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -6,7 +6,7 @@ includes: # - vendor/ekino/phpstan-banned-code/extension.neon parameters: - level: 5 + level: 4 paths: - src tmpDir: build/phpstan diff --git a/phpunit.xml.dist b/phpunit.xml.dist index b877841f..45c52205 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,31 +1,32 @@ - - - tests/ - vendor/ - - - - - src/ - - src/Support - src/Skeleton.php - - - + + + tests/ + vendor/ + + + + + src/ + + src/Support + src/Skeleton.php + + + diff --git a/psalm.xml.dist b/psalm.xml.dist index 23814362..aa7deed2 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -1,34 +1,34 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/Feature/DingTalkTest.php b/tests/Feature/DingTalkTest.php index 9373e455..6e8de423 100644 --- a/tests/Feature/DingTalkTest.php +++ b/tests/Feature/DingTalkTest.php @@ -25,8 +25,7 @@ class DingTalkTest extends TestCase { public function testText(): void { - // $this->expectOutputString('300001'); - $this->expectOutputRegex('/^300001|130101$/'); + $this->expectOutputRegex('/^300001|300005|130101$/'); $ret = Factory::dingTalk() ->setToken('c44fec1ddaa8a833156efb77b7865d62ae13775418030d94d05da08bfca73e') @@ -44,8 +43,7 @@ public function testText(): void public function testLink(): void { - // $this->expectOutputString('300001'); - $this->expectOutputRegex('/^300001|130101$/'); + $this->expectOutputRegex('/^300001|300005|130101$/'); $ret = Factory::dingTalk() ->setToken('c44fec1ddaa8a833156efb77b7865d62ae13775418030d94d05da08bfca73e') @@ -63,8 +61,7 @@ public function testLink(): void public function testMarkdown(): void { - // $this->expectOutputString('300001'); - $this->expectOutputRegex('/^300001|130101$/'); + $this->expectOutputRegex('/^300001|300005|130101$/'); $ret = Factory::dingTalk() ->setToken('c44fec1ddaa8a833156efb77b7865d62ae13775418030d94d05da08bfca73e') @@ -83,8 +80,7 @@ public function testMarkdown(): void public function testSingleActionCard(): void { - // $this->expectOutputString('300001'); - $this->expectOutputRegex('/^300001|130101$/'); + $this->expectOutputRegex('/^300001|300005|130101$/'); $ret = Factory::dingTalk() ->setToken('c44fec1ddaa8a833156efb77b7865d62ae13775418030d94d05da08bfca73e') @@ -103,8 +99,7 @@ public function testSingleActionCard(): void public function testBtnsActionCard(): void { - // $this->expectOutputString('300001'); - $this->expectOutputRegex('/^300001|130101$/'); + $this->expectOutputRegex('/^300001|300005|130101$/'); $btnsActionCardMessage = new BtnsActionCardMessage([ 'title' => 'This is title(keyword).', @@ -131,8 +126,7 @@ public function testBtnsActionCard(): void public function testFeedCard(): void { - // $this->expectOutputString('300001'); - $this->expectOutputRegex('/^300001|130101$/'); + $this->expectOutputRegex('/^300001|300005|130101$/'); $feedCardMessage = new FeedCardMessage([ 'title' => 'This is title(keyword) 0.',