fix: correct know file issues

This commit is contained in:
xboard 2025-01-13 12:53:23 +08:00
parent 3bd4cf05dd
commit d54eabb617
14 changed files with 23 additions and 147 deletions

View File

@ -45,7 +45,7 @@ class ClearUser extends Command
->where('last_login_at', NULL);
$count = $builder->count();
if ($builder->delete()) {
$this->info("已删除${count}位没有任何数据的用户");
$this->info("已删除{$count}位没有任何数据的用户");
}
}
}

View File

@ -107,7 +107,7 @@ class ClientController extends Controller
private function getFilterArray(?string $filter): ?array
{
return mb_strlen($filter ?? '') > 20 ? null :
return mb_strlen((string) $filter) > 20 ? null :
explode('|', str_replace(['|', '', ','], '|', $filter));
}

View File

@ -32,7 +32,7 @@ class UniProxyController extends Controller
$response['users'] = $users;
$eTag = sha1(json_encode($response));
if (strpos($request->header('If-None-Match'), $eTag) !== false) {
if (strpos($request->header('If-None-Match', ''), $eTag) !== false) {
return response(null, 304);
}

View File

@ -20,7 +20,7 @@ class ServerController extends Controller
$servers = ServerService::getAvailableServers($user);
}
$eTag = sha1(json_encode(array_column($servers, 'cache_key')));
if (strpos($request->header('If-None-Match'), $eTag) !== false ) {
if (strpos($request->header('If-None-Match', ''), $eTag) !== false ) {
return response(null,304);
}
$data = NodeResource::collection($servers);

View File

@ -231,6 +231,9 @@ class Clash implements ProtocolInterface
private function isRegex($exp)
{
return @preg_match($exp, null) !== false;
if (empty($exp)) {
return false;
}
return @preg_match((string)$exp, '') !== false;
}
}

View File

@ -333,6 +333,9 @@ class ClashMeta implements ProtocolInterface
private function isRegex($exp)
{
return @preg_match($exp, null) !== false;
if (empty($exp)) {
return false;
}
return @preg_match($exp, '') !== false;
}
}

View File

@ -284,7 +284,10 @@ class Stash implements ProtocolInterface
private function isRegex($exp)
{
return @preg_match($exp, null) !== false;
if (empty($exp)) {
return false;
}
return @preg_match($exp, '') !== false;
}
private function isMatch($exp, $str)

View File

@ -100,6 +100,13 @@ return [
'driver' => 'errorlog',
'level' => 'debug',
],
'deprecations' => [
'driver' => 'daily',
'path' => storage_path('logs/deprecations.log'),
'level' => 'debug',
'days' => 14,
],
],
];

View File

@ -1,26 +0,0 @@
<?php
use Illuminate\Http\Request;
use SwooleTW\Http\Websocket\Facades\Websocket;
/*
|--------------------------------------------------------------------------
| Websocket Routes
|--------------------------------------------------------------------------
|
| Here is where you can register websocket events for your application.
|
*/
Websocket::on('connect', function ($websocket, Request $request) {
// called while socket on connect
});
Websocket::on('disconnect', function ($websocket) {
// called while socket on disconnect
});
Websocket::on('example', function ($websocket, $data) {
$websocket->emit('message', $data);
});

View File

@ -1,42 +0,0 @@
<?php
namespace Tests;
use Illuminate\Contracts\Console\Kernel;
use PHPUnit\Runner\AfterLastTestHook;
use PHPUnit\Runner\BeforeFirstTestHook;
class Bootstrap implements BeforeFirstTestHook, AfterLastTestHook
{
/*
|--------------------------------------------------------------------------
| Bootstrap The Test Environment
|--------------------------------------------------------------------------
|
| You may specify console commands that execute once before your test is
| run. You are free to add your own additional commands or logic into
| this file as needed in order to help your test suite run quicker.
|
*/
use CreatesApplication;
public function executeBeforeFirstTest(): void
{
$console = $this->createApplication()->make(Kernel::class);
$commands = [
'config:cache',
'event:cache',
];
foreach ($commands as $command) {
$console->call($command);
}
}
public function executeAfterLastTest(): void
{
array_map('unlink', glob('bootstrap/cache/*.phpunit.php'));
}
}

View File

@ -1,22 +0,0 @@
<?php
namespace Tests;
use Illuminate\Contracts\Console\Kernel;
trait CreatesApplication
{
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__ . '/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
return $app;
}
}

View File

@ -1,21 +0,0 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testBasicTest()
{
$response = $this->get('/');
$response->assertStatus(200);
}
}

View File

@ -1,10 +0,0 @@
<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
}

View File

@ -1,19 +0,0 @@
<?php
namespace Tests\Unit;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testBasicTest()
{
$this->assertTrue(true);
}
}