Pārlūkot izejas kodu

chore(core): 移除 think-migration 依赖并修复代码格式

runphp 1 mēnesi atpakaļ
vecāks
revīzija
f9969f638f

+ 0 - 1
composer.json

@@ -27,7 +27,6 @@
     "topthink/framework": "^8.1",
     "topthink/think-orm": "^4.0",
     "topthink/think-helper": "^3.1.11",
-    "topthink/think-migration": "^3.1.1",
     "topthink/think-multi-app": "^1.1.1",
     "topthink/think-queue": "^3.0.12",
     "topthink/think-view": "^2.0.5",

+ 1 - 0
info.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 return [

+ 2 - 2
src/Attribute/Cron.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core\Attribute;
@@ -11,7 +12,6 @@ class Cron
     public function __construct(
         public string $rule,
         public string $name = '',
-    )
-    {
+    ) {
     }
 }

+ 3 - 3
src/Attribute/Hook.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core\Attribute;
@@ -10,7 +11,6 @@ class Hook
 {
     public function __construct(
         public string|array $hook,
-    )
-    {
+    ) {
     }
-}
+}

+ 2 - 2
src/Contracts/CoreExtensionInterface.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core\Contracts;
@@ -8,5 +9,4 @@ namespace SixShop\Core\Contracts;
  */
 interface CoreExtensionInterface
 {
-
-}
+}

+ 2 - 1
src/Contracts/ExtensionInterface.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core\Contracts;
@@ -56,4 +57,4 @@ interface ExtensionInterface
      * 启动扩展
      */
     public function boot(): void;
-}
+}

+ 5 - 3
src/Contracts/LogisticsInformationResponse.php

@@ -1,5 +1,7 @@
 <?php
+
 declare(strict_types=1);
+
 namespace SixShop\Core\Contracts;
 
 use JsonSerializable;
@@ -19,8 +21,8 @@ class LogisticsInformationResponse implements JsonSerializable
         public string $extensionID,
         public string $number,
         public string $type,
-        public array $raw)
-    {
+        public array $raw
+    ) {
     }
 
     public function jsonSerialize(): array
@@ -32,4 +34,4 @@ class LogisticsInformationResponse implements JsonSerializable
             'raw' => $this->raw
         ];
     }
-}
+}

+ 2 - 1
src/Contracts/LogisticsInterface.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core\Contracts;
@@ -14,4 +15,4 @@ interface LogisticsInterface
      * @param string $type 快递类型
      */
     public function logisticsInformation(string $number, string $type = ''): LogisticsInformationResponse;
-}
+}

+ 4 - 3
src/Entity/BaseEntity.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core\Entity;
@@ -14,10 +15,10 @@ abstract class BaseEntity extends Entity
     {
         return [
             'modelClass' => str_replace(
-                ['\\Entity\\', '\\entity\\','Entity'], 
-                ['\\Model\\', '\\model\\', 'Model'], 
+                ['\\Entity\\', '\\entity\\','Entity'],
+                ['\\Model\\', '\\model\\', 'Model'],
                 static::class
             ),
         ];
     }
-}
+}

+ 2 - 2
src/Event/BeforeRegisterRouteEvent.php

@@ -1,11 +1,11 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core\Event;
 
 class BeforeRegisterRouteEvent
 {
-
     public function __construct(private array $middlewares = [])
     {
     }
@@ -19,4 +19,4 @@ class BeforeRegisterRouteEvent
     {
         $this->middlewares[] = $middleware;
     }
-}
+}

+ 3 - 1
src/Exception/ExceptionHandle.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core\Exception;
@@ -10,6 +11,7 @@ use think\exception\ValidateException;
 use think\Request;
 use think\Response;
 use Throwable;
+
 use function SixShop\Core\error_response;
 
 class ExceptionHandle extends Handle
@@ -48,4 +50,4 @@ class ExceptionHandle extends Handle
 
         return $deployInfo;
     }
-}
+}

+ 2 - 1
src/Exception/LogicException.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core\Exception;
@@ -19,4 +20,4 @@ class LogicException extends HttpResponseException
     {
         return $this->status;
     }
-}
+}

+ 3 - 1
src/Exception/NotFoundException.php

@@ -1,10 +1,12 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core\Exception;
 
 use Exception;
 use think\exception\HttpResponseException;
+
 use function SixShop\Core\error_response;
 
 class NotFoundException extends HttpResponseException
@@ -18,4 +20,4 @@ class NotFoundException extends HttpResponseException
         }
         parent::__construct(error_response(msg: $msg, status: 'not_found', code: 404, httpCode: 200));
     }
-}
+}

+ 2 - 2
src/Extension.php

@@ -1,9 +1,9 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core;
 
-
 use SixShop\Core\Contracts\CoreExtensionInterface;
 
 class Extension extends ExtensionAbstract implements CoreExtensionInterface
@@ -12,4 +12,4 @@ class Extension extends ExtensionAbstract implements CoreExtensionInterface
     {
         return dirname(__DIR__);
     }
-}
+}

+ 2 - 1
src/ExtensionAbstract.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core;
@@ -100,4 +101,4 @@ abstract class ExtensionAbstract implements ExtensionInterface
     {
         $this->isBooted = true;
     }
-}
+}

+ 2 - 1
src/ExtensionInstaller.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core;
@@ -11,4 +12,4 @@ class ExtensionInstaller extends LibraryInstaller
     {
         return $packageType === $this->type;
     }
-}
+}

+ 3 - 4
src/Helper.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core;
@@ -14,7 +15,6 @@ use think\Response;
  */
 final class Helper
 {
-
     /**
      * 返回成功数据
      * @deprecated 函数已弃用, 请使用 success_response()
@@ -83,9 +83,8 @@ final class Helper
         int    $parentId = 0,
         string $childrenKey = 'children',
         bool   $preserveOriginal = true
-    ): array
-    {
-       return build_tree_options($data, $valueField, $labelField, $parentField, $parentId, $childrenKey, $preserveOriginal);
+    ): array {
+        return build_tree_options($data, $valueField, $labelField, $parentField, $parentId, $childrenKey, $preserveOriginal);
     }
 
     /**

+ 3 - 1
src/Job/BaseJob.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core\Job;
@@ -8,6 +9,7 @@ use Exception;
 use think\facade\Log;
 use think\queue\Job;
 use Throwable;
+
 use function Opis\Closure\{serialize, unserialize};
 
 /**
@@ -39,7 +41,7 @@ abstract class BaseJob
         if ($data instanceof Closure) {
             $data = serialize($data);
         }
-        return new JobDispatcher(static ::class, $data, $delay, $queue);
+        return new JobDispatcher(static::class, $data, $delay, $queue);
     }
 
     /**

+ 2 - 2
src/Job/JobDispatcher.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core\Job;
@@ -10,8 +11,7 @@ class JobDispatcher
         private readonly mixed  $data = null,
         private int             $delay = 0,
         private ?string         $queue = null
-    )
-    {
+    ) {
     }
 
     /**

+ 3 - 2
src/Plugin.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core;
@@ -33,7 +34,7 @@ class Plugin implements PluginInterface, EventSubscriberInterface
         if (self::$installedSixShopExtensions) {
             return self::$installedSixShopExtensions;
         }
-        $composerDir = dirname(InstalledVersions::getInstallPath('composer/composer'),2);
+        $composerDir = dirname(InstalledVersions::getInstallPath('composer/composer'), 2);
         $filePath = $composerDir . '/installedSixShop.php';
         if (file_exists($filePath)) {
             return self::$installedSixShopExtensions = require $filePath;
@@ -74,4 +75,4 @@ class Plugin implements PluginInterface, EventSubscriberInterface
         $filePath = $event->getComposer()->getConfig()->get('vendor-dir') . '/composer/installedSixShop.php';
         file_put_contents($filePath, '<?php return ' . var_export($installedSixShopExtensions, true) . ';');
     }
-}
+}

+ 2 - 1
src/Request.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core;
@@ -27,4 +28,4 @@ class Request extends \think\Request
         $limit = min($limit, 1000);
         return ['page' => $page, 'list_rows' => $limit];
     }
-}
+}

+ 2 - 1
src/Response/Xml.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core\Response;
@@ -28,4 +29,4 @@ class Xml extends \think\response\Xml
         return $xml;
 
     }
-}
+}

+ 3 - 2
src/Service/AutoloadService.php

@@ -1,12 +1,13 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core\Service;
 
 use SixShop\Core\Contracts\ExtensionInterface;
 use think\App;
-use function SixShop\Core\extension_path;
 
+use function SixShop\Core\extension_path;
 
 readonly class AutoloadService
 {
@@ -49,4 +50,4 @@ readonly class AutoloadService
     {
         return $this->app->make('extension.' . $moduleName);
     }
-}
+}

+ 3 - 1
src/Service/CommandService.php

@@ -1,10 +1,12 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core\Service;
 
 use Closure;
 use think\exception\ClassNotFoundException;
+
 use function SixShop\Core\extension_name_list;
 
 readonly class CommandService
@@ -29,4 +31,4 @@ readonly class CommandService
         }
         $closure($commands);
     }
-}
+}

+ 7 - 3
src/Service/CoreService.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core\Service;
@@ -13,6 +14,7 @@ use SixShop\Core\Request;
 use think\event\HttpRun;
 use think\exception\Handle;
 use think\Service;
+
 use function SixShop\Core\extension_path;
 
 class CoreService extends Service
@@ -41,8 +43,10 @@ class CoreService extends Service
     {
         $this->app->bind(Handle::class, ExceptionHandle::class);
         $this->app->bind('think\Request', Request::class);
-        $this->app->bind('classLoader',
-            require $this->app->getRootPath() . 'vendor/autoload.php');
+        $this->app->bind(
+            'classLoader',
+            require $this->app->getRootPath() . 'vendor/autoload.php'
+        );
         self::$extensionPath = $this->app->getRootPath() . 'extension' . DIRECTORY_SEPARATOR;
         $this->initExtensionList();
         $this->compatibleExtensionNameList();
@@ -132,4 +136,4 @@ class CoreService extends Service
             $this->commands($commands);
         });
     }
-}
+}

+ 3 - 1
src/Service/HookAttributeService.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core\Service;
@@ -9,6 +10,7 @@ use ReflectionMethod;
 use SixShop\Core\Attribute\Hook;
 use think\Event;
 use think\exception\ClassNotFoundException;
+
 use function SixShop\Core\extension_name_list;
 
 readonly class HookAttributeService
@@ -46,4 +48,4 @@ readonly class HookAttributeService
             }
         }
     }
-}
+}

+ 3 - 1
src/Service/RegisterRouteService.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core\Service;
@@ -8,6 +9,7 @@ use SixShop\Core\Event\BeforeRegisterRouteEvent;
 use think\facade\Event;
 use think\facade\Route;
 use think\Http;
+
 use function SixShop\Core\extension_name_list;
 
 readonly class RegisterRouteService
@@ -37,4 +39,4 @@ readonly class RegisterRouteService
             }
         };
     }
-}
+}

+ 3 - 3
src/functions.php

@@ -1,4 +1,5 @@
 <?php
+
 declare(strict_types=1);
 
 namespace SixShop\Core;
@@ -93,8 +94,7 @@ function build_tree_options(
     int    $parentId = 0,
     string $childrenKey = 'children',
     bool   $preserveOriginal = true
-): array
-{
+): array {
     $tree = [];
     foreach ($data as $item) {
         if ($item[$parentField] == $parentId) {
@@ -193,4 +193,4 @@ function extension_name_list(): array
 function extension_composer_info(string $extensionID): array
 {
     return CoreService::$extensionComposerMap[$extensionID];
-}
+}