Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(style): fix coding styles #866

Merged
merged 3 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Contract/ProviderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ interface ProviderInterface
* @throws InvalidParamsException
* @throws ServiceNotFoundException
*/
public function pay(array $plugins, array $params): Collection|MessageInterface|array|null;
public function pay(array $plugins, array $params): null|array|Collection|MessageInterface;

public function find(array|string $order): Collection|array;
public function find(array|string $order): array|Collection;

public function cancel(array|string $order): array|Collection|null;
public function cancel(array|string $order): null|array|Collection;

public function close(array|string $order): array|Collection|null;
public function close(array|string $order): null|array|Collection;

public function refund(array $order): Collection|array;
public function refund(array $order): array|Collection;

public function callback(null|array|ServerRequestInterface $contents = null, ?array $params = null): Collection;

Expand Down
4 changes: 2 additions & 2 deletions src/Event/CallbackReceived.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class CallbackReceived extends Event

public ?array $params = null;

public ServerRequestInterface|array|null $contents;
public null|array|ServerRequestInterface $contents;

public function __construct(string $provider, ServerRequestInterface|array|null $contents, ?array $params = null, ?Rocket $rocket = null)
public function __construct(string $provider, null|array|ServerRequestInterface $contents, ?array $params = null, ?Rocket $rocket = null)
{
$this->provider = $provider;
$this->contents = $contents;
Expand Down
10 changes: 5 additions & 5 deletions src/Pay.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ class Pay
HttpServiceProvider::class,
];

private static Closure|null|ContainerInterface $container = null;
private static null|Closure|ContainerInterface $container = null;

/**
* @throws ContainerException
*/
private function __construct(array $config, ContainerInterface|Closure $container = null)
private function __construct(array $config, Closure|ContainerInterface $container = null)
{
$this->registerServices($config, $container);

Expand All @@ -102,7 +102,7 @@ public static function __callStatic(string $service, array $config)
/**
* @throws ContainerException
*/
public static function config(array $config = [], ContainerInterface|Closure $container = null): bool
public static function config(array $config = [], Closure|ContainerInterface $container = null): bool
{
if (self::hasContainer() && !($config['_force'] ?? false)) {
return false;
Expand Down Expand Up @@ -192,7 +192,7 @@ public static function has(string $service): bool
return Pay::getContainer()->has($service);
}

public static function setContainer(ContainerInterface|Closure|null $container): void
public static function setContainer(null|Closure|ContainerInterface $container): void
{
self::$container = $container;
}
Expand Down Expand Up @@ -238,7 +238,7 @@ public static function registerService(string $service, mixed $data): void
/**
* @throws ContainerException
*/
private function registerServices(array $config, ContainerInterface|Closure $container = null): void
private function registerServices(array $config, Closure|ContainerInterface $container = null): void
{
foreach (array_merge($this->coreService, $this->service) as $service) {
self::registerService($service, ContainerServiceProvider::class == $service ? $container : $config);
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/Wechat/LaunchPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function assembly(Rocket $rocket, Closure $next): Rocket
/**
* @throws InvalidResponseException
*/
protected function validateResponse(Rocket $rocket): Collection|MessageInterface|array|null
protected function validateResponse(Rocket $rocket): null|array|Collection|MessageInterface
{
$response = $rocket->getDestination();

Expand Down
4 changes: 2 additions & 2 deletions src/Provider/AbstractProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract class AbstractProvider implements ProviderInterface
* @throws InvalidParamsException
* @throws ServiceNotFoundException
*/
public function call(string $plugin, array $params = []): Collection|MessageInterface|null
public function call(string $plugin, array $params = []): null|Collection|MessageInterface
{
if (!class_exists($plugin) || !in_array(ShortcutInterface::class, class_implements($plugin))) {
throw new InvalidParamsException(Exception::SHORTCUT_NOT_FOUND, "[{$plugin}] is not incompatible");
Expand All @@ -56,7 +56,7 @@ public function call(string $plugin, array $params = []): Collection|MessageInte
* @throws ContainerException
* @throws InvalidParamsException
*/
public function pay(array $plugins, array $params): Collection|MessageInterface|null
public function pay(array $plugins, array $params): null|Collection|MessageInterface
{
Logger::info('[AbstractProvider] 即将进行 pay 操作', func_get_args());

Expand Down
8 changes: 4 additions & 4 deletions src/Provider/Alipay.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
* @throws InvalidParamsException
* @throws ServiceNotFoundException
*/
public function find(array|string $order): Collection|array
public function find(array|string $order): array|Collection
{
$order = is_array($order) ? $order : ['out_trade_no' => $order];

Expand All @@ -71,7 +71,7 @@
* @throws InvalidParamsException
* @throws ServiceNotFoundException
*/
public function cancel(array|string $order): Collection|array|null
public function cancel(array|string $order): null|array|Collection

Check warning on line 74 in src/Provider/Alipay.php

View check run for this annotation

Codecov / codecov/patch

src/Provider/Alipay.php#L74

Added line #L74 was not covered by tests
{
$order = is_array($order) ? $order : ['out_trade_no' => $order];

Expand All @@ -85,7 +85,7 @@
* @throws InvalidParamsException
* @throws ServiceNotFoundException
*/
public function close(array|string $order): Collection|array|null
public function close(array|string $order): null|array|Collection
{
$order = is_array($order) ? $order : ['out_trade_no' => $order];

Expand All @@ -99,7 +99,7 @@
* @throws InvalidParamsException
* @throws ServiceNotFoundException
*/
public function refund(array $order): Collection|array
public function refund(array $order): array|Collection
{
Event::dispatch(new Event\MethodCalled('alipay', __METHOD__, $order, null));

Expand Down
8 changes: 4 additions & 4 deletions src/Provider/Unipay.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __call(string $shortcut, array $params): null|Collection|Message
* @throws InvalidParamsException
* @throws ServiceNotFoundException
*/
public function find(array|string $order): Collection|array
public function find(array|string $order): array|Collection
{
if (!is_array($order)) {
throw new InvalidParamsException(Exception::UNIPAY_FIND_STRING_NOT_SUPPORTED);
Expand All @@ -68,7 +68,7 @@ public function find(array|string $order): Collection|array
* @throws InvalidParamsException
* @throws ServiceNotFoundException
*/
public function cancel(array|string $order): Collection|array|null
public function cancel(array|string $order): null|array|Collection
{
if (!is_array($order)) {
throw new InvalidParamsException(Exception::UNIPAY_CANCEL_STRING_NOT_SUPPORTED);
Expand All @@ -82,7 +82,7 @@ public function cancel(array|string $order): Collection|array|null
/**
* @throws InvalidParamsException
*/
public function close(array|string $order): Collection|array|null
public function close(array|string $order): null|array|Collection
{
throw new InvalidParamsException(Exception::METHOD_NOT_SUPPORTED, 'Unipay does not support close api');
}
Expand All @@ -92,7 +92,7 @@ public function close(array|string $order): Collection|array|null
* @throws InvalidParamsException
* @throws ServiceNotFoundException
*/
public function refund(array $order): Collection|array
public function refund(array $order): array|Collection
{
Event::dispatch(new Event\MethodCalled('unipay', __METHOD__, $order, null));

Expand Down
8 changes: 4 additions & 4 deletions src/Provider/Wechat.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
* @throws InvalidParamsException
* @throws ServiceNotFoundException
*/
public function find(array|string $order): Collection|array
public function find(array|string $order): array|Collection

Check warning on line 67 in src/Provider/Wechat.php

View check run for this annotation

Codecov / codecov/patch

src/Provider/Wechat.php#L67

Added line #L67 was not covered by tests
{
$order = is_array($order) ? $order : ['transaction_id' => $order];

Expand All @@ -76,7 +76,7 @@
/**
* @throws InvalidParamsException
*/
public function cancel(array|string $order): null|Collection|array
public function cancel(array|string $order): null|array|Collection

Check warning on line 79 in src/Provider/Wechat.php

View check run for this annotation

Codecov / codecov/patch

src/Provider/Wechat.php#L79

Added line #L79 was not covered by tests
{
throw new InvalidParamsException(Exception::METHOD_NOT_SUPPORTED, 'Wechat does not support cancel api');
}
Expand All @@ -86,7 +86,7 @@
* @throws InvalidParamsException
* @throws ServiceNotFoundException
*/
public function close(array|string $order): null|Collection|array
public function close(array|string $order): null|array|Collection
{
$order = is_array($order) ? $order : ['out_trade_no' => $order];

Expand All @@ -102,7 +102,7 @@
* @throws InvalidParamsException
* @throws ServiceNotFoundException
*/
public function refund(array $order): Collection|array
public function refund(array $order): array|Collection

Check warning on line 105 in src/Provider/Wechat.php

View check run for this annotation

Codecov / codecov/patch

src/Provider/Wechat.php#L105

Added line #L105 was not covered by tests
{
Event::dispatch(new Event\MethodCalled('wechat', __METHOD__, $order, null));

Expand Down
6 changes: 3 additions & 3 deletions src/Rocket.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Rocket implements JsonSerializableInterface, ArrayAccess

private string $direction = DirectionInterface::class;

private null|MessageInterface|Collection $destination = null;
private null|Collection|MessageInterface $destination = null;

private null|RequestInterface|ResponseInterface $destinationOrigin = null;

Expand Down Expand Up @@ -114,12 +114,12 @@ public function setDirection(string $direction): Rocket
return $this;
}

public function getDestination(): Collection|MessageInterface|null
public function getDestination(): null|Collection|MessageInterface
{
return $this->destination;
}

public function setDestination(Collection|MessageInterface|null $destination): Rocket
public function setDestination(null|Collection|MessageInterface $destination): Rocket
{
$this->destination = $destination;

Expand Down
52 changes: 52 additions & 0 deletions web/.vitepress/theme/components/Docs/AsideOutlineAfter.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<script setup lang="ts">
const companies = [
{
name: 'df81.com',
link: 'https://df81.com/',
image: '/images/companies/df81.png'
},
]
</script>

<template>
<div class="business">
<div class="tips">赞助</div>
<div class="companies">
<a v-for="company,idx in companies" :key="idx" :href="company.link" target="_blank" rel="noopener noreferrer" class="company">
<img :src="company.image" :alt="company.name" class="company-img"/>
</a>
</div>
</div>
</template>

<style scoped lang="scss">
.business {
margin-top: 20px;

.tips {
font-size: 10px;
text-align: center;
color: #636363;
}

.companies {
display: grid;
grid-template-columns: repeat(1, 1fr);
grid-column-gap: 4px;

.company {
width: 100%;
height: 50px;
margin: 2px 0;
background-color: #f9f9f9;
display: flex;
justify-content: center;
align-items: center;

.company-img {
max-height: 50px;
}
}
}
}
</style>
58 changes: 25 additions & 33 deletions web/.vitepress/theme/components/Docs/Donate/Companies.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,39 @@
</script>

<template>
<div class="donate">
<div class="companies">
<a v-for="company,idx in companies" :key="idx" :href="company.link" target="_blank" rel="noopener noreferrer" class="company">
<img :src="company.image" :alt="company.name" class="company-img"/>
</a>
</div>
<div class="companies">
<a v-for="company,idx in companies" :key="idx" :href="company.link" target="_blank" rel="noopener noreferrer" class="company">
<img :src="company.image" :alt="company.name" class="company-img"/>
</a>
</div>
</template>

<style scoped lang="scss">
.donate {
width: 100%;
.companies {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-column-gap: 4px;

.companies {
width: 100%;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-column-gap: 4px;

@media (max-width: 720px) {
grid-template-columns: repeat(2, 1fr);
grid-column-gap: 0;
}
@media (max-width: 720px) {
grid-template-columns: repeat(2, 1fr);
grid-column-gap: 0;
}

@media (max-width: 480px) {
grid-template-columns: repeat(1, 1fr);
}
@media (max-width: 480px) {
grid-template-columns: repeat(1, 1fr);
}

.company {
width: 100%;
height: 100px;
margin: 2px 0;
background-color: #f9f9f9;
display: flex;
justify-content: center;
align-items: center;
.company {
height: 100px;
margin: 2px 0;
background-color: #f9f9f9;
display: flex;
justify-content: center;
align-items: center;

.company-img {
max-height: 100px;
}
.company-img {
max-height: 100px;
}
}
}
</style>
</style>
Loading