Skip to content

Commit

Permalink
cs fix
Browse files Browse the repository at this point in the history
  • Loading branch information
crazywhalecc committed Aug 16, 2023
1 parent c223097 commit c0a167b
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 82 deletions.
3 changes: 0 additions & 3 deletions src/OneBot/Config/Loader/AbstractFileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@

abstract class AbstractFileLoader implements LoaderInterface
{
/**
* {@inheritDoc}
*/
public function load($source): array
{
// TODO: flexible base path
Expand Down
3 changes: 0 additions & 3 deletions src/OneBot/Config/Loader/DelegateLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ public function __construct(array $loaders = null)
$this->loaders = $loaders ?? self::getDefaultLoaders();
}

/**
* {@inheritDoc}
*/
public function load($source): array
{
return $this->determineLoader($source)->load($source);
Expand Down
3 changes: 0 additions & 3 deletions src/OneBot/Config/Loader/JsonFileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

class JsonFileLoader extends AbstractFileLoader
{
/**
* {@inheritDoc}
*/
protected function loadFile(string $file)
{
try {
Expand Down
12 changes: 0 additions & 12 deletions src/OneBot/Config/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ public function __construct(array $config = [])
$this->config = $config;
}

/**
* {@inheritDoc}
*/
public function get(string $key, $default = null)
{
// 在表层直接查找,找到就直接返回
Expand Down Expand Up @@ -51,9 +48,6 @@ public function get(string $key, $default = null)
return $data;
}

/**
* {@inheritDoc}
*/
public function set(string $key, $value): void
{
if ($value === null) {
Expand All @@ -75,17 +69,11 @@ public function set(string $key, $value): void
$data = $value;
}

/**
* {@inheritDoc}
*/
public function has(string $key): bool
{
return $this->get($key) !== null;
}

/**
* {@inheritDoc}
*/
public function all(): array
{
return $this->config;
Expand Down
3 changes: 0 additions & 3 deletions src/OneBot/Driver/Event/DriverEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ public static function getName(): string
return static::$custom_name ?? static::class;
}

/**
* {@inheritDoc}
*/
public function isPropagationStopped(): bool
{
return $this->propagation_stopped;
Expand Down
15 changes: 0 additions & 15 deletions src/OneBot/Driver/Swoole/EventLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,11 @@

class EventLoop extends DriverEventLoopBase
{
/**
* {@inheritDoc}
*/
public function addReadEvent($fd, callable $callable)
{
Event::add($fd, $callable);
}

/**
* {@inheritDoc}
*/
public function delReadEvent($fd)
{
Event::del($fd);
Expand All @@ -36,9 +30,6 @@ public function delWriteEvent($fd)
Event::del($fd);
}

/**
* {@inheritDoc}
*/
public function addTimer(int $ms, callable $callable, int $times = 1, array $arguments = []): int
{
$timer_count = 0;
Expand All @@ -54,17 +45,11 @@ public function addTimer(int $ms, callable $callable, int $times = 1, array $arg
}, ...$arguments);
}

/**
* {@inheritDoc}
*/
public function clearTimer(int $timer_id)
{
Timer::clear($timer_id);
}

/**
* {@inheritDoc}
*/
public function clearAllTimer()
{
Timer::clearAll();
Expand Down
3 changes: 0 additions & 3 deletions src/OneBot/Driver/Swoole/Socket/WSServerSocket.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ public function close($fd): bool
return false;
}

/**
* {@inheritDoc}
*/
public function send($data, $fd): bool
{
if ($data instanceof FrameInterface) {
Expand Down
3 changes: 0 additions & 3 deletions src/OneBot/Driver/Swoole/SwooleDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ public function getEventLoop(): DriverEventLoopBase
return EventLoop::getInstance();
}

/**
* {@inheritDoc}
*/
public function initInternalDriverClasses(?array $http, ?array $http_webhook, ?array $ws, ?array $ws_reverse): array
{
if (!empty($ws)) {
Expand Down
21 changes: 0 additions & 21 deletions src/OneBot/Driver/Workerman/EventLoop.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@

class EventLoop extends DriverEventLoopBase
{
/**
* {@inheritDoc}
*/
public function addTimer(int $ms, callable $callable, int $times = 1, array $arguments = []): int
{
$timer_count = 0;
Expand All @@ -28,49 +25,31 @@ public function addTimer(int $ms, callable $callable, int $times = 1, array $arg
}, $arguments);
}

/**
* {@inheritDoc}
*/
public function clearTimer(int $timer_id)
{
Timer::del($timer_id);
}

/**
* {@inheritDoc}
*/
public function addReadEvent($fd, callable $callable)
{
Worker::getEventLoop()->add($fd, EventInterface::EV_READ, $callable);
}

/**
* {@inheritDoc}
*/
public function delReadEvent($fd)
{
Worker::getEventLoop()->del($fd, EventInterface::EV_READ);
}

/**
* {@inheritDoc}
*/
public function addWriteEvent($fd, callable $callable)
{
Worker::getEventLoop()->add($fd, EventInterface::EV_WRITE, $callable);
}

/**
* {@inheritDoc}
*/
public function delWriteEvent($fd)
{
Worker::getEventLoop()->del($fd, EventInterface::EV_WRITE);
}

/**
* {@inheritDoc}
*/
public function clearAllTimer()
{
Timer::delAll();
Expand Down
9 changes: 5 additions & 4 deletions src/OneBot/Driver/Workerman/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static function stopAll($code = 0, $log = '')
}
foreach ($worker_pid_array as $worker_pid) {
\posix_kill($worker_pid, $sig);
if (!static::$_gracefulStop){
if (!static::$_gracefulStop) {
Timer::add(static::$stopTimeout, '\posix_kill', [$worker_pid, \SIGKILL], false);
}
}
Expand All @@ -130,7 +130,7 @@ public static function stopAll($code = 0, $log = '')
else {
// Execute exit.
foreach (static::$_workers as $worker) {
if (!$worker->stopping){
if (!$worker->stopping) {
$worker->stop();
$worker->stopping = true;
}
Expand All @@ -156,7 +156,8 @@ public static function stopAll($code = 0, $log = '')
*
* @return array
*/
public static function getStartFilesForWindows() {
public static function getStartFilesForWindows()
{
return [''];
}

Expand Down Expand Up @@ -303,7 +304,7 @@ protected static function parseCommand(): void
}
static::safeEcho("\nPress Ctrl+C to quit.\n\n");
}
// no break
// no break
case 'connections':
if (\is_file($statistics_file) && is_writable($statistics_file)) {
\unlink($statistics_file);
Expand Down
5 changes: 0 additions & 5 deletions src/OneBot/Driver/Workerman/WorkermanDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ public function getWSServerSocketByWorker(Worker $worker): ?WSServerSocket
return null;
}

/**
* {@inheritDoc}
*/
public function run(): void
{
try {
Expand Down Expand Up @@ -121,8 +118,6 @@ public function getName(): string
}

/**
* {@inheritDoc}
*
* @throws \Exception
*/
public function initWSReverseClients(array $headers = [])
Expand Down
2 changes: 1 addition & 1 deletion src/OneBot/V12/EventBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function valid(): bool
try {
$this->event = new OneBotEvent($this->data);
return true;
}catch (OneBotException $e) {
} catch (OneBotException $e) {
return false;
}
}
Expand Down
12 changes: 6 additions & 6 deletions tests/OneBot/Config/RepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ protected function setUp(): void
);
}

// 尚未确定是否应该支持
// public function testGetValueWhenKeyContainsDot(): void
// {
// $this->assertEquals('c', $this->repository->get('a.b'));
// $this->assertEquals('d', $this->repository->get('a.b.c'));
// }
// 尚未确定是否应该支持
// public function testGetValueWhenKeyContainsDot(): void
// {
// $this->assertEquals('c', $this->repository->get('a.b'));
// $this->assertEquals('d', $this->repository->get('a.b.c'));
// }

public function testGetBooleanValue(): void
{
Expand Down

0 comments on commit c0a167b

Please sign in to comment.